DATAMONGO-2055 - Polishing.
Move test to UpdateMapperUnitTests. Original pull request: #600.
This commit is contained in:
@@ -277,6 +277,20 @@ public class UpdateMapperUnitTests {
|
||||
assertThat(getAsDocument(push, "key")).containsKey("$each");
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-943, DATAMONGO-2055
|
||||
public void updatePushEachAtNegativePositionWorksCorrectly() {
|
||||
|
||||
Update update = new Update().push("key").atPosition(-2).each(Arrays.asList("Arya", "Arry", "Weasel"));
|
||||
|
||||
Document mappedObject = mapper.getMappedObject(update.getUpdateObject(), context.getPersistentEntity(Object.class));
|
||||
|
||||
Document push = getAsDocument(mappedObject, "$push");
|
||||
Document key = getAsDocument(push, "key");
|
||||
|
||||
assertThat(key.containsKey("$position")).isTrue();
|
||||
assertThat(key.get("$position")).isEqualTo(-2);
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-943
|
||||
public void updatePushEachAtPositionWorksCorrectlyWhenGivenPositionFirst() {
|
||||
|
||||
|
||||
@@ -390,13 +390,6 @@ public class UpdateTests {
|
||||
.isEqualTo(new Document().append("$bit", new Document("key", new Document("xor", 10L))));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-943, // DATAMONGO-2055
|
||||
public void pushShouldAllowNegativePosition() {
|
||||
|
||||
assertThat(new Update().push("foo").atPosition(-1).each("booh").toString()).isEqualTo(
|
||||
"{ \"$push\" : { \"foo\" : { \"$java\" : { \"$position\" : { \"$java\" : { \"$position\" : -1} }, \"$each\" : { \"$java\" : { \"$each\" : [ \"booh\"]} } } } } }");
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1346
|
||||
public void registersMultiplePullAllClauses() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user