Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests from Exercise Chapter 8 - Indexer not possible #24

Open
RichStone opened this issue Aug 28, 2019 · 2 comments
Open

Running tests from Exercise Chapter 8 - Indexer not possible #24

RichStone opened this issue Aug 28, 2019 · 2 comments

Comments

@RichStone
Copy link

The WikiFetcher looks in the class path for a locally stored resources folder with the HTML page to be tested, which is not provided in the repository:

// read the file
InputStream stream = WikiFetcher.class.getClassLoader().getResourceAsStream(filename);
Document doc = Jsoup.parse(stream, "UTF-8", filename);
@LucestDail
Copy link

LucestDail commented Aug 31, 2020

Try this
Comment about this code : http://dailusia.blog.fc2.com/blog-entry-194.html
WikiFetcher.java

	public Elements readWikipedia(String url) throws IOException {
		InputStream inStream = new URL(url).openStream();
		Document doc = Jsoup.parse(inStream, "UTF-8", url);
		Element content = doc.getElementById("mw-content-text");
		Elements paras = content.select("p");
		return paras;
	}

TermCounterTest.java

	public void testSize() {
		System.out.println("testing size value : " + counter.size());
		assertThat(counter.size(), is(4556));
	}

@Tyrannogyna
Copy link

In case it's useful to someone: you can copy the resources folder in the solutions to the code/src folder and it will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants