use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method createPredicate.
private Predicate createPredicate(String predicate12, Direction out, String testOwner) {
Predicate predicate1 = new Predicate(predicate12, out);
predicate1.setOwner(new Type(testOwner));
return predicate1;
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeThrowsExceptionIfPredicateOwnerIsNotSet.
@Test(expected = IllegalArgumentException.class)
public void mergeThrowsExceptionIfPredicateOwnerIsNotSet() throws Exception {
Predicate predicate1 = new Predicate("predicate", Direction.OUT);
Predicate predicate2 = new Predicate("predicate", Direction.OUT);
predicate1.merge(predicate2);
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeSetsOwner.
@Test
public void mergeSetsOwner() throws Exception {
Predicate predicate1 = createPredicate("predicate", Direction.OUT, "testOwner");
predicate1.setHasBeenList(true);
predicate1.setSubjectsWithThisPredicateAsList(2);
Predicate predicate2 = createPredicate("predicate", Direction.OUT, "testOwner");
predicate2.setHasBeenList(false);
predicate2.setSubjectsWithThisPredicateAsList(3);
Predicate mergedPredicate = predicate1.merge(predicate2);
assertThat(mergedPredicate.getOwner().getName(), Matchers.is("testOwner"));
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeCombinesReferencesMap.
@Test
public void mergeCombinesReferencesMap() throws Exception {
final Predicate predicate1 = createPredicate("predicate", Direction.OUT, "testOwner");
Map<String, Long> referenceTypes1 = new HashMap<>();
referenceTypes1.put("Test Reference", 1L);
referenceTypes1.put("Test Reference 2", 1L);
referenceTypes1.put("Test Reference 3", 1L);
predicate1.setReferenceTypes(referenceTypes1);
final Predicate predicate2 = createPredicate("predicate", Direction.OUT, "testOwner");
Map<String, Long> referenceTypes2 = new HashMap<>();
referenceTypes2.put("Test Reference", 1L);
referenceTypes2.put("Test Reference 2", 1L);
predicate2.setReferenceTypes(referenceTypes2);
Predicate mergedPredicate = predicate1.merge(predicate2);
assertThat(mergedPredicate.getReferenceTypes(), IsMapContaining.hasEntry("Test Reference", 2L));
assertThat(mergedPredicate.getReferenceTypes(), IsMapContaining.hasEntry("Test Reference 2", 2L));
assertThat(mergedPredicate.getReferenceTypes(), IsMapContaining.hasEntry("Test Reference 3", 1L));
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeSumsListOccurrences.
@Test
public void mergeSumsListOccurrences() throws Exception {
Predicate predicate1 = createPredicate("predicate", Direction.OUT, "testOwner");
predicate1.setHasBeenList(true);
predicate1.setSubjectsWithThisPredicateAsList(2);
Predicate predicate2 = createPredicate("predicate", Direction.OUT, "testOwner");
predicate2.setHasBeenList(false);
predicate2.setSubjectsWithThisPredicateAsList(3);
Predicate mergedPredicate = predicate1.merge(predicate2);
assertThat(mergedPredicate.getSubjectsWithThisPredicateAsList(), Matchers.is(5L));
}
Aggregations