Classes | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
com.google.protobuf.test.TestUtil Class Reference

Classes

class  HackMessage
 
class  MockBuilderParent
 
class  ReflectionTester
 

Static Public Member Functions

static void assertAllExtensionsSet (TestAllExtensionsOrBuilder message)
 
static void assertAllFieldsSet (TestAllTypesOrBuilder message)
 
static void assertClear (TestAllTypesOrBuilder message)
 
static void assertExtensionsClear (TestAllExtensionsOrBuilder message)
 
static void assertPackedExtensionsSet (TestPackedExtensions message)
 
static void assertPackedFieldsSet (TestPackedTypes message)
 
static void assertRepeatedExtensionsModified (TestAllExtensionsOrBuilder message)
 
static void assertRepeatedFieldsModified (TestAllTypesOrBuilder message)
 
static void assertUnpackedFieldsSet (TestUnpackedTypes message)
 
static TestAllExtensions getAllExtensionsSet ()
 
static TestAllTypes getAllSet ()
 
static TestAllTypes.Builder getAllSetBuilder ()
 
static ExtensionRegistry getExtensionRegistry ()
 
static ByteString getGoldenMessage ()
 
static ByteString getGoldenPackedFieldsMessage ()
 
static TestPackedExtensions getPackedExtensionsSet ()
 
static TestPackedTypes getPackedSet ()
 
static TestUnpackedTypes getUnpackedSet ()
 
static void modifyRepeatedExtensions (TestAllExtensions.Builder message)
 
static void modifyRepeatedFields (TestAllTypes.Builder message)
 
static ByteString readBytesFromFile (String filename)
 
static String readTextFromFile (String filePath)
 
static void registerAllExtensions (ExtensionRegistry registry)
 
static void setAllExtensions (TestAllExtensions.Builder message)
 
static void setAllFields (TestAllTypes.Builder message)
 
static void setPackedExtensions (TestPackedExtensions.Builder message)
 
static void setPackedFields (TestPackedTypes.Builder message)
 
static void setUnpackedFields (TestUnpackedTypes.Builder message)
 

Private Member Functions

 TestUtil ()
 

Static Private Member Functions

static void assertEqualsExactType (boolean a, boolean b)
 
static void assertEqualsExactType (ByteString a, ByteString b)
 
static void assertEqualsExactType (double a, double b)
 
static void assertEqualsExactType (float a, float b)
 
static void assertEqualsExactType (ForeignEnum a, ForeignEnum b)
 
static void assertEqualsExactType (ImportEnum a, ImportEnum b)
 
static void assertEqualsExactType (int a, int b)
 
static void assertEqualsExactType (long a, long b)
 
static void assertEqualsExactType (String a, String b)
 
static void assertEqualsExactType (TestAllTypes.NestedEnum a, TestAllTypes.NestedEnum b)
 
static File getTestDataDir ()
 

Static Private Attributes

static ByteString goldenMessage = null
 
static ByteString goldenPackedFieldsMessage = null
 

Detailed Description

Contains methods for setting all fields of

TestAllTypes

to some values as well as checking that all the fields are set to those values. These are useful for testing various protocol message features, e.g. set all fields of a message, serialize it, parse it, and check that all fields are set.

This code is not to be used outside of

and subpackages.

Author
kento.nosp@m.n@go.nosp@m.ogle..nosp@m.com Kenton Varda

Definition at line 162 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

Constructor & Destructor Documentation

◆ TestUtil()

com.google.protobuf.test.TestUtil.TestUtil ( )
inlineprivate

Member Function Documentation

◆ assertAllExtensionsSet()

