PunctuationCheck implements ReviewParticipant { @Override public Review review(PropertyFileDescriptor descriptor, Property master, Property slave) { if(master==null||slave==null||slave.getValue()==null||slave.getValue().isEmpty()) return null; short[] templateOccurrences = new short[hotchars.length]; String value = master.getValue(); String translation = slave.getValue(); countHotChars(value,templateOccurrences); subtractHotChars(translation,templateOccurrences); for(int i = 0;i<hotchars.length;i++) { int occ = templateOccurrences[i]; if(occ!=0) { Review review = PropertiesFactory.eINSTANCE.createReview(); review.setCreated(System.currentTimeMillis()); String message; if(occ<0) message = "Translation contains more ''{0}'' characters than the template."; else message = "Translation contains less ''{0}'' characters than the template."; message = MessageFormat.format(message, hotchars[i]); review.setMessage(message); review.setReviewType(getReviewType()); review.setSeverity(Severity.WARNING); review.setUser("Jabylon"); return review; } } return null; }  @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 templ = createProperty("", "test {\"}"); Property trans = createProperty("", "{\" test"); assertNotNull(getFixture().review(null, templ, trans)); }
@Test public void testReview2() { Property templ = createProperty("", "test {\"}}}"); Property trans = createProperty("", "{\"}}}\" test"); assertNotNull(getFixture().review(null, templ, trans)); }
@Test public void testReview3() { Property templ = createProperty("", "test \"\"\""); Property trans = createProperty("", "\"\" test"); assertNotNull(getFixture().review(null, templ, trans)); }
@Test public void testReview4() { Property templ = createProperty("", "test ()"); Property trans = createProperty("", "()( test"); assertNotNull(getFixture().review(null, templ, trans)); }
@Test public void testReview5() { Property templ = createProperty("", "test ()"); Property trans = createProperty("", "() test"); assertNull(getFixture().review(null, templ, trans)); }
@Test public void testReview6() { Property templ = createProperty("", "test (\")"); Property trans = createProperty("", "(\") test"); assertNull(getFixture().review(null, templ, trans)); }
@Test public void testReview7() { Property templ = createProperty("", "test '}{[]()\""); Property trans = createProperty("", "'}{[])(\" test"); assertNull(getFixture().review(null, templ, trans)); }