diff --git a/tests/unit/storage_v3.cpp b/tests/unit/storage_v3.cpp index 3098acbdb..b107786e8 100644 --- a/tests/unit/storage_v3.cpp +++ b/tests/unit/storage_v3.cpp @@ -33,12 +33,6 @@ using testing::UnorderedElementsAre; -namespace { - -class AlreadyInsertedException : public std::exception {}; - -} // namespace - namespace memgraph::storage::v3::tests { class StorageV3 : public ::testing::TestWithParam<bool> { @@ -2656,21 +2650,16 @@ TEST_P(StorageV3, TestCreateVertexAndValidate) { (std::map<PropertyId, PropertyValue>{{prop1, PropertyValue(111)}})); } { - EXPECT_THROW( - { - Shard store(primary_label, min_pk, std::nullopt /*max_primary_key*/, schema_property_vector); - auto acc = store.Access(GetNextHlc()); - auto vertex1 = acc.CreateVertexAndValidate({}, {PropertyValue{0}}, {}); - auto vertex2 = acc.CreateVertexAndValidate({}, {PropertyValue{0}}, {}); + Shard store(primary_label, min_pk, std::nullopt /*max_primary_key*/, schema_property_vector); + auto acc = store.Access(GetNextHlc()); + auto vertex1 = acc.CreateVertexAndValidate({}, {PropertyValue{0}}, {}); + auto vertex2 = acc.CreateVertexAndValidate({}, {PropertyValue{0}}, {}); - if (vertex2.HasError()) { - auto error = vertex2.GetError(); - if (auto error_ptr = std::get_if<memgraph::storage::v3::Error>(&error)) { - if (*error_ptr == storage::v3::Error::VERTEX_ALREADY_INSERTED) throw AlreadyInsertedException(); - } - } - }, - AlreadyInsertedException); + ASSERT_TRUE(vertex2.HasError()); + auto error = vertex2.GetError(); + auto error_ptr = std::get_if<memgraph::storage::v3::Error>(&error); + ASSERT_TRUE(error_ptr); + ASSERT_TRUE(*error_ptr == storage::v3::Error::VERTEX_ALREADY_INSERTED); } { auto acc = store.Access(GetNextHlc());