use of org.nextprot.api.core.domain.annotation.AnnotationProperty in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method assertContainsExpectedProperties.
public static void assertContainsExpectedProperties(Collection<AnnotationProperty> properties, AnnotationProperty... expectedProperties) {
for (AnnotationProperty property : expectedProperties) {
System.out.println("expectedProperty:" + property.getName() + "found:" + properties.contains(property));
Assert.assertTrue(properties.contains(property));
}
}
use of org.nextprot.api.core.domain.annotation.AnnotationProperty in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldFilterByPropertyTopologyValue.
@Test
public void shouldFilterByPropertyTopologyValue() {
List<Annotation> annotations = entryBuilderService.build(EntryConfig.newConfig("NX_P04083").with("subcellular-location")).getAnnotations();
List<Annotation> filtered = annotations.stream().filter(annotationService.buildPropertyPredicate("topology", "Peripheral membrane protein")).collect(Collectors.toList());
for (Annotation annot : filtered) {
for (AnnotationProperty property : annot.getPropertiesByKey("topology")) {
Assert.assertEquals("Peripheral membrane protein", property.getValue());
}
}
}
use of org.nextprot.api.core.domain.annotation.AnnotationProperty in project nextprot-api by calipho-sib.
the class AnnotationUtilsTest method shouldFilterByPropertyTopologyAccession.
@Test
public void shouldFilterByPropertyTopologyAccession() {
List<Annotation> annotations = entryBuilderService.build(EntryConfig.newConfig("NX_P04083").with("subcellular-location")).getAnnotations();
List<Annotation> filtered = annotations.stream().filter(annotationService.buildPropertyPredicate("topology", "SL-9903")).collect(Collectors.toList());
Assert.assertTrue(!filtered.isEmpty());
for (Annotation annot : filtered) {
for (AnnotationProperty property : annot.getPropertiesByKey("topology")) {
Assert.assertEquals("Peripheral membrane protein", property.getValue());
}
}
}
use of org.nextprot.api.core.domain.annotation.AnnotationProperty in project nextprot-api by calipho-sib.
the class AnnotationPropertyComparatorTest method mockAnnotationProperty.
private AnnotationProperty mockAnnotationProperty(String name, String value) {
AnnotationProperty prop = Mockito.mock(AnnotationProperty.class);
when(prop.getName()).thenReturn(name);
when(prop.getValue()).thenReturn(value);
return prop;
}
use of org.nextprot.api.core.domain.annotation.AnnotationProperty in project nextprot-api by calipho-sib.
the class AnnotationPropertyComparatorTest method testCompareThenByValueInLexicographicContext.
@Test
public void testCompareThenByValueInLexicographicContext() throws Exception {
AnnotationPropertyComparator comparator = new AnnotationPropertyComparator();
AnnotationProperty prop1 = mockAnnotationProperty("position", "853");
AnnotationProperty prop2 = mockAnnotationProperty("position", "bart");
Assert.assertTrue(comparator.compare(prop1, prop2) < 0);
}
Aggregations