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
pull/17383/head
Éamonn McManus 5 months ago committed by Copybara-Service
parent 55a5f0c4db
commit 7f798cd8b9
  1. 14
      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) {

Loading…
Cancel
Save