use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements1_1.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements1_1() {
LOGGER.debug("selectElements1-1");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-link-1.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, true, true);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElementsWithSelectorAsConstructorArgumentAndNoExclusionSpecification.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElementsWithSelectorAsConstructorArgumentAndNoExclusionSpecification() {
LOGGER.debug("selectElementsWithSelectorAsConstructorArguement");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-link-1.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(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.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements8_3.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements8_3() {
LOGGER.debug("selectElements8-3");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-composite-3.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, false);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements8_5.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements8_5() {
LOGGER.debug("selectElements8-5");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-composite-5.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, false, false);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.get().size() == 1);
assertTrue(elementHandler.get().iterator().next().nodeName().equals(HtmlElementStore.IMG_ELEMENT));
verifyMockContext();
}
use of org.asqatasun.ruleimplementation.ElementHandlerImpl in project Asqatasun by Asqatasun.
the class ImageElementSelectorTest method testSelectElements1_3.
/**
* Test of selectElements method, of class ImageElementSelector.
*/
public void testSelectElements1_3() {
LOGGER.debug("selectElements1-3");
Document doc = null;
try {
doc = Jsoup.parse(new File("src/test/resources/images/image-link-3.html"), Charset.defaultCharset().displayName());
} catch (IOException ex) {
}
initMockContext(HtmlElementStore.IMG_ELEMENT, doc);
ElementHandler<Element> elementHandler = new ElementHandlerImpl();
ImageElementSelector instance = new ImageElementSelector(HtmlElementStore.IMG_ELEMENT, true, true);
instance.selectElements(sspHandler, elementHandler);
assertTrue(elementHandler.isEmpty());
verifyMockContext();
}
Aggregations