Search in sources :

Example 71 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationSubjectComparatorTest method compareAnnotationsCannotFindSubjectAnnot.

@Test(expected = NextProtException.class)
public void compareAnnotationsCannotFindSubjectAnnot() throws Exception {
    ByAnnotationSubjectComparator comparator = new ByAnnotationSubjectComparator(new HashMap<>());
    Annotation a1 = new Annotation();
    a1.setSubjectComponents(Collections.singletonList("hash1"));
    Annotation a2 = new Annotation();
    a2.setSubjectComponents(Collections.singletonList("hash2"));
    int cmp = comparator.compare(a1, a2);
    Assert.assertEquals(0, cmp);
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 72 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationSubjectComparatorTest method mockAnnotation.

public static Annotation mockAnnotation(AnnotationCategory annotationCategory, String annotationHash) {
    Annotation annotation = Mockito.mock(Annotation.class);
    when(annotation.getAPICategory()).thenReturn(annotationCategory);
    when(annotation.getAnnotationHash()).thenReturn(annotationHash);
    return annotation;
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Example 73 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationSubjectComparatorTest method compareAnnotationsUndefinedSubjectComponents.

@Test
public void compareAnnotationsUndefinedSubjectComponents() throws Exception {
    ByAnnotationSubjectComparator comparator = new ByAnnotationSubjectComparator(new HashMap<>());
    Annotation a1 = new Annotation();
    Annotation a2 = new Annotation();
    int cmp = comparator.compare(a1, a2);
    Assert.assertEquals(0, cmp);
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 74 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class ByAnnotationSubjectComparatorTest method compareAnnotations.

@Test
public void compareAnnotations() throws Exception {
    ByAnnotationSubjectComparator comparator = new ByAnnotationSubjectComparator(newHashMap(mockAnnotation(AnnotationCategory.VARIANT, "hash1"), mockAnnotation(AnnotationCategory.MUTAGENESIS, "hash2")), mockHashableComparator(0));
    Annotation a1 = new Annotation();
    a1.setSubjectComponents(Collections.singletonList("hash1"));
    Annotation a2 = new Annotation();
    a2.setSubjectComponents(Collections.singletonList("hash2"));
    int cmp = comparator.compare(a1, a2);
    Assert.assertEquals(0, cmp);
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 75 with Annotation

use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.

the class AnnotationClusterTest method mockAnnotation.

private static Annotation mockAnnotation(AnnotationCategory cat) {
    Annotation annotation = Mockito.mock(Annotation.class);
    when(annotation.getAPICategory()).thenReturn(cat);
    return annotation;
}
Also used : Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Aggregations

Annotation (org.nextprot.api.core.domain.annotation.Annotation)120 Test (org.junit.Test)79 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)32 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)28 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)22 ArrayList (java.util.ArrayList)19 Isoform (org.nextprot.api.core.domain.Isoform)17 Entry (org.nextprot.api.core.domain.Entry)9 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)7 BioObject (org.nextprot.api.core.domain.BioObject)7 PepXIsoformMatch (org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch)7 AnnotationProperty (org.nextprot.api.core.domain.annotation.AnnotationProperty)6 AnnotationSimilarityPredicate (org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate)6 Collectors (java.util.stream.Collectors)5 NextProtException (org.nextprot.api.commons.exception.NextProtException)5 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)5 Assert (org.junit.Assert)4 CvTerm (org.nextprot.api.core.domain.CvTerm)4 Autowired (org.springframework.beans.factory.annotation.Autowired)4 java.util (java.util)3