/** * Returns true if this mutation has a matching identifier * * @param id * the MutationIdentifier to match * @return true if the MutationIdentifier matches otherwise false */ public Boolean matchesId(final MutationIdentifier id) { return this.id.matches(id); }
private static Predicate<MutationIdentifier> idMatches( final MutationIdentifier newId) { return a -> a.matches(newId); }
@Test public void shouldMatchWhenIndexesOverlap() { final MutationIdentifier a = new MutationIdentifier(aLocation().build(), new HashSet<>(Arrays.asList(1, 2)), "M"); final MutationIdentifier b = new MutationIdentifier(aLocation().build(), 1, "M"); assertTrue(a.matches(b)); }
@Test public void shouldNotMatchWhenIndexesDoNotOverlap() { final MutationIdentifier a = new MutationIdentifier(aLocation().build(), new HashSet<Integer>(100, 200), "M"); final MutationIdentifier b = new MutationIdentifier(aLocation().build(), 1, "M"); assertFalse(a.matches(b)); }
/** * Returns true if this mutation has a matching identifier * * @param id * the MutationIdentifier to match * @return true if the MutationIdentifier matches otherwise false */ public Boolean matchesId(final MutationIdentifier id) { return this.id.matches(id); }
private static Predicate<MutationIdentifier> idMatches( final MutationIdentifier newId) { return a -> a.matches(newId); }
@Test public void shouldMatchWhenObjectsAreEqual() { final MutationIdentifier a = aMutationId().build(); final MutationIdentifier b = aMutationId().build(); assertTrue(a.matches(b)); }
@Test public void shouldNotMatchWhenMutatorsDiffer() { final MutationIdentifier a = aMutationId().withMutator("A").build(); final MutationIdentifier b = aMutationId().withMutator("XXXX").build(); assertFalse(a.matches(b)); }
@Test public void shouldNotMatchWhenIndexesDiffer() { final MutationIdentifier a = aMutationId().withIndex(1).build(); final MutationIdentifier b = aMutationId().withIndex(100).build(); assertFalse(a.matches(b)); }
@Test public void shouldNotMatchWhenLocationsDiffer() { final MutationIdentifier a = new MutationIdentifier(aLocation() .withMethodDescription("X").build(), 1, "M"); final MutationIdentifier b = new MutationIdentifier(aLocation() .withMethodDescription("Y").build(), 1, "M"); assertFalse(a.matches(b)); }