use of nl.knaw.huygens.timbuctoo.v5.graphql.mutations.dto.EditMutationChangeLog in project timbuctoo by HuygensING.
the class EditMutationChangeLogTest method getDeletionsForListIgnoresReplacementsWithValue.
@Test
public void getDeletionsForListIgnoresReplacementsWithValue() throws Exception {
String addedValue = "newValue";
Map<Object, Object> replacements = Maps.newHashMap();
replacements.put(NAMES_FIELD, newArrayList(createPropertyInput(addedValue)));
Map<Object, Object> entity = Maps.newHashMap();
entity.put("replacements", replacements);
EditMutationChangeLog instance = new EditMutationChangeLog(new Graph(GRAPH), SUBJECT, entity);
valuesInQuadStore(NAMES_PRED, addedValue);
Stream<Change> deletes = instance.getDeletions(dataSet);
assertThat(deletes, StreamMatchers.empty());
}
use of nl.knaw.huygens.timbuctoo.v5.graphql.mutations.dto.EditMutationChangeLog in project timbuctoo by HuygensING.
the class EditMutationChangeLogTest method getReplacementsForSingleValueReturnsReplacementsWithOldValues.
@Test
public void getReplacementsForSingleValueReturnsReplacementsWithOldValues() throws Exception {
String addedValue1 = "newValue1";
String oldValue = "oldValue";
Map<Object, Object> replacements = Maps.newHashMap();
replacements.put(NAMES_FIELD, createPropertyInput(addedValue1));
Map<Object, Object> entity = Maps.newHashMap();
entity.put("replacements", replacements);
EditMutationChangeLog instance = new EditMutationChangeLog(new Graph(GRAPH), SUBJECT, entity);
valuesInQuadStore(NAMES_PRED, oldValue);
List<Change> reps = instance.getReplacements(dataSet).collect(toList());
assertThat(reps.size(), is(1));
assertThat(reps, contains(likeChange().withValues(new Value(addedValue1, STRING)).withOldValues(new Value(oldValue, STRING))));
}
Aggregations