DATAMONGO-2055 - Polishing.
Move test to UpdateMapperUnitTests. Original pull request: #600.
This commit is contained in:
@@ -289,6 +289,20 @@ public class UpdateMapperUnitTests {
|
||||
assertThat(getAsDBObject(push, "key").containsField("$each"), is(true));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-943, DATAMONGO-2055
|
||||
public void updatePushEachAtNegativePositionWorksCorrectly() {
|
||||
|
||||
Update update = new Update().push("key").atPosition(-2).each(Arrays.asList("Arya", "Arry", "Weasel"));
|
||||
|
||||
DBObject mappedObject = mapper.getMappedObject(update.getUpdateObject(), context.getPersistentEntity(Object.class));
|
||||
|
||||
DBObject push = getAsDBObject(mappedObject, "$push");
|
||||
DBObject key = getAsDBObject(push, "key");
|
||||
|
||||
assertThat(key.containsField("$position"), is(true));
|
||||
assertThat((Integer) key.get("$position"), is(-2));
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-943
|
||||
public void updatePushEachAtPositionWorksCorrectlyWhenGivenPositionFirst() {
|
||||
|
||||
|
||||
@@ -399,13 +399,6 @@ public class UpdateTests {
|
||||
equalTo(new BasicDBObjectBuilder().add("$bit", new BasicDBObject("key", new BasicDBObject("xor", 10L))).get()));
|
||||
}
|
||||
|
||||
@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