Remove usage of CHECK_NOTNULL

We want to switch to absl logging instead of glog.  gtest and ceres are
going there, and we already have absl as a dependency.  ABSL doesn't
have CHECK_NOTNULL, and we can move things over in an easier to review
fashion.

Change-Id: Ifd9a11ec34a2357cec43f88dba015db9c28ed2cf
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/aos/flatbuffers/static_flatbuffers_test.cc b/aos/flatbuffers/static_flatbuffers_test.cc
index 4a8b9e9..187c72a 100644
--- a/aos/flatbuffers/static_flatbuffers_test.cc
+++ b/aos/flatbuffers/static_flatbuffers_test.cc
@@ -123,7 +123,8 @@
   }
   {
     auto vector_of_strings = object->add_vector_of_strings();
-    auto sub_string = CHECK_NOTNULL(vector_of_strings->emplace_back());
+    auto sub_string = vector_of_strings->emplace_back();
+    CHECK(sub_string != nullptr);
     CHECK(sub_string->emplace_back('D'));
   }
   { object->set_substruct({971, 254}); }
@@ -163,8 +164,13 @@
   builder.add_foo(1234);
   return builder.Finish();
 }
-void PopulateStatic(SubTableStatic *subtable) { subtable->set_foo(1234); }
+void PopulateStatic(SubTableStatic *subtable) {
+  CHECK(subtable != nullptr);
+  subtable->set_foo(1234);
+}
+
 }  // namespace
+
 TEST_F(StaticFlatbuffersTest, PopulateMethodConversionExample) {
   // Using a FlatBufferBuilder:
   flatbuffers::FlatBufferBuilder fbb;
@@ -178,7 +184,7 @@
   // Using the static flatbuffer API.
   aos::fbs::AlignedVectorAllocator allocator;
   Builder<TestTableStatic> static_builder(&allocator);
-  PopulateStatic(CHECK_NOTNULL(static_builder.get()->add_subtable()));
+  PopulateStatic(static_builder.get()->add_subtable());
 
   // And confirm that they both contain the expected flatbuffer:
   const std::string expected = R"json({ "subtable": { "foo": 1234 } })json";
@@ -292,7 +298,8 @@
       EXPECT_FALSE(object->has_vector_of_strings());
       auto vector_of_strings = object->add_vector_of_strings();
       EXPECT_TRUE(object->has_vector_of_strings());
-      auto sub_string = CHECK_NOTNULL(vector_of_strings->emplace_back());
+      auto sub_string = vector_of_strings->emplace_back();
+      CHECK(sub_string != nullptr);
       ASSERT_TRUE(sub_string->emplace_back('D'));
       EXPECT_TRUE(fbs.has_vector_of_strings());
       ASSERT_EQ(1u, fbs.vector_of_strings()->size());
@@ -729,7 +736,8 @@
     ASSERT_TRUE(builder.Verify());
     ASSERT_FALSE(object->has_vector_of_scalars())
         << aos::FlatbufferToJson(builder.AsFlatbufferSpan());
-    vector = CHECK_NOTNULL(object->add_vector_of_scalars());
+    vector = object->add_vector_of_scalars();
+    ASSERT_TRUE(vector != nullptr);
     ASSERT_TRUE(builder.Verify());
     EXPECT_EQ(0u, object->AsFlatbuffer().vector_of_scalars()->size());
     ASSERT_TRUE(vector->emplace_back(9));
@@ -783,7 +791,8 @@
     object->clear_subtable();
     ASSERT_TRUE(builder.Verify());
     EXPECT_FALSE(object->has_subtable());
-    auto subtable = CHECK_NOTNULL(object->add_subtable());
+    auto subtable = object->add_subtable();
+    ASSERT_TRUE(subtable != nullptr);
     subtable->set_baz(9.71);
     EXPECT_EQ(
         R"json({
@@ -806,7 +815,8 @@
     object->clear_subtable();
     ASSERT_TRUE(builder.Verify());
     EXPECT_FALSE(object->has_subtable());
-    subtable = CHECK_NOTNULL(object->add_subtable());
+    subtable = object->add_subtable();
+    ASSERT_TRUE(subtable != nullptr);
     subtable->set_baz(16.78);
     EXPECT_EQ(
         R"json({
@@ -883,7 +893,8 @@
   }
   {
     auto vector_of_strings = object->add_vector_of_strings();
-    auto sub_string = CHECK_NOTNULL(vector_of_strings->emplace_back());
+    auto sub_string = vector_of_strings->emplace_back();
+    ASSERT_TRUE(sub_string != nullptr);
     ASSERT_TRUE(sub_string->emplace_back('D'));
   }
   { object->set_substruct({971, 254}); }
@@ -1048,7 +1059,8 @@
   }
   {
     auto vector_of_strings = object->add_vector_of_strings();
-    auto sub_string = CHECK_NOTNULL(vector_of_strings->emplace_back());
+    auto sub_string = vector_of_strings->emplace_back();
+    ASSERT_TRUE(sub_string != nullptr);
     ASSERT_TRUE(sub_string->emplace_back('D'));
   }
   { object->set_substruct({971, 254}); }
@@ -1153,7 +1165,8 @@
   }
   {
     auto vector_of_strings = object->add_vector_of_strings();
-    auto sub_string = CHECK_NOTNULL(vector_of_strings->emplace_back());
+    auto sub_string = vector_of_strings->emplace_back();
+    ASSERT_TRUE(sub_string != nullptr);
     ASSERT_TRUE(sub_string->emplace_back('D'));
   }
   { object->set_substruct({971, 254}); }