use of org.jsoup.nodes.Element in project Asqatasun by Asqatasun.
the class TextOnlyContainsNonAlphanumericalCharactersCheckerTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mockTextElementBuilder = createMock(TextElementBuilder.class);
mockSSPHandler = createMock(SSPHandler.class);
elements = new Elements();
element = new Element(Tag.valueOf("div"), "");
mockTestSolutionHandler = createMock(TestSolutionHandler.class);
mockProcessRemarkService = createMock(ProcessRemarkService.class);
}
use of org.jsoup.nodes.Element in project Asqatasun by Asqatasun.
the class CaptchaElementSelectorTest method testSelectElementsTextSibling2.
/**
* Test of selectElements method, of class CaptchaElementSelector.
* @throws java.io.IOException
*/
public void testSelectElementsTextSibling2() throws IOException {
LOGGER.debug("selectElementsTextSibling2");
Document doc = Jsoup.parse(new File("src/test/resources/captcha/captcha3.html"), Charset.defaultCharset().displayName());
initMockContext(doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
elementHandler.addAll(doc.select(HtmlElementStore.IMG_ELEMENT));
CaptchaElementSelector instance = new CaptchaElementSelector(elementHandler);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
use of org.jsoup.nodes.Element in project Asqatasun by Asqatasun.
the class CaptchaElementSelectorTest method testSelectElementsTextParent.
/**
* Test of selectElements method, of class CaptchaElementSelector.
*/
public void testSelectElementsTextParent() {
LOGGER.debug("selectElementsTextParent");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/captcha/captcha4.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
CaptchaElementSelector instance = new CaptchaElementSelector(new SimpleElementSelector(HtmlElementStore.IMG_ELEMENT));
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
use of org.jsoup.nodes.Element in project Asqatasun by Asqatasun.
the class CaptchaElementSelectorTest method testSelectElementsTextSibling1.
/**
* Test of selectElements method, of class CaptchaElementSelector.
* @throws java.io.IOException
*/
public void testSelectElementsTextSibling1() throws IOException {
LOGGER.debug("selectElementsTextSibling1");
Document doc = Jsoup.parse(new File("src/test/resources/captcha/captcha2.html"), Charset.defaultCharset().displayName());
initMockContext(doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
elementHandler.addAll(doc.select(HtmlElementStore.IMG_ELEMENT));
CaptchaElementSelector instance = new CaptchaElementSelector(elementHandler);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
use of org.jsoup.nodes.Element in project Asqatasun by Asqatasun.
the class CaptchaElementSelectorTest method testEmptyPreSelection.
/**
* Test of selectElements method, of class CaptchaElementSelector.
*/
public void testEmptyPreSelection() {
LOGGER.debug("EmptyPreSelection");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/captcha/captcha1.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(null, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
CaptchaElementSelector instance = new CaptchaElementSelector(elementHandler);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
}
Aggregations