use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldBeSimilarBasedOnBioObjectAccessionEquals.
@Test
public void shouldBeSimilarBasedOnBioObjectAccessionEquals() throws Exception {
AnnotationSimilarityPredicate predicateBasedOnBioObjectAccessionEquals = new ObjectSimilarityPredicate(Annotation::getBioObject, (o1, o2) -> Objects.equals(((BioObject) o1).getAccession(), ((BioObject) o2).getAccession()));
Assert.assertTrue(predicateBasedOnBioObjectAccessionEquals.isSimilar(mockAnnotationWithBioObject("toto", BioObject.BioType.CHEMICAL), mockAnnotationWithBioObject("toto", BioObject.BioType.GROUP)));
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method mockAnnotationWithBioObject.
public static Annotation mockAnnotationWithBioObject(String accession, BioObject.BioType type) {
Annotation annotation = Mockito.mock(Annotation.class);
BioObject bioObject = Mockito.mock(BioObject.class);
when(bioObject.getAccession()).thenReturn(accession);
when(bioObject.getBioType()).thenReturn(type);
when(annotation.getBioObject()).thenReturn(bioObject);
return annotation;
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationSimilarityPredicateTest method mockAnnotation.
private static Annotation mockAnnotation(String accession, String database) {
Annotation annot = Mockito.mock(Annotation.class);
BioObject bo = Mockito.mock(BioObject.class);
Mockito.when(bo.getAccession()).thenReturn(accession);
Mockito.when(bo.getDatabase()).thenReturn(database);
Mockito.when(annot.getBioObject()).thenReturn(bo);
return annot;
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationTest method testTwoNegative.
@Test
public void testTwoNegative() {
Annotation a = new Annotation();
List<AnnotationEvidence> evidences = new ArrayList<>();
evidences.add(buildEvidence("negative"));
evidences.add(buildEvidence("negative"));
a.setEvidences(evidences);
Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
Assert.assertTrue(!a.isExpressionLevelDetected().get());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationTest method testOneNegative.
@Test
public void testOneNegative() {
Annotation a = new Annotation();
List<AnnotationEvidence> evidences = new ArrayList<>();
evidences.add(buildEvidence("negative"));
a.setEvidences(evidences);
Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
Assert.assertTrue(!a.isExpressionLevelDetected().get());
}
Aggregations