diff options
Diffstat (limited to 'src/mongo/db/update/rename_node_test.cpp')
-rw-r--r-- | src/mongo/db/update/rename_node_test.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mongo/db/update/rename_node_test.cpp b/src/mongo/db/update/rename_node_test.cpp index a72485b7e23..2267f51de6e 100644 --- a/src/mongo/db/update/rename_node_test.cpp +++ b/src/mongo/db/update/rename_node_test.cpp @@ -248,7 +248,7 @@ TEST_F(RenameNodeTest, MoveIntoArray) { setPathTaken("a"); addIndexedPath("a"); ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])), - UserException, + AssertionException, ErrorCodes::BadValue, "The destination field cannot be an array element, 'a.2' in doc " "with _id: \"test_object\" has an array field called 'a'"); @@ -265,7 +265,7 @@ TEST_F(RenameNodeTest, MoveIntoArrayNoId) { setPathTaken("a"); addIndexedPath("a"); ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])), - UserException, + AssertionException, ErrorCodes::BadValue, "The destination field cannot be an array element, 'a.2' in doc " "with no id has an array field called 'a'"); @@ -281,7 +281,7 @@ TEST_F(RenameNodeTest, MoveToArrayElement) { setPathTaken("a.1"); addIndexedPath("a"); ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"]["1"])), - UserException, + AssertionException, ErrorCodes::BadValue, "The destination field cannot be an array element, 'a.1' in doc " "with _id: \"test_object\" has an array field called 'a'"); @@ -297,7 +297,7 @@ TEST_F(RenameNodeTest, MoveOutOfArray) { setPathToCreate("b"); addIndexedPath("a"); ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::BadValue, "The source field cannot be an array element, 'a.0' in doc with " "_id: \"test_object\" has an array field called 'a'"); @@ -314,7 +314,7 @@ TEST_F(RenameNodeTest, MoveNonexistentEmbeddedFieldOut) { addIndexedPath("a"); ASSERT_THROWS_CODE_AND_WHAT( node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::PathNotViable, "cannot use the part (a of a.a) to traverse the element ({a: [ { a: 1 }, { b: 2 } ]})"); } @@ -329,7 +329,7 @@ TEST_F(RenameNodeTest, MoveEmbeddedFieldOutWithElementNumber) { setPathToCreate("b"); addIndexedPath("a"); ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::BadValue, "The source field cannot be an array element, 'a.0.a' in doc with " "_id: \"test_object\" has an array field called 'a'"); @@ -422,7 +422,7 @@ TEST_F(RenameNodeTest, ApplyCannotRemoveRequiredPartOfDBRef) { mutablebson::Document doc(fromjson("{a: {$ref: 'c', $id: 0}}")); setPathToCreate("b"); ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::InvalidDBRef, "The DBRef $ref field must be followed by a $id field"); } @@ -460,7 +460,7 @@ TEST_F(RenameNodeTest, ApplyCannotRemoveImmutablePath) { addImmutablePath("a.b"); ASSERT_THROWS_CODE_AND_WHAT( node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::ImmutableField, "Unsetting the path 'a.b' using $rename would modify the immutable field 'a.b'"); } @@ -476,7 +476,7 @@ TEST_F(RenameNodeTest, ApplyCannotRemovePrefixOfImmutablePath) { addImmutablePath("a.b"); ASSERT_THROWS_CODE_AND_WHAT( node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::ImmutableField, "Unsetting the path 'a' using $rename would modify the immutable field 'a.b'"); } @@ -492,7 +492,7 @@ TEST_F(RenameNodeTest, ApplyCannotRemoveSuffixOfImmutablePath) { addImmutablePath("a.b"); ASSERT_THROWS_CODE_AND_WHAT( node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::ImmutableField, "Unsetting the path 'a.b.c' using $rename would modify the immutable field 'a.b'"); } @@ -525,7 +525,7 @@ TEST_F(RenameNodeTest, ApplyCannotCreateDollarPrefixedField) { setPathToCreate("$bad"); ASSERT_THROWS_CODE_AND_WHAT( node.apply(getApplyParams(doc.root())), - UserException, + AssertionException, ErrorCodes::DollarPrefixedFieldName, "The dollar ($) prefixed field '$bad' in '$bad' is not valid for storage."); } @@ -541,7 +541,7 @@ TEST_F(RenameNodeTest, ApplyCannotOverwriteImmutablePath) { addImmutablePath("b"); ASSERT_THROWS_CODE_AND_WHAT( node.apply(getApplyParams(doc.root()["b"])), - UserException, + AssertionException, ErrorCodes::ImmutableField, "Updating the path 'b' to b: 0 would modify the immutable field 'b'"); } |