Search in sources :

Example 1 with AnnotationProperty

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));
    }
}
Also used : AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty)

Example 2 with AnnotationProperty

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());
        }
    }
}
Also used : AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty) Annotation(org.nextprot.api.core.domain.annotation.Annotation) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 3 with AnnotationProperty

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());
        }
    }
}
Also used : AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty) Annotation(org.nextprot.api.core.domain.annotation.Annotation) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 4 with AnnotationProperty

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;
}
Also used : AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty)

Example 5 with AnnotationProperty

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);
}
Also used : AnnotationProperty(org.nextprot.api.core.domain.annotation.AnnotationProperty) Test(org.junit.Test)

Aggregations

AnnotationProperty (org.nextprot.api.core.domain.annotation.AnnotationProperty)14 Test (org.junit.Test)7 Annotation (org.nextprot.api.core.domain.annotation.Annotation)4 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)2 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)2 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)1 Family (org.nextprot.api.core.domain.Family)1