@Test(expected = ItemNotFoundException.class)
 public void shouldFailToReturnAncestorWhenDepthIsGreaterThanNodeDepth() throws Exception {
   altimaModel.getAncestor(40);
 }
 @Test
 public void shouldIndicateIsNotNode() {
   assertThat(altimaModel.isNode(), is(false));
 }
 @Test
 public void shouldReturnAncestorAtLevelOneForAncestorOfDepthOne() throws Exception {
   assertThat(altimaModel.getAncestor(1), is((Item) cars));
 }
 @Test
 public void shouldReturnSelfForAncestorOfDepthEqualToDepthOfNode() throws Exception {
   assertThat(altimaModel.getAncestor(altimaModel.getDepth()), is((Item) altimaModel));
   assertThat(altimaModel.getAncestor(altimaModel.getDepth() - 1), is((Item) altima));
 }
 @Test(expected = ItemNotFoundException.class)
 public void shouldNotAllowNegativeAncestorDepth() throws Exception {
   altimaModel.getAncestor(-1);
 }
 @Test
 public void shouldReturnRootForAncestorOfDepthZero() throws Exception {
   assertThat(altimaModel.getAncestor(0), is((Item) rootNode));
 }
 @Test
 public void shouldAllowVisitation() throws Exception {
   ItemVisitor visitor = Mockito.mock(ItemVisitor.class);
   altimaModel.accept(visitor);
   Mockito.verify(visitor).visit(altimaModel);
 }
 @Test(expected = IllegalArgumentException.class)
 public void shouldNotAllowVisitationIfNoVisitor() throws Exception {
   altimaModel.accept(null);
 }
 @Test
 public void shouldProvideSession() throws Exception {
   assertThat(altimaModel.getSession(), is((Session) jcrSession));
 }
Exemplo n.º 10
0
 @Test
 public void shouldProvidePath() throws Exception {
   assertThat(altimaModel.getPath(), is(altima.getPath() + "/vehix:model"));
 }
Exemplo n.º 11
0
 @Test
 public void shouldProvideParent() throws Exception {
   assertThat(altimaModel.getParent(), is((Node) altima));
 }
Exemplo n.º 12
0
 @Test
 public void shouldProvideName() throws Exception {
   assertThat(altimaModel.getName(), is("vehix:model"));
 }
Exemplo n.º 13
0
 @Test
 public void shouldProvideExecutionContext() throws Exception {
   assertThat(altimaModel.context(), is(context));
 }