HTMLParser { public boolean checkVacancy(String textVacancy){ this.pattern = Pattern.compile(this.REGEX); Matcher m = this.pattern.matcher(textVacancy); return m.find(); } HTMLParser(DBManager storage); Document getHtmlPage(String url); Elements getTableHtml(Document document); Elements getRowTable(Elements elements); boolean checkVacancy(String textVacancy); void addVacancy(String linkVacancy, String nameVacancy, String author, String linkAuthor, int ask, int view, long timeUpdate); long convertation(String time); String cleanNameVacancy(String name); long parseElementToVacancy(Elements column); long mainLoop();  }
@Test public void whenWeHaveJavaVacancyThatMatchItCorrect() throws Exception { Properties properties = new Properties(); try (FileInputStream fileInputStream = new FileInputStream(this.getClass().getClassLoader().getResource("vacancy.properties").getPath())) { properties.load(fileInputStream); } catch (FileNotFoundException e) { } catch (IOException e) { } HTMLParser parser = new HTMLParser(new DBManager(properties)); boolean result = parser.checkVacancy("Java developer"); boolean result2 = parser.checkVacancy("Java-developer"); boolean result3 = parser.checkVacancy("Java\\developer"); boolean result4 = parser.checkVacancy("Developer Java"); boolean result5 = parser.checkVacancy("Разработчик Java"); boolean result6 = parser.checkVacancy("Senior Java"); boolean result7 = !parser.checkVacancy("\"Java Script\""); boolean control = result && result2 && result3 && result4 & result5 && result6 && result7; Assert.assertThat(control, is(true)); }