@Test public void ifItsDifferentThereIsOther() { Criterion c = transactionService.runOnTransaction( new IOnTransaction<Criterion>() { @Override public Criterion execute() { return givenASavedCriterionWithAnExistentType(); } }); Criterion copy = Criterion.create(c.getName(), c.getType()); assertTrue(criterionDAO.thereIsOtherWithSameNameAndType(copy)); }
private Criterion anotherCriterionWithSameNameAndType(Criterion c) { return Criterion.create(c.getName(), c.getType()); }