@@ -0,0 +1,3565 @@
+package test.java.org.wikidata.analyzer.Processor;%0A%0Aimport junit.framework.TestCase;%0Aimport main.java.org.wikidata.analyzer.Processor.MonolingualTextProcessor;%0Aimport org.wikidata.wdtk.datamodel.helpers.*;%0Aimport org.wikidata.wdtk.datamodel.implementation.ItemIdValueImpl;%0Aimport org.wikidata.wdtk.datamodel.implementation.PropertyIdValueImpl;%0Aimport org.wikidata.wdtk.datamodel.interfaces.ItemDocument;%0Aimport org.wikidata.wdtk.datamodel.interfaces.ItemIdValue;%0Aimport org.wikidata.wdtk.datamodel.interfaces.PropertyDocument;%0Aimport org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/**%0A * @author Addshore%0A */%0Apublic class MonolingualTextProcessorTest extends TestCase %7B%0A%0A    private void assertCounter( Map%3CString, Long%3E counters, String counter, int expected ) %7B%0A        assertTrue( %22Assert counter name exists '%22 + counter + %22'%22, counters.containsKey( counter ) );%0A        assertEquals( %22Assert counter '%22 + counter + %22'value correct%22, (long)expected, (long)counters.get( counter ) );%0A    %7D%0A%0A    public void testProcessItemDocument() throws Exception %7B%0A        Map%3CString, Long%3E counters = new HashMap%3C%3E();%0A        MonolingualTextProcessor processor = new MonolingualTextProcessor(counters);%0A%0A        ItemIdValue itemId = ItemIdValueImpl.create(%22Q42%22, %22foo%22);%0A        ItemDocument itemDocument = ItemDocumentBuilder.forItemId(itemId)%0A                .withStatement(%0A                        StatementBuilder%0A                                .forSubjectAndProperty(itemId, PropertyIdValueImpl.create(%22P1%22, %22bar%22))%0A                                .withValue(Datamodel.makeMonolingualTextValue(%22text%22, %22en%22))%0A                                .withQualifier(Datamodel.makeValueSnak(PropertyIdValueImpl.create(%22P1%22, %22bar%22), Datamodel.makeMonolingualTextValue(%22text%22, %22de%22)))%0A                                .withQualifier(Datamodel.makeValueSnak(PropertyIdValueImpl.create(%22P1%22, %22bar%22), Datamodel.makeMonolingualTextValue(%22text%22, %22fr%22)))%0A                                .withReference(ReferenceBuilder.newInstance().withPropertyValue(%0A                                        PropertyIdValueImpl.create(%22P2%22, %22Foo%22),%0A                                        Datamodel.makeMonolingualTextValue(%22text%22, %22fr%22)%0A                                ).build())%0A                                .withReference(ReferenceBuilder.newInstance().withPropertyValue(%0A                                        PropertyIdValueImpl.create(%22P2%22, %22Foo%22),%0A                                        Datamodel.makeMonolingualTextValue(%22text%22, %22pt%22)%0A                                ).build())%0A                                .build()%0A                )%0A                .build();%0A%0A        PropertyIdValue propertyId = PropertyIdValueImpl.create(%22P42%22, %22foo%22);%0A        PropertyDocument propertyDocument = PropertyDocumentBuilder.forPropertyIdAndDatatype(propertyId, %22foo%22)%0A                .withStatement(%0A                        StatementBuilder%0A                                .forSubjectAndProperty(propertyId, PropertyIdValueImpl.create(%22P1%22, %22bar%22))%0A                                .withValue(Datamodel.makeMonolingualTextValue(%22text%22, %22pt%22))%0A                                .build()%0A                )%0A                .build();%0A%0A        processor.processItemDocument( itemDocument );%0A        processor.processPropertyDocument( propertyDocument );%0A%0A        this.assertCounter(counters, %22en%22, 1);%0A        this.assertCounter(counters, %22de%22, 1);%0A        this.assertCounter(counters, %22fr%22, 2 );%0A        this.assertCounter(counters, %22pt%22, 2 );%0A    %7D%0A%0A%7D

Add MonolingualTextProcessorTest