use of org.javarosa.core.model.instance.utils.ITreeVisitor in project javarosa by opendatakit.
the class QuestionDataGroupTests method testAcceptsVisitor.
public void testAcceptsVisitor() {
final MutableBoolean visitorAccepted = new MutableBoolean(false);
final MutableBoolean dispatchedWrong = new MutableBoolean(false);
ITreeVisitor sampleVisitor = new ITreeVisitor() {
public void visit(FormInstance tree) {
dispatchedWrong.setValue(true);
}
public void visit(AbstractTreeElement element) {
visitorAccepted.setValue(true);
}
};
stringElement.accept(sampleVisitor);
assertTrue("The visitor's visit method was not called correctly by the QuestionDataElement", visitorAccepted.getValue());
assertTrue("The visitor was dispatched incorrectly by the QuestionDataElement", !dispatchedWrong.getValue());
}
use of org.javarosa.core.model.instance.utils.ITreeVisitor in project javarosa by opendatakit.
the class QuestionDataElementTests method testAcceptsVisitor.
public void testAcceptsVisitor() {
final MutableBoolean visitorAccepted = new MutableBoolean(false);
final MutableBoolean dispatchedWrong = new MutableBoolean(false);
ITreeVisitor sampleVisitor = new ITreeVisitor() {
public void visit(FormInstance tree) {
dispatchedWrong.bool = true;
}
public void visit(AbstractTreeElement element) {
visitorAccepted.bool = true;
}
};
stringElement.accept(sampleVisitor);
assertTrue("The visitor's visit method was not called correctly by the QuestionDataElement", visitorAccepted.getValue());
assertTrue("The visitor was dispatched incorrectly by the QuestionDataElement", !dispatchedWrong.getValue());
}
Aggregations