use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ByIsoformPositionComparatorTest method assertExpectedIds.
private static void assertExpectedIds(List<Annotation> observedAnnots, long... expectedAnnotIds) {
Assert.assertEquals(observedAnnots.size(), expectedAnnotIds.length);
int i = 0;
for (Annotation observedAnnot : observedAnnots) {
Assert.assertEquals(expectedAnnotIds[i++], observedAnnot.getAnnotationId());
}
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationFinderTest method shouldFindOneAnnotIfMultipleMatches.
@Test
public void shouldFindOneAnnotIfMultipleMatches() throws Exception {
AnnotationFinder finder = new AnnotationFinder() {
@Override
protected Optional<AnnotationSimilarityPredicate> newPredicate(Annotation annotation) {
return Optional.of(newApiCatCriteria());
}
};
Annotation annot = new Annotation();
annot.setAnnotationName("joe");
annot.setAnnotationCategory(AnnotationCategory.VARIANT);
Optional<Annotation> optAnnotation = finder.find(mockAnnotation(AnnotationCategory.VARIANT), Arrays.asList(annot, mockAnnotation(AnnotationCategory.VARIANT)));
Assert.assertTrue(optAnnotation.isPresent());
Assert.assertEquals(AnnotationCategory.VARIANT, optAnnotation.get().getAPICategory());
Assert.assertEquals("joe", optAnnotation.get().getAnnotationName());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method mockAnnotation.
public static Annotation mockAnnotation(AnnotationCategory cat) {
Annotation annotation = Mockito.mock(Annotation.class);
when(annotation.getAPICategory()).thenReturn(cat);
return annotation;
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldGetProperAnnotationObject.
@Test
public void shouldGetProperAnnotationObject() throws Exception {
ObjectSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Annotation annot = mockAnnotation(AnnotationCategory.VARIANT);
Assert.assertEquals(AnnotationCategory.VARIANT, predicate.getObject(annot));
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldBeDifferentBasedOnBioObjectEquals.
@Test
public void shouldBeDifferentBasedOnBioObjectEquals() throws Exception {
AnnotationSimilarityPredicate predicateBasedOnBioObjectEquals = new ObjectSimilarityPredicate(Annotation::getBioObject);
Assert.assertFalse(predicateBasedOnBioObjectEquals.isSimilar(mockAnnotationWithBioObject("toto", BioObject.BioType.CHEMICAL), mockAnnotationWithBioObject("toto", BioObject.BioType.GROUP)));
}
Aggregations