From 7f798cd8b9b345e2a4f692fa08c4f5edfe18ad38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 9 Jul 2024 08:35:47 -0700 Subject: [PATCH] Simplify a confusing test method in `MapLiteTest`. Looking at the code history, this test used to try two different ways to construct a proto containing map fields, and check that the resulting protos were the same. One of the ways was to obtain mutable `Map` objects for the fields, and modify those. When that possibility was removed from the proto API, the test code that used it was changed to use the other way, map-modifying methods directly on the proto class. But the end result is that the test method here was just doing the same thing twice and checking that it got the same result. PiperOrigin-RevId: 650639933 --- .../test/java/com/google/protobuf/MapLiteTest.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/java/core/src/test/java/com/google/protobuf/MapLiteTest.java b/java/core/src/test/java/com/google/protobuf/MapLiteTest.java index 58f73ec35e..3e55eba20c 100644 --- a/java/core/src/test/java/com/google/protobuf/MapLiteTest.java +++ b/java/core/src/test/java/com/google/protobuf/MapLiteTest.java @@ -51,16 +51,10 @@ public final class MapLiteTest { @Test public void testSetMapValues() { - TestMap.Builder usingMutableMapBuilder = TestMap.newBuilder(); - setMapValues(usingMutableMapBuilder); - TestMap usingMutableMap = usingMutableMapBuilder.build(); - assertMapValuesSet(usingMutableMap); - - TestMap.Builder usingAccessorsBuilder = TestMap.newBuilder(); - setMapValues(usingAccessorsBuilder); - TestMap usingAccessors = usingAccessorsBuilder.build(); - assertMapValuesSet(usingAccessors); - assertThat(usingMutableMap).isEqualTo(usingAccessors); + TestMap.Builder testMapBuilder = TestMap.newBuilder(); + setMapValues(testMapBuilder); + TestMap testMap = testMapBuilder.build(); + assertMapValuesSet(testMap); } private void copyMapValues(TestMap source, TestMap.Builder destination) {