Skip to content

Commit

Permalink
Add test showing that not all the messages inside a Lite FieldSet wer…
Browse files Browse the repository at this point in the history
…e made immutable.

I will fix this test in the next CL.

This test runs on both `GeneratedMessage` and `GeneratedMessageLite` variants, so we need to first check if `nested instanceof GeneratedMessageLite`, otherwise on the full-variant test, we get `isMutable()` method found on `GeneratedMessage`.

PiperOrigin-RevId: 671563318
  • Loading branch information
mhansen authored and copybara-github committed Sep 6, 2024
1 parent eacaa2b commit 3d4d514
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions java/core/src/test/java/com/google/protobuf/ParserLiteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ public void testParseExtensionsLite() throws Exception {
TestUtilLite.getAllLiteExtensionsSet(), TestUtilLite.getExtensionRegistryLite());
}

@Test
public void testParseExtensionsLite_extensionIsMutable() throws Exception {
TestAllExtensionsLite message =
TestAllExtensionsLite.parseFrom(
TestUtilLite.getAllLiteExtensionsSet().toByteArray(),
TestUtilLite.getExtensionRegistryLite());
Object nested = message.getExtension(UnittestLite.optionalNestedMessageExtensionLite);
if (nested instanceof GeneratedMessageLite) {
// TODO: Make this false.
assertThat(((GeneratedMessageLite) nested).isMutable()).isTrue();
}
}

@Test
public void testParsePacked() throws Exception {
assertRoundTripEquals(TestUtil.getPackedSet());
Expand Down

0 comments on commit 3d4d514

Please sign in to comment.