diff --git a/src/mongo/s/field_parser_test.cpp b/src/mongo/s/field_parser_test.cpp index 29370fca6dbeb..45b3fcb34c12a 100644 --- a/src/mongo/s/field_parser_test.cpp +++ b/src/mongo/s/field_parser_test.cpp @@ -88,7 +88,7 @@ namespace { BSONField ExtractionFixture::aLong("aLong"); TEST_F(ExtractionFixture, GetBool) { - BSONField notThere("otherBool"); + BSONField notThere("otherBool", true); BSONField wrongType(anObj.name()); bool val; ASSERT_TRUE(FieldParser::extract(doc, aBool, false, &val)); @@ -99,7 +99,7 @@ namespace { } TEST_F(ExtractionFixture, GetBSONArray) { - BSONField notThere("otherArray"); + BSONField notThere("otherArray", BSON_ARRAY("a" << "b")); BSONField wrongType(aString.name()); BSONArray val; ASSERT_TRUE(FieldParser::extract(doc, anArray, BSONArray(), &val)); @@ -110,7 +110,7 @@ namespace { } TEST_F(ExtractionFixture, GetBSONObj) { - BSONField notThere("otherObj"); + BSONField notThere("otherObj", BSON("b" << 1)); BSONField wrongType(aString.name()); BSONObj val; ASSERT_TRUE(FieldParser::extract(doc, anObj, BSONObj(), &val)); @@ -121,7 +121,7 @@ namespace { } TEST_F(ExtractionFixture, GetDate) { - BSONField notThere("otherDate"); + BSONField notThere("otherDate", 99ULL); BSONField wrongType(aString.name()); Date_t val; ASSERT_TRUE(FieldParser::extract(doc, aDate, time(0), &val)); @@ -132,7 +132,7 @@ namespace { } TEST_F(ExtractionFixture, GetString) { - BSONField notThere("otherString"); + BSONField notThere("otherString", "abc"); BSONField wrongType(aBool.name()); string val; ASSERT_TRUE(FieldParser::extract(doc, aString, "", &val)); @@ -143,9 +143,9 @@ namespace { } TEST_F(ExtractionFixture, GetOID) { - BSONField notThere("otherOID"); - BSONField wrongType(aString.name()); OID defOID = OID::gen(); + BSONField notThere("otherOID", defOID); + BSONField wrongType(aString.name()); OID val; ASSERT_TRUE(FieldParser::extract(doc, anOID, OID(), &val)); ASSERT_EQUALS(val, valOID); @@ -155,7 +155,7 @@ namespace { } TEST_F(ExtractionFixture, GetLong) { - BSONField notThere("otherLong"); + BSONField notThere("otherLong", 0); BSONField wrongType(aString.name()); long long val; ASSERT_TRUE(FieldParser::extract(doc, aLong, 0, &val));