예제 #1
0
 @Test
 public void shouldNotRecordMutationsAsInFinallyBlockWhenTheyAreNot() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails = findMutationsFor(HasExceptionBlock.class);
   assertFalse(actualDetails.get(0).isInFinallyBlock());
   assertFalse(actualDetails.get(1).isInFinallyBlock());
 }
예제 #2
0
 @Test
 public void shouldMarkMutationsWithinFinallyBlocksWhenExceptionHandlerAlsoPresent() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails =
       findMutationsFor(HasFinallyBlockAndExceptionHandler.class);
   assertEquals(1, FCollection.filter(actualDetails, isInFinallyBlock()).size());
 }
예제 #3
0
 @Test
 public void shouldRecordMutationsAsInSameBlockWhenSwitchStatementFallsThrough() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails = findMutationsFor(FallThroughSwitch.class);
   assertEquals(2, actualDetails.size());
   final int firstMutationBlock = actualDetails.get(0).getBlock();
   assertEquals(firstMutationBlock, actualDetails.get(1).getBlock());
 }
예제 #4
0
 @Test
 public void shouldRecordMutationsAsInSameBlockWhenForAStraightThroughMethod() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails = findMutationsFor(OneStraightThroughMethod.class);
   assertEquals(2, actualDetails.size());
   final int firstMutationBlock = actualDetails.get(0).getBlock();
   assertEquals(firstMutationBlock, actualDetails.get(1).getBlock());
 }
예제 #5
0
 @Test
 public void shouldRecordMutationsAsInDifferentBlocksWhenInDifferentBranchesOfSwitchStatement() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails = findMutationsFor(SwitchStatement.class);
   assertEquals(3, actualDetails.size());
   final int firstMutationBlock = actualDetails.get(0).getBlock();
   assertEquals(firstMutationBlock + 1, actualDetails.get(1).getBlock());
   assertEquals(firstMutationBlock + 2, actualDetails.get(2).getBlock());
 }
예제 #6
0
 @Test
 public void shouldRecordMutationsAsInDifferentBlocksWhenInExceptionHandler() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails = findMutationsFor(HasExceptionBlock.class);
   assertTwoMutationsInDifferentBlocks(actualDetails);
 }
예제 #7
0
 @Test
 public void shouldRecordMutationsAsInDifferentBlocksWhenInDifferentBranchesOfIfStatement() {
   createTesteeWith(Mutator.INCREMENTS.asCollection());
   final List<MutationDetails> actualDetails = findMutationsFor(SimpleBranch.class);
   assertTwoMutationsInDifferentBlocks(actualDetails);
 }