package tudelft.healthpsychology.traumaontologies.answerstate; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.junit.Before; import org.junit.Test; import tudelft.healthpsychology.traumaontologies.questiontypes.Bool; import tudelft.healthpsychology.traumaontologies.questiontypes.TypedQuestion; import tudelft.utilities.tree.Tree; public class AnswersDepthFirstStateTest { private final OntologyNode node = mock(OntologyNode.class); private final Bool moreq = mock(Bool.class); private final OntoPropAnswerState firststate = mock( OntoPropAnswerState.class); private final TypedQuestion options = mock(TypedQuestion.class); private final Tree, OntologyNode> tree = mock( Tree.class); @Before public void before() { when(tree.get(any(String.class))).thenReturn(node); } @Test public void smokeTest() { List answerstates = Arrays.asList(firststate); TypedQuestion options = mock(TypedQuestion.class); when(firststate.getOptions(tree)).thenReturn(options); new AnswersDepthFirstState("node", answerstates, false, moreq); } @Test public void getOptionsTest() { List answerstates = Arrays.asList(firststate); when(firststate.getOptions(tree)).thenReturn(options); AnswersDepthFirstState state = new AnswersDepthFirstState("node", answerstates, false, moreq); assertEquals(options, state.getOptions(tree)); } @Test public void getOptionsTestFirstStateDone() { List answerstates = Arrays.asList(firststate); when(firststate.getOptions(tree)).thenReturn(null); AnswersDepthFirstState state = new AnswersDepthFirstState("node", answerstates, false, moreq); assertEquals(moreq, state.getOptions(tree)); } }