use of org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldBeSimilar.
@Test
public void shouldBeSimilar() throws Exception {
AnnotationSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Assert.assertTrue(predicate.isSimilar(mockAnnotation(AnnotationCategory.VARIANT), mockAnnotation(AnnotationCategory.VARIANT)));
}
use of org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method sameObjectShouldBeSimilar.
@Test
public void sameObjectShouldBeSimilar() throws Exception {
AnnotationSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Annotation annot = mockAnnotation(AnnotationCategory.VARIANT);
Assert.assertTrue(predicate.isSimilar(annot, annot));
}
use of org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldBeDifferent.
@Test
public void shouldBeDifferent() throws Exception {
AnnotationSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Assert.assertFalse(predicate.isSimilar(mockAnnotation(AnnotationCategory.VARIANT), mockAnnotation(AnnotationCategory.MUTAGENESIS)));
}
use of org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate in project nextprot-api by calipho-sib.
the class AnnotationSimilarityPredicateChainTest method shouldNotBeSimilarWhenAtLeastOnePredicateFalse.
@Test
public void shouldNotBeSimilarWhenAtLeastOnePredicateFalse() throws Exception {
AnnotationSimilarityPredicate predicate = new SimilarityPredicateChain(Arrays.asList((annotation1, annotation2) -> true, (annotation1, annotation2) -> false, (annotation1, annotation2) -> true));
Assert.assertFalse(predicate.isSimilar(Mockito.mock(Annotation.class), Mockito.mock(Annotation.class)));
}
use of org.nextprot.api.core.service.annotation.merge.AnnotationSimilarityPredicate in project nextprot-api by calipho-sib.
the class AnnotationSimilarityPredicateChainTest method shouldBeSimilarWhenAllPredicateTrue.
@Test
public void shouldBeSimilarWhenAllPredicateTrue() throws Exception {
AnnotationSimilarityPredicate predicate = new SimilarityPredicateChain(Arrays.asList((annotation1, annotation2) -> true, (annotation1, annotation2) -> true, (annotation1, annotation2) -> true));
Assert.assertTrue(predicate.isSimilar(Mockito.mock(Annotation.class), Mockito.mock(Annotation.class)));
}
Aggregations