コード例 #1
0
 @Test(expected = ItemNotFoundException.class)
 public void shouldFailToReturnAncestorWhenDepthIsGreaterThanNodeDepth() throws Exception {
   altimaModel.getAncestor(40);
 }
コード例 #2
0
 @Test
 public void shouldReturnSelfForAncestorOfDepthEqualToDepthOfNode() throws Exception {
   assertThat(altimaModel.getAncestor(altimaModel.getDepth()), is((Item) altimaModel));
   assertThat(altimaModel.getAncestor(altimaModel.getDepth() - 1), is((Item) altima));
 }
コード例 #3
0
 @Test
 public void shouldReturnRootForAncestorOfDepthZero() throws Exception {
   assertThat(altimaModel.getAncestor(0), is((Item) rootNode));
 }
コード例 #4
0
 @Test
 public void shouldReturnAncestorAtLevelOneForAncestorOfDepthOne() throws Exception {
   assertThat(altimaModel.getAncestor(1), is((Item) cars));
 }
コード例 #5
0
 @Test(expected = ItemNotFoundException.class)
 public void shouldNotAllowNegativeAncestorDepth() throws Exception {
   altimaModel.getAncestor(-1);
 }