summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/set_node_test.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2017-08-10 15:52:33 -0400
committerMathias Stearn <mathias@10gen.com>2017-08-16 16:28:02 -0400
commit347935f7a5d0452146b1a73ad7ef9e249eaf1fb5 (patch)
tree00b322f5adcf3eb9c2624747a6b5b2179e440052 /src/mongo/db/update/set_node_test.cpp
parentcdf7aacb213c99d3ce620761ff46b030bbd7732d (diff)
downloadmongo-347935f7a5d0452146b1a73ad7ef9e249eaf1fb5.tar.gz
SERVER-30580 Eliminate UserException and MsgAssertionException types
All users were converted to just use AssertionException.
Diffstat (limited to 'src/mongo/db/update/set_node_test.cpp')
-rw-r--r--src/mongo/db/update/set_node_test.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/mongo/db/update/set_node_test.cpp b/src/mongo/db/update/set_node_test.cpp
index a7a6f793a10..792b7632c39 100644
--- a/src/mongo/db/update/set_node_test.cpp
+++ b/src/mongo/db/update/set_node_test.cpp
@@ -156,7 +156,7 @@ TEST_F(SetNodeTest, ApplyNonViablePathToCreate) {
setPathTaken("a");
addIndexedPath("a");
ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::PathNotViable,
"Cannot create field 'b' in element {a: 5}");
}
@@ -385,7 +385,7 @@ TEST_F(SetNodeTest, ApplyPathNotViable) {
setPathToCreate("b");
setPathTaken("a");
ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::PathNotViable,
"Cannot create field 'b' in element {a: 1}");
}
@@ -400,7 +400,7 @@ TEST_F(SetNodeTest, ApplyPathNotViableArrray) {
setPathToCreate("b");
setPathTaken("a");
ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::PathNotViable,
"Cannot create field 'b' in element {a: [ { b: 1 } ]}");
}
@@ -560,7 +560,7 @@ TEST_F(SetNodeTest, ApplyNonViablePath) {
setPathToCreate("2.b");
setPathTaken("a");
ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::PathNotViable,
"Cannot create field '2' in element {a: 0}");
}
@@ -789,7 +789,7 @@ TEST_F(SetNodeTest, NonViablePathWithoutRepl) {
setPathToCreate("1.b");
setPathTaken("a");
ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::PathNotViable,
"Cannot create field '1' in element {a: 1}");
}
@@ -973,7 +973,7 @@ TEST_F(SetNodeTest, ApplyCannotCreateDollarPrefixedFieldInsideSetElement) {
setPathTaken("a");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::DollarPrefixedFieldName,
"The dollar ($) prefixed field '$bad' in 'a.$bad' is not valid for storage.");
}
@@ -988,7 +988,7 @@ TEST_F(SetNodeTest, ApplyCannotCreateDollarPrefixedFieldAtStartOfPath) {
setPathToCreate("$bad.a");
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.");
}
@@ -1003,7 +1003,7 @@ TEST_F(SetNodeTest, ApplyCannotCreateDollarPrefixedFieldInMiddleOfPath) {
setPathToCreate("a.$bad.b");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root())),
- UserException,
+ AssertionException,
ErrorCodes::DollarPrefixedFieldName,
"The dollar ($) prefixed field '$bad' in 'a.$bad' is not valid for storage.");
}
@@ -1018,7 +1018,7 @@ TEST_F(SetNodeTest, ApplyCannotCreateDollarPrefixedFieldAtEndOfPath) {
setPathToCreate("a.$bad");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root())),
- UserException,
+ AssertionException,
ErrorCodes::DollarPrefixedFieldName,
"The dollar ($) prefixed field '$bad' in 'a.$bad' is not valid for storage.");
}
@@ -1053,7 +1053,7 @@ TEST_F(SetNodeTest, ApplyCannotOverwriteImmutablePath) {
addImmutablePath("a.b");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root()["a"]["b"])),
- UserException,
+ AssertionException,
ErrorCodes::ImmutableField,
"Updating the path 'a.b' to b: 1 would modify the immutable field 'a.b'");
}
@@ -1088,7 +1088,7 @@ TEST_F(SetNodeTest, ApplyCannotOverwritePrefixToRemoveImmutablePath) {
addImmutablePath("a.b");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::ImmutableField,
"After applying the update, the immutable field 'a.b' was found to have been removed.");
}
@@ -1103,7 +1103,7 @@ TEST_F(SetNodeTest, ApplyCannotOverwritePrefixToModifyImmutablePath) {
setPathTaken("a");
addImmutablePath("a.b");
ASSERT_THROWS_CODE_AND_WHAT(node.apply(getApplyParams(doc.root()["a"])),
- UserException,
+ AssertionException,
ErrorCodes::ImmutableField,
"After applying the update, the immutable field 'a.b' was found to "
"have been altered to b: 1");
@@ -1177,7 +1177,7 @@ TEST_F(SetNodeTest, ApplyCannotOverwriteSuffixOfImmutablePath) {
addImmutablePath("a.b");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root()["a"]["b"]["c"])),
- UserException,
+ AssertionException,
ErrorCodes::ImmutableField,
"Updating the path 'a.b.c' to c: 1 would modify the immutable field 'a.b'");
}
@@ -1213,7 +1213,7 @@ TEST_F(SetNodeTest, ApplyCannotCreateFieldAtEndOfImmutablePath) {
addImmutablePath("a.b");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root()["a"]["b"])),
- UserException,
+ AssertionException,
ErrorCodes::ImmutableField,
"Updating the path 'a.b' to b: { c: 1 } would modify the immutable field 'a.b'");
}
@@ -1230,7 +1230,7 @@ TEST_F(SetNodeTest, ApplyCannotCreateFieldBeyondEndOfImmutablePath) {
addImmutablePath("a");
ASSERT_THROWS_CODE_AND_WHAT(
node.apply(getApplyParams(doc.root()["a"]["b"])),
- UserException,
+ AssertionException,
ErrorCodes::ImmutableField,
"Updating the path 'a.b' to b: { c: 1 } would modify the immutable field 'a'");
}