ExistenceCheck implements ReviewParticipant { @Override public Review review(PropertyFileDescriptor descriptor, Property master, Property slave) { boolean masterExists = exists(master); if(masterExists) return null; if(master!=null) { if(!exists(slave)) return null; } if(slave != null) { Review review = PropertiesFactory.eINSTANCE.createReview(); review.setCreated(System.currentTimeMillis()); String message = "The key ''{0}'' is missing in the template language"; message = MessageFormat.format(message, slave.getKey()); review.setMessage(message); review.setUser("Jabylon"); review.setReviewType(getReviewType()); review.setSeverity(Severity.ERROR); return review; } return null; } ExistenceCheck(); @Override Review review(PropertyFileDescriptor descriptor, Property master,
            Property slave); @Override String getReviewType(); @Override String getID(); @Override String getDescription(); @Override String getName();  }
@Test public void testReview() { Property slave = createProperty("key", "value"); Review review = getFixture().review(null, null, slave); assertNotNull("must create a review if slave existis without template", review); }
@Test public void testReviewWithBothPresent() { Property slave = createProperty("key", "value"); Property master = createProperty("key", "value"); Review review = getFixture().review(null, master, slave); assertNull(review); }
@Test public void testReviewWithEmptySlave() { Property slave = createProperty("key", ""); Property master = createProperty("key", "value"); Review review = getFixture().review(null, master, slave); assertNull( "empty translation is not worth a review. The UI spots that alone", review); }
@Test public void testReviewWithEmptyMaster() { Property slave = createProperty("key", "value"); Property master = createProperty("key", ""); Review review = getFixture().review(null, master, slave); assertNotNull( "its faulty if the master has no value, but there is a translation", review); }
@Test public void testReviewWithBothEmpty() { Property slave = createProperty("key", ""); Property master = createProperty("key", ""); Review review = getFixture().review(null, master, slave); assertNull("its alright if both are empty", review); }
@Test public void testReviewWithNullAndEmpty() { Property slave = createProperty("key", ""); Review review = getFixture().review(null, null, slave); assertNotNull( "the value is empty, but the key in the translation is still wrong", review); }