static void com.google.protobuf.test.TestUtil.assertAllExtensionsSet ( TestAllExtensionsOrBuilder  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all extensions of

are set to the values assigned by

.

Definition at line 1276 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertAllFieldsSet()

static void com.google.protobuf.test.TestUtil.assertAllFieldsSet ( TestAllTypesOrBuilder  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all fields of

are set to the values assigned by

.

Definition at line 408 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertClear()

static void com.google.protobuf.test.TestUtil.assertClear ( TestAllTypesOrBuilder  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all fields of

are cleared, and that getting the fields returns their default values.

Definition at line 615 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertEqualsExactType() [1/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( boolean  a,
boolean  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [2/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( ByteString  a,
ByteString  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [3/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( double  a,
double  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [4/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( float  a,
float  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [5/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( ForeignEnum  a,
ForeignEnum  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [6/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( ImportEnum  a,
ImportEnum  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [7/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( int  a,
int  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [8/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( long  a,
long  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [9/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( String  a,
String  b 
)
inlinestaticprivate

◆ assertEqualsExactType() [10/10]

static void com.google.protobuf.test.TestUtil.assertEqualsExactType ( TestAllTypes.NestedEnum  a,
TestAllTypes.NestedEnum  b 
)
inlinestaticprivate

◆ assertExtensionsClear()

static void com.google.protobuf.test.TestUtil.assertExtensionsClear ( TestAllExtensionsOrBuilder  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all extensions of

are cleared, and that getting the extensions returns their default values.

Definition at line 1497 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertPackedExtensionsSet()

static void com.google.protobuf.test.TestUtil.assertPackedExtensionsSet ( TestPackedExtensions  message)
inlinestatic

◆ assertPackedFieldsSet()

static void com.google.protobuf.test.TestUtil.assertPackedFieldsSet ( TestPackedTypes  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all fields of

are set to the values assigned by

.

Definition at line 938 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertRepeatedExtensionsModified()

static void com.google.protobuf.test.TestUtil.assertRepeatedExtensionsModified ( TestAllExtensionsOrBuilder  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all extensions of

are set to the values assigned by

followed by

.

Definition at line 1683 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertRepeatedFieldsModified()

static void com.google.protobuf.test.TestUtil.assertRepeatedFieldsModified ( TestAllTypesOrBuilder  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all fields of

are set to the values assigned by

followed by

.

Definition at line 770 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ assertUnpackedFieldsSet()

static void com.google.protobuf.test.TestUtil.assertUnpackedFieldsSet ( TestUnpackedTypes  message)
inlinestatic

Assert (using

junit.framework.Assert

} that all fields of

are set to the values assigned by

.

Definition at line 987 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ getAllExtensionsSet()

static TestAllExtensions com.google.protobuf.test.TestUtil.getAllExtensionsSet ( )
inlinestatic

◆ getAllSet()

static TestAllTypes com.google.protobuf.test.TestUtil.getAllSet ( )
inlinestatic

◆ getAllSetBuilder()

static TestAllTypes.Builder com.google.protobuf.test.TestUtil.getAllSetBuilder ( )
inlinestatic

◆ getExtensionRegistry()

static ExtensionRegistry com.google.protobuf.test.TestUtil.getExtensionRegistry ( )
inlinestatic

Get an unmodifiable ExtensionRegistry containing all the extensions of

TestAllExtensions

.

Definition at line 1073 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ getGoldenMessage()

static ByteString com.google.protobuf.test.TestUtil.getGoldenMessage ( )
inlinestatic

Get the bytes of the "golden message". This is a serialized TestAllTypes with all fields set as they would be by setAllFields(TestAllTypes.Builder), but it is loaded from a file on disk rather than generated dynamically. The file is actually generated by C++ code, so testing against it verifies compatibility with C++.

Definition at line 3020 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ getGoldenPackedFieldsMessage()

static ByteString com.google.protobuf.test.TestUtil.getGoldenPackedFieldsMessage ( )
inlinestatic

Get the bytes of the "golden packed fields message". This is a serialized TestPackedTypes with all fields set as they would be by setPackedFields(TestPackedTypes.Builder), but it is loaded from a file on disk rather than generated dynamically. The file is actually generated by C++ code, so testing against it verifies compatibility with C++.

Definition at line 3036 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ getPackedExtensionsSet()

static TestPackedExtensions com.google.protobuf.test.TestUtil.getPackedExtensionsSet ( )
inlinestatic

◆ getPackedSet()

static TestPackedTypes com.google.protobuf.test.TestUtil.getPackedSet ( )
inlinestatic

◆ getTestDataDir()

static File com.google.protobuf.test.TestUtil.getTestDataDir ( )
inlinestaticprivate

◆ getUnpackedSet()

static TestUnpackedTypes com.google.protobuf.test.TestUtil.getUnpackedSet ( )
inlinestatic

◆ modifyRepeatedExtensions()

static void com.google.protobuf.test.TestUtil.modifyRepeatedExtensions ( TestAllExtensions.Builder  message)
inlinestatic

◆ modifyRepeatedFields()

static void com.google.protobuf.test.TestUtil.modifyRepeatedFields ( TestAllTypes.Builder  message)
inlinestatic

◆ readBytesFromFile()

static ByteString com.google.protobuf.test.TestUtil.readBytesFromFile ( String  filename)
inlinestatic

◆ readTextFromFile()

static String com.google.protobuf.test.TestUtil.readTextFromFile ( String  filePath)
inlinestatic

◆ registerAllExtensions()

static void com.google.protobuf.test.TestUtil.registerAllExtensions ( ExtensionRegistry  registry)
inlinestatic

Register all of

TestAllExtensions

's extensions with the given ExtensionRegistry.

Definition at line 1084 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

◆ setAllExtensions()

static void com.google.protobuf.test.TestUtil.setAllExtensions ( TestAllExtensions.Builder  message)
inlinestatic

◆ setAllFields()

static void com.google.protobuf.test.TestUtil.setAllFields ( TestAllTypes.Builder  message)
inlinestatic

◆ setPackedExtensions()

static void com.google.protobuf.test.TestUtil.setPackedExtensions ( TestPackedExtensions.Builder  message)
inlinestatic

◆ setPackedFields()

static void com.google.protobuf.test.TestUtil.setPackedFields ( TestPackedTypes.Builder  message)
inlinestatic

◆ setUnpackedFields()

static void com.google.protobuf.test.TestUtil.setUnpackedFields ( TestUnpackedTypes.Builder  message)
inlinestatic

Set every field of

to a unique value. Must correspond with the values applied by

.

Definition at line 902 of file bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java.

Member Data Documentation

◆ goldenMessage

ByteString com.google.protobuf.test.TestUtil.goldenMessage = null
staticprivate

◆ goldenPackedFieldsMessage

ByteString com.google.protobuf.test.TestUtil.goldenPackedFieldsMessage = null
staticprivate

The documentation for this class was generated from the following file:
com.google.protobuf.test.TestUtil.assertAllFieldsSet
static void assertAllFieldsSet(TestAllTypesOrBuilder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:408
com.google.protobuf.test.TestUtil.modifyRepeatedFields
static void modifyRepeatedFields(TestAllTypes.Builder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:366
com.google.protobuf.test.TestUtil.assertRepeatedFieldsModified
static void assertRepeatedFieldsModified(TestAllTypesOrBuilder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:770
com.google.protobuf.test.TestUtil.assertAllExtensionsSet
static void assertAllExtensionsSet(TestAllExtensionsOrBuilder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:1276
com.google.protobuf
Definition: bloaty/third_party/protobuf/benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java:2
com.google.protobuf.test.TestUtil.setAllFields
static void setAllFields(TestAllTypes.Builder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:226
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
com.google.protobuf.test.TestUtil.setPackedFields
static void setPackedFields(TestPackedTypes.Builder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:866
com.google.protobuf.test.TestUtil.setUnpackedFields
static void setUnpackedFields(TestUnpackedTypes.Builder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:902
com.google.protobuf.test.TestUtil.assertRepeatedExtensionsModified
static void assertRepeatedExtensionsModified(TestAllExtensionsOrBuilder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:1683
com.google.protobuf.test.TestUtil.modifyRepeatedExtensions
static void modifyRepeatedExtensions(TestAllExtensions.Builder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:1233
com.google.protobuf.test.TestUtil.setAllExtensions
static void setAllExtensions(TestAllExtensions.Builder message)
Definition: bloaty/third_party/protobuf/java/compatibility_tests/v2.5.0/tests/src/main/java/com/google/protobuf/test/TestUtil.java:1093
com.google
com


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:09