From be54b253b5c2d2e63bbb4966fe1fb7285a22ecde Mon Sep 17 00:00:00 2001 From: Miki Rozloznik Date: Mon, 8 Jan 2024 10:06:59 +0100 Subject: [PATCH] Add clang-format to the Java test project --- .../arguments/allow_implicit_arrays/build.xml | 6 +- .../ImplicitArrayBit8Test.java | 11 +- .../ImplicitArrayFloat16Test.java | 11 +- .../ImplicitArrayInt24Test.java | 11 +- .../ImplicitArrayUInt64Test.java | 11 +- .../ImplicitArrayUInt8Test.java | 11 +- .../LengthOfWithImplicitArrayTest.java | 1 + .../TableWithImplicitArrayTest.java | 18 +- .../arguments/set_top_level_package/build.xml | 6 +- .../SetTopLevelPackageTest.java | 3 +- .../arguments/with_range_check_code/build.xml | 6 +- .../Bit4RangeCheckTest.java | 11 +- .../ChoiceBit4RangeCheckTest.java | 11 +- .../DynamicBitRangeCheckTest.java | 15 +- .../DynamicIntRangeCheckTest.java | 13 +- .../Int4RangeCheckTest.java | 11 +- .../Int7ArrayRangeCheckTest.java | 11 +- .../Int8RangeCheckTest.java | 11 +- .../OptionalBit31RangeCheckTest.java | 11 +- .../UInt8RangeCheckTest.java | 11 +- .../UnionInt4RangeCheckTest.java | 11 +- .../VarInt16RangeCheckTest.java | 11 +- .../VarInt32RangeCheckTest.java | 11 +- .../VarInt64RangeCheckTest.java | 11 +- .../VarSizeRangeCheckTest.java | 14 +- .../VarUInt16RangeCheckTest.java | 11 +- .../VarUInt32RangeCheckTest.java | 11 +- .../VarUInt64RangeCheckTest.java | 11 +- test/arguments/with_type_info_code/build.xml | 6 +- .../with_type_info_code/DebugStringTest.java | 27 +- .../WithTypeInfoCodeCreator.java | 72 ++--- .../WithTypeInfoCodeTest.java | 44 +-- test/arguments/with_validation_code/build.xml | 6 +- .../BlobTableValidationTest.java | 30 +-- .../ColumnTypeValidationTest.java | 44 ++- .../FullRangeTableValidationTest.java | 16 +- .../HiddenColumnTableValidationTest.java | 16 +- .../SimpleTableValidationTest.java | 121 +++++---- .../VirtualTableValidationTest.java | 19 +- .../without_cross_extension_check/build.xml | 6 +- .../WithoutCrossExtensionCheckTest.java | 1 + test/arguments/without_pubsub_code/build.xml | 6 +- .../WithoutPubsubCodeTest.java | 3 +- test/arguments/without_service_code/build.xml | 6 +- .../WithoutServiceCodeTest.java | 3 +- test/arguments/without_writer_code/build.xml | 6 +- .../WithoutWriterCodeTest.java | 36 ++- test/build.xml | 20 ++ test/errors/alignment_error/build.xml | 6 +- .../alignment_error/AlignmentErrorTest.java | 17 +- test/errors/array_types_error/build.xml | 6 +- .../ArrayTypesErrorTest.java | 127 ++++----- test/errors/bitmask_types_error/build.xml | 6 +- .../BitmaskTypesErrorTest.java | 49 ++-- test/errors/builtin_types_error/build.xml | 6 +- .../BuiltInTypesErrorTest.java | 37 +-- test/errors/choice_types_error/build.xml | 6 +- .../ChoiceTypesErrorTest.java | 68 +++-- test/errors/compatibility_error/build.xml | 6 +- .../CompatibilityErrorTest.java | 51 ++-- test/errors/constants_error/build.xml | 6 +- .../constants_error/ConstantsErrorTest.java | 57 ++-- test/errors/constraints_error/build.xml | 6 +- .../ConstraintsErrorTest.java | 24 +- test/errors/default_values_error/build.xml | 6 +- .../DefaultValuesErrorTest.java | 29 +- test/errors/enumeration_types_error/build.xml | 6 +- .../EnumerationTypesErrorTest.java | 32 ++- .../explicit_parameters_error/build.xml | 10 +- .../ExplicitParametersErrorTest.java | 17 +- test/errors/expressions_error/build.xml | 6 +- .../ExpressionsErrorTest.java | 33 +-- .../IsSetOperatorsErrorTest.java | 5 +- .../ValueOfOperatorsErrorTest.java | 5 +- test/errors/extended_members_error/build.xml | 6 +- .../java/ExtendedMembersErrorTest.java | 90 +++---- test/errors/functions_error/build.xml | 6 +- .../functions_error/FunctionsErrorTest.java | 40 ++- test/errors/identifiers_error/build.xml | 6 +- .../ClashingIdentifiersErrorTest.java | 230 ++++++---------- .../invalid_name/InvalidNameErrorTest.java | 9 +- .../prefix_zserio/PrefixZserioErrorTest.java | 53 ++-- .../ReservedKeywordsErrorTest.java | 37 ++- test/errors/indexed_offsets_error/build.xml | 6 +- .../IndexedOffsetsErrorTest.java | 25 +- test/errors/java_generator_error/build.xml | 6 +- .../java/JavaGeneratorErrorTest.java | 17 +- test/errors/literals_error/build.xml | 6 +- .../literals_error/LiteralsErrorTest.java | 23 +- test/errors/member_access_error/build.xml | 6 +- .../MemberAccessErrorTest.java | 11 +- test/errors/offsets_error/build.xml | 6 +- .../java/offsets_error/OffsetsErrorTest.java | 41 +-- test/errors/optional_members_error/build.xml | 6 +- .../OptionalMembersErrorTest.java | 25 +- test/errors/packages_error/build.xml | 6 +- .../packages_error/PackagesErrorTest.java | 39 ++- .../parameterized_types_error/build.xml | 7 +- .../ParameterizedTypesErrorTest.java | 78 +++--- test/errors/pubsub_types_error/build.xml | 6 +- .../PubsubTypesErrorTest.java | 44 ++- test/errors/rules_error/build.xml | 6 +- .../java/rules_error/RulesErrorTest.java | 40 ++- test/errors/service_types_error/build.xml | 6 +- .../ServiceTypesErrorTest.java | 44 ++- test/errors/sql_constraints_error/build.xml | 6 +- .../SqlConstraintsErrorTest.java | 13 +- test/errors/sql_databases_error/build.xml | 6 +- .../SqlDatabasesErrorTest.java | 13 +- test/errors/sql_tables_error/build.xml | 6 +- .../sql_tables_error/SqlTablesErrorTest.java | 32 ++- .../errors/sql_virtual_tables_error/build.xml | 7 +- .../SqlVirtualTablesErrorTest.java | 5 +- .../sql_without_rowid_tables_error/build.xml | 7 +- .../SqlWithoutRowIdTablesErrorTest.java | 9 +- test/errors/structure_types_error/build.xml | 6 +- .../StructureTypesErrorTest.java | 25 +- test/errors/subtypes_error/build.xml | 6 +- .../subtypes_error/SubtypesErrorTest.java | 26 +- test/errors/syntax_error/build.xml | 6 +- .../java/syntax_error/SyntaxErrorTest.java | 25 +- test/errors/templates_error/build.xml | 6 +- .../templates_error/TemplatesErrorTest.java | 254 +++++++----------- test/errors/union_types_error/build.xml | 6 +- .../UnionTypesErrorTest.java | 20 +- test/language/alignment/build.xml | 6 +- .../AutoOptionalMemberAlignmentTest.java | 43 +-- .../java/alignment/BitAlignmentTest.java | 17 +- .../OptionalMemberAlignmentTest.java | 41 +-- test/language/array_types/build.xml | 6 +- .../java/array_types/ArraysMappingTest.java | 7 +- .../AutoArrayBitfieldParamTest.java | 10 +- .../AutoArrayStructRecursionTest.java | 10 +- .../AutoArraySubtypedUInt8Test.java | 6 +- .../java/array_types/AutoArrayUInt8Test.java | 6 +- .../java/array_types/FixedArrayUInt8Test.java | 5 +- .../array_types/PackedArraysMappingTest.java | 7 +- .../PackedAutoArrayBitfieldParamTest.java | 4 +- .../PackedAutoArrayEmptyCompoundsTest.java | 19 +- .../PackedAutoArrayRemovedEnumItemTest.java | 11 +- .../PackedAutoArrayStructRecursionTest.java | 16 +- .../PackedAutoArrayStructWithBytesTest.java | 14 +- .../PackedAutoArrayStructWithExternTest.java | 14 +- ...dAutoArrayStructWithUnpackedFieldTest.java | 17 +- .../array_types/PackedAutoArrayUInt8Test.java | 6 +- .../PackedFixedArrayUInt8Test.java | 6 +- ...ackedVariableArrayStructRecursionTest.java | 14 +- .../PackedVariableArrayStructTest.java | 40 ++- .../PackedVariableArrayUInt8Test.java | 6 +- .../PackingInterfaceOptimizationTest.java | 140 +++++----- .../VariableArrayStructCastInt8Test.java | 9 +- .../VariableArrayStructCastVarUIntTest.java | 9 +- .../VariableArraySubtypedStructTest.java | 9 +- .../VariableArrayTernaryOperatorTest.java | 13 +- test/language/bitmask_types/build.xml | 6 +- .../bitfield_bitmask/BitfieldBitmaskTest.java | 9 +- .../BitfieldConstBitmaskTest.java | 7 +- .../BitmaskDefinedByConstantTest.java | 7 +- .../BitmaskUsedByBitmaskTest.java | 7 +- .../BitmaskWithoutNoneTest.java | 7 +- .../uint64_bitmask/UInt64BitmaskTest.java | 15 +- .../uint8_bitmask/UInt8BitmaskTest.java | 7 +- .../varuint_bitmask/VarUIntBitmaskTest.java | 11 +- test/language/builtin_types/build.xml | 6 +- .../builtin_types/AllBuiltInTypesTest.java | 5 +- .../BitFieldFunctionLengthTest.java | 17 +- .../BitFieldUInt64LengthTest.java | 7 +- test/language/choice_types/build.xml | 6 +- .../choice_types/BitmaskParamChoiceTest.java | 11 +- .../choice_types/BoolParamChoiceTest.java | 13 +- .../ChoiceCompatibilityCheckTest.java | 95 +++---- .../choice_types/ChoiceWithArrayTest.java | 11 +- .../choice_types/DefaultEmptyChoiceTest.java | 13 +- .../java/choice_types/EmptyChoiceTest.java | 6 +- .../choice_types/EmptyChoiceWithCaseTest.java | 5 +- .../EmptyChoiceWithDefaultTest.java | 5 +- .../choice_types/EnumParamChoiceTest.java | 15 +- .../EnumWithRemovedItemParamChoiceTest.java | 6 +- .../ExpressionSelectorChoiceTest.java | 1 + .../FullBitmaskParamChoiceTest.java | 18 +- .../choice_types/FullEnumParamChoiceTest.java | 15 +- .../FunctionReturningLiteralChoiceTest.java | 1 + .../FunctionSelectorChoiceTest.java | 1 + .../choice_types/UInt16ParamChoiceTest.java | 13 +- .../choice_types/UInt32ParamChoiceTest.java | 13 +- .../choice_types/UInt64ParamChoiceTest.java | 13 +- test/language/constants/build.xml | 6 +- .../java/constants/ConstantsTest.java | 11 +- test/language/constraints/build.xml | 6 +- .../ArrayLengthofConstraintTest.java | 12 +- .../constraints/ChoiceConstraintsTest.java | 9 +- .../StructureBitmaskConstraintsTest.java | 54 ++-- .../constraints/StructureConstraintsTest.java | 33 +-- .../constraints/UnionConstraintsTest.java | 9 +- test/language/default_values/build.xml | 6 +- .../StructureDefaultValuesTest.java | 3 +- test/language/enumeration_types/build.xml | 6 +- .../BitfieldConstEnumTest.java | 7 +- .../bitfield_enum/BitfieldEnumTest.java | 7 +- .../DeprecatedEnumItemTest.java | 7 +- .../EnumDefinedByConstantTest.java | 1 + .../enum_used_by_enum/EnumUsedByEnumTest.java | 19 +- .../MultipleRemovedEnumItemsTest.java | 13 +- .../RemovedEnumItemTest.java | 20 +- .../uint64_enum/UInt64EnumTest.java | 7 +- .../uint8_enum/UInt8EnumTest.java | 7 +- .../varuint_enum/VarUIntEnumTest.java | 7 +- test/language/explicit_parameters/build.xml | 6 +- .../ExplicitBitmaskParamTest.java | 20 +- .../ExplicitBlobParamTest.java | 16 +- .../ExplicitEnumParamTest.java | 16 +- .../ExplicitSameAsFieldTest.java | 44 ++- .../ExplicitSimpleParamTest.java | 20 +- .../MultipleExplicitParamsTest.java | 20 +- .../MultipleWithSameNameTest.java | 28 +- test/language/expressions/build.xml | 6 +- .../java/expressions/ArrayTypeTest.java | 5 +- .../java/expressions/BitmaskTypeTest.java | 3 +- .../expressions/CastUInt64ToUInt8Test.java | 3 +- .../expressions/CastUInt8ToUInt64Test.java | 3 +- .../java/expressions/ConstTypeTest.java | 1 + .../java/expressions/EnumerationTypeTest.java | 5 +- .../java/expressions/FieldTypeTest.java | 1 + .../expressions/FieldTypeWithClashTest.java | 1 + .../java/expressions/FloatTypeTest.java | 1 + .../java/expressions/FullConstTypeTest.java | 5 +- .../expressions/FullEnumerationTypeTest.java | 1 + .../java/expressions/FunctionTypeTest.java | 4 +- .../java/expressions/IndexOperatorTest.java | 11 +- .../java/expressions/IsSetOperatorTest.java | 5 +- .../expressions/LengthOfOperatorTest.java | 1 + .../java/expressions/ModuloOperatorTest.java | 1 + .../expressions/NegationOperatorTest.java | 1 + .../java/expressions/NumBitsOperatorTest.java | 3 +- .../java/expressions/ParameterTypeTest.java | 8 +- .../ParameterizedArrayTypeTest.java | 9 +- .../java/expressions/ParenthesisTest.java | 5 +- .../java/expressions/QuestionMarkTest.java | 9 +- .../java/expressions/StringTypeTest.java | 10 +- .../java/expressions/UInt64TypeTest.java | 11 +- .../java/expressions/UsedBeforeTypeTest.java | 5 +- .../java/expressions/ValueOfOperatorTest.java | 3 +- test/language/extended_members/build.xml | 6 +- .../ExtendedChoiceFieldTest.java | 7 +- .../ExtendedCompoundFieldTest.java | 14 +- .../ExtendedEmptyStructureTest.java | 5 +- .../ExtendedFieldInTemplateTest.java | 5 +- .../ExtendedIndexedOffsetsTest.java | 14 +- ...xtendedOptionalParameterizedFieldTest.java | 11 +- .../ExtendedSimpleFieldTest.java | 5 +- .../ExtendedUnalignedFieldTest.java | 5 +- .../MultipleExtendedFieldsTest.java | 12 +- ...ultipleExtendedFieldsVariousTypesTest.java | 20 +- test/language/functions/build.xml | 6 +- .../choice_array/ChoiceArrayTest.java | 14 +- .../structure_array/StructureArrayTest.java | 12 +- .../StructureArrayParamTest.java | 13 +- .../structure_bytes/StructureBytesTest.java | 5 +- .../structure_extern/StructureExternTest.java | 5 +- .../StructureOptionalTest.java | 11 +- .../structure_param/StructureParamTest.java | 7 +- .../StructureParentChildValueTest.java | 7 +- .../structure_string/StructureStringTest.java | 1 + .../structure_value/StructureValueTest.java | 14 +- .../functions/union_array/UnionArrayTest.java | 12 +- test/language/identifiers/build.xml | 6 +- .../BitmaskNameClashingWithJavaTest.java | 1 + .../StructureNameClashingWithJavaTest.java | 33 +-- test/language/indexed_offsets/build.xml | 6 +- .../AutoIndexedOffsetArrayTest.java | 31 +-- .../Bit5IndexedOffsetArrayTest.java | 25 +- .../BoolIndexedOffsetArrayTest.java | 29 +- .../CompoundIndexedOffsetArrayTest.java | 29 +- .../EmptyIndexedOffsetArrayTest.java | 19 +- .../Int14IndexedOffsetArrayTest.java | 32 +-- .../OptionalIndexedOffsetArrayTest.java | 31 +-- .../OptionalNestedIndexedOffsetArrayTest.java | 29 +- .../PackedAutoIndexedOffsetArrayTest.java | 46 ++-- .../PackedIndexedOffsetArrayHolderTest.java | 27 +- .../VarInt32IndexedOffsetArrayTest.java | 19 +- test/language/literals/build.xml | 6 +- .../literals/java/literals/LiteralsTest.java | 1 + test/language/member_access/build.xml | 6 +- .../member_access/AccessWithinTypeTest.java | 9 +- test/language/offsets/build.xml | 6 +- .../java/offsets/AutoArrayOffsetTest.java | 23 +- .../offsets/java/offsets/BitOffsetTest.java | 41 +-- .../java/offsets/NestedOffsetTest.java | 23 +- .../offsets/OptionalMemberOffsetTest.java | 63 ++--- .../offsets/PackedAutoArrayOffsetTest.java | 31 +-- .../java/offsets/ParameterOffsetTest.java | 26 +- .../offsets/TernaryOperatorOffsetTest.java | 15 +- .../java/offsets/UInt64OffsetTest.java | 5 +- test/language/optional_members/build.xml | 6 +- .../optional_members/AutoOptionalTest.java | 30 ++- .../OptionalArrayRecursionTest.java | 50 ++-- .../optional_members/OptionalArrayTest.java | 3 +- .../OptionalExpressionTest.java | 18 +- ...onalExpressionWithRemovedEnumItemTest.java | 4 +- .../OptionalRecursionTest.java | 14 +- test/language/packages/build.xml | 6 +- .../packages/java/DefaultPackageTest.java | 3 +- .../packages/java/index/IndexTest.java | 7 +- .../PackageNameConflictTest.java | 15 +- .../packages/java/reader/ReaderTest.java | 7 +- test/language/parameterized_types/build.xml | 6 +- .../ArrayElementParamTest.java | 3 +- .../ArrayElementParamWithOptionalTest.java | 9 +- .../bytes_param/BytesParamTest.java | 3 +- .../DynamicBitfieldParamTest.java | 14 +- .../extern_param/ExternParamTest.java | 3 +- .../FixedAndVariableParamTest.java | 65 ++--- .../GrandChildParamTest.java | 7 +- .../NestedParameterizedFieldTest.java | 5 +- .../PackedArrayElementParamTest.java | 17 +- .../ParamWithOptionalTest.java | 5 +- ...ParameterizedInnerClassesClashingTest.java | 34 ++- .../ParameterizedParamTest.java | 11 +- .../simple_param/SimpleParamTest.java | 3 +- .../SubtypedBitfieldParamTest.java | 11 +- test/language/pubsub_types/build.xml | 6 +- .../java/pubsub_types/TestPubsub.java | 5 +- .../simple_pubsub/SimplePubsubTest.java | 11 +- test/language/service_types/build.xml | 6 +- .../ComplexTypesServiceTest.java | 9 +- .../simple_service/SimpleServiceTest.java | 7 +- test/language/sql_constraints/build.xml | 6 +- .../FieldConstraintsTest.java | 18 +- .../TableConstraintsTest.java | 28 +- test/language/sql_databases/build.xml | 6 +- .../DbWithRelocationTest.java | 62 ++--- .../sql_databases/simple_db/SimpleDbTest.java | 31 +-- test/language/sql_tables/build.xml | 6 +- ...ldWithChildrenInitializationTableTest.java | 24 +- .../BlobOffsetsParamTableTest.java | 37 ++- .../blob_param_table/BlobParamTableTest.java | 33 ++- .../ColumnParamTableTest.java | 34 ++- .../complex_table/ComplexTableTest.java | 34 ++- .../ConstParamTableTest.java | 39 ++- .../DynamicBitFieldEnumFieldTableTest.java | 28 +- .../MultiplePkTableTest.java | 28 +- .../SubtypedBitmaskFieldTableTest.java | 30 +-- .../SubtypedBoolFieldTableTest.java | 18 +- .../SubtypedEnumFieldTableTest.java | 24 +- .../subtyped_table/SubtypedTableTest.java | 23 +- .../without_pk_table/WithoutPkTableTest.java | 28 +- test/language/sql_types/build.xml | 6 +- .../java/sql_types/SqlTypesTest.java | 15 +- test/language/sql_virtual_columns/build.xml | 6 +- .../HiddenVirtualColumnsTest.java | 44 ++- .../SimpleVirtualColumnsTest.java | 42 ++- test/language/sql_virtual_tables/build.xml | 6 +- .../Fts3VirtualTableTest.java | 29 +- .../Fts5VirtualTableTest.java | 29 +- .../sql_without_rowid_tables/build.xml | 6 +- .../RowIdAndWithoutRowIdTablesTest.java | 9 +- .../SimpleWithoutRowIdTableTest.java | 9 +- test/language/structure_types/build.xml | 6 +- .../structure_types/EmptyStructureTest.java | 5 +- .../EmptyStructureWithParameterTest.java | 11 +- .../FieldConstructorClashingTest.java | 21 +- .../OneStringStructureTest.java | 19 +- .../structure_types/SimpleStructureTest.java | 9 +- .../StructureInnerClassesClashingTest.java | 28 +- ...StructureWithRemovedEnumItemFieldTest.java | 16 +- test/language/subtypes/build.xml | 6 +- .../java/subtypes/BitmaskSubtypeTest.java | 3 +- .../java/subtypes/EnumSubtypeTest.java | 3 +- .../subtypes/ParamStructureSubtypeTest.java | 8 +- .../java/subtypes/StructureSubtypeTest.java | 3 +- .../java/subtypes/SubtypeImportedTest.java | 7 +- .../java/subtypes/UInt16SubtypeTest.java | 1 + test/language/templates/build.xml | 6 +- .../ChoiceTemplatedEnumSelectorTest.java | 13 +- .../templates/ChoiceTemplatedFieldTest.java | 14 +- .../ChoiceTemplatedSelectorTest.java | 9 +- ...ExpressionBitmaskTemplateArgumentTest.java | 7 +- ...ssionEnumTemplateArgumentConflictTest.java | 7 +- .../ExpressionEnumTemplateArgumentTest.java | 7 +- .../ExpressionFullTemplateArgumentTest.java | 7 +- .../FunctionTemplatedReturnTypeTest.java | 16 +- .../InstantiateClashOtherTemplateTest.java | 7 +- .../templates/InstantiateImportedTest.java | 9 +- .../InstantiateNestedTemplateTest.java | 9 +- .../templates/InstantiateNotImportedTest.java | 9 +- .../templates/InstantiateOnlyNestedTest.java | 8 +- .../java/templates/InstantiateSimpleTest.java | 7 +- .../templates/InstantiateSqlTableTest.java | 10 +- .../InstantiateTemplateArgumentTest.java | 7 +- .../InstantiateTypeAsChoiceFieldTest.java | 10 +- .../InstantiateTypeAsParameterTest.java | 13 +- ...InstantiateTypeAsSqlDatabaseFieldTest.java | 12 +- .../InstantiateTypeAsSqlTableFieldTest.java | 12 +- ...InstantiateTypeAsStructArrayFieldTest.java | 9 +- .../InstantiateTypeAsStructFieldTest.java | 7 +- ...InstantiateTypeAsTemplateArgumentTest.java | 7 +- ...tantiateTypeImportedAsStructFieldTest.java | 7 +- ...ntiateTypeOnParameterizedTemplateTest.java | 11 +- .../java/templates/InstantiateUnusedTest.java | 7 +- .../templates/InstantiateViaImportTest.java | 9 +- .../InstantiateViaSingleImportTest.java | 9 +- .../templates/InstantiateVsDefaultTest.java | 9 +- ...teWithInstantiateTemplateArgumentTest.java | 11 +- .../templates/SqlTableTemplatedFieldTest.java | 23 +- ...tructFullAndShortTemplateArgumentTest.java | 13 +- .../StructFullNameTemplateArgumentTest.java | 13 +- .../StructLongTemplateArgumentClashTest.java | 13 +- .../StructLongTemplateArgumentTest.java | 9 +- .../StructRecursiveTemplateTest.java | 18 +- ...StructTemplateClashAcrossPackagesTest.java | 13 +- .../StructTemplateClashOtherTemplateTest.java | 12 +- .../StructTemplateClashOtherTypeTest.java | 7 +- .../templates/StructTemplateClashTest.java | 22 +- .../StructTemplateInTemplateTest.java | 15 +- .../templates/StructTemplatedFieldTest.java | 13 +- .../StructTemplatedTemplateArgumentTest.java | 11 +- .../StructTemplatedTypeArgumentTest.java | 12 +- .../SubtypeTemplateArgumentTest.java | 7 +- .../SubtypeTemplateWithBuiltinTest.java | 7 +- .../SubtypeTemplateWithCompoundTest.java | 11 +- .../TemplatedStructRecursionTest.java | 25 +- .../templates/UnionTemplatedFieldTest.java | 17 +- test/language/union_types/build.xml | 6 +- .../java/union_types/EmptyUnionTest.java | 5 +- .../EmptyUnionWithParameterTest.java | 44 ++- .../java/union_types/SimpleUnionTest.java | 17 +- .../UnionCompatibilityCheckTest.java | 97 +++---- .../java/union_types/UnionWithArrayTest.java | 9 +- .../union_types/UnionWithParameterTest.java | 13 +- .../UnionWithParameterizedFieldTest.java | 11 +- test/others/gif/build.xml | 6 +- test/others/gif/java/gif/GifTest.java | 168 ++++++------ test/utils/java/build.xml | 18 +- .../java/src/test_utils/AssertionUtils.java | 2 +- test/utils/java/src/test_utils/FileUtil.java | 3 +- test/warnings/array_types_warning/build.xml | 6 +- .../ArrayTypesWarningTest.java | 64 +++-- ...ckedArrayChoiceHasNoPackableFieldTest.java | 23 +- ...ckedArrayStructHasNoPackableFieldTest.java | 35 ++- ...edArrayTemplateHasNoPackableFieldTest.java | 15 +- ...ackedArrayUnionHasNoPackableFieldTest.java | 17 +- .../PackedArrayUnpackableBoolElementTest.java | 14 +- ...PackedArrayUnpackableBytesElementTest.java | 5 +- ...ackedArrayUnpackableExternElementTest.java | 11 +- ...PackedArrayUnpackableFloatElementTest.java | 6 +- ...ackedArrayUnpackableStringElementTest.java | 6 +- test/warnings/choice_types_warning/build.xml | 6 +- .../ChoiceTypesWarningTest.java | 9 +- test/warnings/comments_warning/build.xml | 6 +- .../comments_warning/CommentsWarningTest.java | 90 +++---- .../DocCommentMissingWarningTest.java | 134 ++++----- test/warnings/compatibility_warning/build.xml | 6 +- .../CompatibilityWarningTest.java | 13 +- test/warnings/file_encoding_warning/build.xml | 6 +- .../FileEncodingWarningTest.java | 5 +- test/warnings/functions_warning/build.xml | 6 +- .../FunctionsWarningTest.java | 13 +- test/warnings/not_handled_warning/build.xml | 6 +- .../NotHandledWarningTest.java | 13 +- .../optional_members_warning/build.xml | 6 +- .../OptionalMembersWarningTest.java | 107 ++++---- test/warnings/packages_warning/build.xml | 6 +- .../packages_warning/PackagesWarningTest.java | 25 +- test/warnings/sql_tables_warning/build.xml | 6 +- .../SqlTablesWarningTest.java | 33 +-- .../build.xml | 6 +- .../SqlWithoutRowIdTablesWarningTest.java | 11 +- test/warnings/templates_warning/build.xml | 6 +- .../TemplatesWarningTest.java | 29 +- test/warnings/unused_type_warning/build.xml | 6 +- .../UnusedTypeWarningTest.java | 29 +- 471 files changed, 4183 insertions(+), 3908 deletions(-) diff --git a/test/arguments/allow_implicit_arrays/build.xml b/test/arguments/allow_implicit_arrays/build.xml index 27f0b5376..5c776633b 100644 --- a/test/arguments/allow_implicit_arrays/build.xml +++ b/test/arguments/allow_implicit_arrays/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayBit8Test.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayBit8Test.java index 9b8b8e631..0f6ddf594 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayBit8Test.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayBit8Test.java @@ -1,16 +1,17 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import allow_implicit_arrays.implicit_array_bit8.ImplicitArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.BitBuffer; + +import allow_implicit_arrays.implicit_array_bit8.ImplicitArray; public class ImplicitArrayBit8Test { @@ -66,8 +67,8 @@ public void writeRead() throws IOException, ZserioError ImplicitArray implicitArray = new ImplicitArray(array); SerializeUtil.serializeToFile(implicitArray, BLOB_NAME); - final ImplicitArray readImplicitArray = SerializeUtil.deserializeFromFile(ImplicitArray.class, - BLOB_NAME); + final ImplicitArray readImplicitArray = + SerializeUtil.deserializeFromFile(ImplicitArray.class, BLOB_NAME); final short[] readArray = readImplicitArray.getArray(); assertEquals(numElements, readArray.length); for (short i = 0; i < numElements; ++i) diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayFloat16Test.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayFloat16Test.java index be1abdda0..0bf77bf8d 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayFloat16Test.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayFloat16Test.java @@ -1,16 +1,17 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import allow_implicit_arrays.implicit_array_float16.ImplicitArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.BitBuffer; + +import allow_implicit_arrays.implicit_array_float16.ImplicitArray; public class ImplicitArrayFloat16Test { @@ -66,8 +67,8 @@ public void writeRead() throws IOException, ZserioError ImplicitArray implicitArray = new ImplicitArray(array); SerializeUtil.serializeToFile(implicitArray, BLOB_NAME); - final ImplicitArray readImplicitArray = SerializeUtil.deserializeFromFile(ImplicitArray.class, - BLOB_NAME); + final ImplicitArray readImplicitArray = + SerializeUtil.deserializeFromFile(ImplicitArray.class, BLOB_NAME); final float[] readArray = readImplicitArray.getArray(); assertEquals(numElements, readArray.length); for (short i = 0; i < numElements; ++i) diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayInt24Test.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayInt24Test.java index b7875fa27..d404257d2 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayInt24Test.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayInt24Test.java @@ -1,16 +1,17 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import allow_implicit_arrays.implicit_array_int24.ImplicitArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.BitBuffer; + +import allow_implicit_arrays.implicit_array_int24.ImplicitArray; public class ImplicitArrayInt24Test { @@ -66,8 +67,8 @@ public void writeRead() throws IOException, ZserioError ImplicitArray implicitArray = new ImplicitArray(array); SerializeUtil.serializeToFile(implicitArray, BLOB_NAME); - final ImplicitArray readImplicitArray = SerializeUtil.deserializeFromFile(ImplicitArray.class, - BLOB_NAME); + final ImplicitArray readImplicitArray = + SerializeUtil.deserializeFromFile(ImplicitArray.class, BLOB_NAME); final int[] readArray = readImplicitArray.getArray(); assertEquals(numElements, readArray.length); for (int i = 0; i < numElements; ++i) diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt64Test.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt64Test.java index 403af3573..312cef729 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt64Test.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt64Test.java @@ -1,17 +1,18 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; -import allow_implicit_arrays.implicit_array_uint64.ImplicitArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.BitBuffer; + +import allow_implicit_arrays.implicit_array_uint64.ImplicitArray; public class ImplicitArrayUInt64Test { @@ -67,8 +68,8 @@ public void writeRead() throws IOException, ZserioError ImplicitArray implicitArray = new ImplicitArray(array); SerializeUtil.serializeToFile(implicitArray, BLOB_NAME); - final ImplicitArray readImplicitArray = SerializeUtil.deserializeFromFile(ImplicitArray.class, - BLOB_NAME); + final ImplicitArray readImplicitArray = + SerializeUtil.deserializeFromFile(ImplicitArray.class, BLOB_NAME); final BigInteger[] readArray = readImplicitArray.getArray(); assertEquals(numElements, readArray.length); for (int i = 0; i < numElements; ++i) diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt8Test.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt8Test.java index ee62228b5..dea3e82e8 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt8Test.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/ImplicitArrayUInt8Test.java @@ -1,16 +1,17 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import allow_implicit_arrays.implicit_array_uint8.ImplicitArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.BitBuffer; + +import allow_implicit_arrays.implicit_array_uint8.ImplicitArray; public class ImplicitArrayUInt8Test { @@ -66,8 +67,8 @@ public void writeRead() throws IOException, ZserioError ImplicitArray implicitArray = new ImplicitArray(array); SerializeUtil.serializeToFile(implicitArray, BLOB_NAME); - final ImplicitArray readImplicitArray = SerializeUtil.deserializeFromFile(ImplicitArray.class, - BLOB_NAME); + final ImplicitArray readImplicitArray = + SerializeUtil.deserializeFromFile(ImplicitArray.class, BLOB_NAME); final short[] readArray = readImplicitArray.getArray(); assertEquals(numElements, readArray.length); for (short i = 0; i < numElements; ++i) diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/LengthOfWithImplicitArrayTest.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/LengthOfWithImplicitArrayTest.java index 86eb35aa5..e2564f7dc 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/LengthOfWithImplicitArrayTest.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/LengthOfWithImplicitArrayTest.java @@ -1,6 +1,7 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import allow_implicit_arrays.lengthof_with_implicit_array.LengthOfWithImplicitArray; diff --git a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/TableWithImplicitArrayTest.java b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/TableWithImplicitArrayTest.java index 62a5d96fc..6685c1f86 100644 --- a/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/TableWithImplicitArrayTest.java +++ b/test/arguments/allow_implicit_arrays/java/allow_implicit_arrays/TableWithImplicitArrayTest.java @@ -1,10 +1,6 @@ package allow_implicit_arrays; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,15 +8,19 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import zserio.runtime.ZserioError; import allow_implicit_arrays.table_with_implicit_array.DbWithImplicitArray; +import allow_implicit_arrays.table_with_implicit_array.StructWithImplicit; import allow_implicit_arrays.table_with_implicit_array.TableWithImplicitArray; import allow_implicit_arrays.table_with_implicit_array.TableWithImplicitArrayRow; -import allow_implicit_arrays.table_with_implicit_array.StructWithImplicit; - -import zserio.runtime.ZserioError; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class TableWithImplicitArrayTest { diff --git a/test/arguments/set_top_level_package/build.xml b/test/arguments/set_top_level_package/build.xml index f3aadd7bd..b7b05115e 100644 --- a/test/arguments/set_top_level_package/build.xml +++ b/test/arguments/set_top_level_package/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/set_top_level_package/java/set_top_level_package/SetTopLevelPackageTest.java b/test/arguments/set_top_level_package/java/set_top_level_package/SetTopLevelPackageTest.java index e68fcaa5a..42158c3d9 100644 --- a/test/arguments/set_top_level_package/java/set_top_level_package/SetTopLevelPackageTest.java +++ b/test/arguments/set_top_level_package/java/set_top_level_package/SetTopLevelPackageTest.java @@ -1,10 +1,11 @@ package set_top_level_package; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import company.appl.SimpleStructure; import company.appl.SimpleChoice; +import company.appl.SimpleStructure; import company.appl.SimpleTemplate_Enumeration; public class SetTopLevelPackageTest diff --git a/test/arguments/with_range_check_code/build.xml b/test/arguments/with_range_check_code/build.xml index 3363a0dcd..e7d476861 100644 --- a/test/arguments/with_range_check_code/build.xml +++ b/test/arguments/with_range_check_code/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/Bit4RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/Bit4RangeCheckTest.java index 8d5889bc8..ecc93b978 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/Bit4RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/Bit4RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.bit4_range_check.Bit4RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.bit4_range_check.Bit4RangeCheckCompound; + public class Bit4RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkBit4Value(byte value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); bit4RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Bit4RangeCheckCompound readBit4RangeCheckCompound = new Bit4RangeCheckCompound(reader); assertEquals(bit4RangeCheckCompound, readBit4RangeCheckCompound); } diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/ChoiceBit4RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/ChoiceBit4RangeCheckTest.java index 5de06dc29..ba18aa568 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/ChoiceBit4RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/ChoiceBit4RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.choice_bit4_range_check.ChoiceBit4RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.choice_bit4_range_check.ChoiceBit4RangeCheckCompound; + public class ChoiceBit4RangeCheckTest { @Test @@ -45,8 +46,8 @@ private void checkChoiceBit4Value(byte value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); choiceBit4RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final ChoiceBit4RangeCheckCompound readChoiceBit4RangeCheckCompound = new ChoiceBit4RangeCheckCompound(reader, selector); assertEquals(choiceBit4RangeCheckCompound, readChoiceBit4RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/DynamicBitRangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/DynamicBitRangeCheckTest.java index 5d5612be1..a719317aa 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/DynamicBitRangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/DynamicBitRangeCheckTest.java @@ -1,19 +1,20 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.Disabled; - -import with_range_check_code.dynamic_bit_range_check.DynamicBitRangeCheckCompound; import java.io.IOException; import java.math.BigInteger; -import zserio.runtime.ZserioError; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + import zserio.runtime.BitFieldUtil; +import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.dynamic_bit_range_check.DynamicBitRangeCheckCompound; + public class DynamicBitRangeCheckTest { @Test @@ -66,8 +67,8 @@ private void checkDynamicBitValue(short numBits, BigInteger value) throws IOExce final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); dynamicBitRangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final DynamicBitRangeCheckCompound readDynamicBitRangeCheckCompound = new DynamicBitRangeCheckCompound(reader); assertEquals(dynamicBitRangeCheckCompound, readDynamicBitRangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/DynamicIntRangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/DynamicIntRangeCheckTest.java index 0a99314ea..36523990f 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/DynamicIntRangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/DynamicIntRangeCheckTest.java @@ -1,17 +1,18 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.dynamic_int_range_check.DynamicIntRangeCheckCompound; import java.io.IOException; -import zserio.runtime.ZserioError; +import org.junit.jupiter.api.Test; + import zserio.runtime.BitFieldUtil; +import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.dynamic_int_range_check.DynamicIntRangeCheckCompound; + public class DynamicIntRangeCheckTest { @Test @@ -58,8 +59,8 @@ private void checkDynamicIntValue(short numBits, long value) throws IOException, final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); dynamicIntRangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final DynamicIntRangeCheckCompound readDynamicIntRangeCheckCompound = new DynamicIntRangeCheckCompound(reader); assertEquals(dynamicIntRangeCheckCompound, readDynamicIntRangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/Int4RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/Int4RangeCheckTest.java index 3dd97886e..b92e89488 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/Int4RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/Int4RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.int4_range_check.Int4RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.int4_range_check.Int4RangeCheckCompound; + public class Int4RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkInt4Value(byte value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); int4RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Int4RangeCheckCompound readInt4RangeCheckCompound = new Int4RangeCheckCompound(reader); assertEquals(int4RangeCheckCompound, readInt4RangeCheckCompound); } diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/Int7ArrayRangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/Int7ArrayRangeCheckTest.java index d4169ab0f..b6a4287ea 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/Int7ArrayRangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/Int7ArrayRangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.int7_array_range_check.Int7ArrayRangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.int7_array_range_check.Int7ArrayRangeCheckCompound; + public class Int7ArrayRangeCheckTest { @Test @@ -47,8 +48,8 @@ private void checkInt7ArrayValue(byte value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); int7ArrayRangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Int7ArrayRangeCheckCompound readInt7ArrayRangeCheckCompound = new Int7ArrayRangeCheckCompound(reader); assertEquals(int7ArrayRangeCheckCompound, readInt7ArrayRangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/Int8RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/Int8RangeCheckTest.java index e470efd81..912da5000 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/Int8RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/Int8RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.int8_range_check.Int8RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.int8_range_check.Int8RangeCheckCompound; + public class Int8RangeCheckTest { @Test @@ -32,8 +33,8 @@ private void checkInt8Value(byte value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); int8RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Int8RangeCheckCompound readInt8RangeCheckCompound = new Int8RangeCheckCompound(reader); assertEquals(int8RangeCheckCompound, readInt8RangeCheckCompound); } diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/OptionalBit31RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/OptionalBit31RangeCheckTest.java index ebdb841ce..10360ff04 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/OptionalBit31RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/OptionalBit31RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.optional_bit31_range_check.OptionalBit31RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.optional_bit31_range_check.OptionalBit31RangeCheckCompound; + public class OptionalBit31RangeCheckTest { @Test @@ -52,8 +53,8 @@ private void checkOptionalBit31Value(int value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); optionalBit31RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OptionalBit31RangeCheckCompound readOptionalBit31RangeCheckCompound = new OptionalBit31RangeCheckCompound(reader); assertEquals(optionalBit31RangeCheckCompound, readOptionalBit31RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/UInt8RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/UInt8RangeCheckTest.java index 4e2714024..cb3a95b4e 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/UInt8RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/UInt8RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.uint8_range_check.UInt8RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.uint8_range_check.UInt8RangeCheckCompound; + public class UInt8RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkUInt8Value(short value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); uint8RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UInt8RangeCheckCompound readUInt8RangeCheckCompound = new UInt8RangeCheckCompound(reader); assertEquals(uint8RangeCheckCompound, readUInt8RangeCheckCompound); } diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/UnionInt4RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/UnionInt4RangeCheckTest.java index 52da4a528..1458157bc 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/UnionInt4RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/UnionInt4RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.union_int4_range_check.UnionInt4RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.union_int4_range_check.UnionInt4RangeCheckCompound; + public class UnionInt4RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkUnionInt4Value(byte value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); unionInt4RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UnionInt4RangeCheckCompound readUnionInt4RangeCheckCompound = new UnionInt4RangeCheckCompound(reader); assertEquals(unionInt4RangeCheckCompound, readUnionInt4RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarInt16RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarInt16RangeCheckTest.java index 8f487506a..4e862125f 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarInt16RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarInt16RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varint16_range_check.VarInt16RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varint16_range_check.VarInt16RangeCheckCompound; + public class VarInt16RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkVarInt16Value(short value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varInt16RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final VarInt16RangeCheckCompound readVarInt16RangeCheckCompound = new VarInt16RangeCheckCompound(reader); assertEquals(varInt16RangeCheckCompound, readVarInt16RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarInt32RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarInt32RangeCheckTest.java index 8d6abbe96..c70b7fc92 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarInt32RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarInt32RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varint32_range_check.VarInt32RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varint32_range_check.VarInt32RangeCheckCompound; + public class VarInt32RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkVarInt32Value(int value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varInt32RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final VarInt32RangeCheckCompound readVarInt32RangeCheckCompound = new VarInt32RangeCheckCompound(reader); assertEquals(varInt32RangeCheckCompound, readVarInt32RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarInt64RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarInt64RangeCheckTest.java index 21cbdb0f5..bc5a0bed3 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarInt64RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarInt64RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varint64_range_check.VarInt64RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varint64_range_check.VarInt64RangeCheckCompound; + public class VarInt64RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkVarInt64Value(long value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varInt64RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final VarInt64RangeCheckCompound readVarInt64RangeCheckCompound = new VarInt64RangeCheckCompound(reader); assertEquals(varInt64RangeCheckCompound, readVarInt64RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarSizeRangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarSizeRangeCheckTest.java index 1d3d6674b..dcc3b7412 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarSizeRangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarSizeRangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varsize_range_check.VarSizeRangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varsize_range_check.VarSizeRangeCheckCompound; + public class VarSizeRangeCheckTest { @Test @@ -38,10 +39,9 @@ private void checkVarSizeValue(int value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varSizeRangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); - final VarSizeRangeCheckCompound readVarSizeRangeCheckCompound = - new VarSizeRangeCheckCompound(reader); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); + final VarSizeRangeCheckCompound readVarSizeRangeCheckCompound = new VarSizeRangeCheckCompound(reader); assertEquals(varSizeRangeCheckCompound, readVarSizeRangeCheckCompound); } diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt16RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt16RangeCheckTest.java index c8eb0461a..e58dab1a0 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt16RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt16RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varuint16_range_check.VarUInt16RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varuint16_range_check.VarUInt16RangeCheckCompound; + public class VarUInt16RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkVarUInt16Value(short value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varUInt16RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final VarUInt16RangeCheckCompound readVarUInt16RangeCheckCompound = new VarUInt16RangeCheckCompound(reader); assertEquals(varUInt16RangeCheckCompound, readVarUInt16RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt32RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt32RangeCheckTest.java index 9409252c0..603111815 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt32RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt32RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varuint32_range_check.VarUInt32RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varuint32_range_check.VarUInt32RangeCheckCompound; + public class VarUInt32RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkVarUInt32Value(int value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varUInt32RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final VarUInt32RangeCheckCompound readVarUInt32RangeCheckCompound = new VarUInt32RangeCheckCompound(reader); assertEquals(varUInt32RangeCheckCompound, readVarUInt32RangeCheckCompound); diff --git a/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt64RangeCheckTest.java b/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt64RangeCheckTest.java index b33112f06..5efb618e6 100644 --- a/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt64RangeCheckTest.java +++ b/test/arguments/with_range_check_code/java/with_range_check_code/VarUInt64RangeCheckTest.java @@ -1,16 +1,17 @@ package with_range_check_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import with_range_check_code.varuint64_range_check.VarUInt64RangeCheckCompound; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import with_range_check_code.varuint64_range_check.VarUInt64RangeCheckCompound; + public class VarUInt64RangeCheckTest { @Test @@ -44,8 +45,8 @@ private void checkVarUInt64Value(long value) throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); varUInt64RangeCheckCompound.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final VarUInt64RangeCheckCompound readVarUInt64RangeCheckCompound = new VarUInt64RangeCheckCompound(reader); assertEquals(varUInt64RangeCheckCompound, readVarUInt64RangeCheckCompound); diff --git a/test/arguments/with_type_info_code/build.xml b/test/arguments/with_type_info_code/build.xml index f8e458f6d..86e3c949b 100644 --- a/test/arguments/with_type_info_code/build.xml +++ b/test/arguments/with_type_info_code/build.xml @@ -25,7 +25,11 @@ - + + + + + diff --git a/test/arguments/with_type_info_code/java/with_type_info_code/DebugStringTest.java b/test/arguments/with_type_info_code/java/with_type_info_code/DebugStringTest.java index 1572d6220..de095a10d 100644 --- a/test/arguments/with_type_info_code/java/with_type_info_code/DebugStringTest.java +++ b/test/arguments/with_type_info_code/java/with_type_info_code/DebugStringTest.java @@ -1,27 +1,28 @@ package with_type_info_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.util.ArrayList; -import java.nio.charset.StandardCharsets; +import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.FileInputStream; -import java.io.FileOutputStream; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import org.junit.jupiter.api.Test; + +import zserio.runtime.DebugStringUtil; +import zserio.runtime.json.JsonReader; +import zserio.runtime.json.JsonWriter; import zserio.runtime.walker.AndWalkFilter; import zserio.runtime.walker.ArrayLengthWalkFilter; import zserio.runtime.walker.DepthWalkFilter; import zserio.runtime.walker.RegexWalkFilter; -import zserio.runtime.walker.Walker; import zserio.runtime.walker.WalkFilter; -import zserio.runtime.DebugStringUtil; -import zserio.runtime.json.JsonReader; -import zserio.runtime.json.JsonWriter; +import zserio.runtime.walker.Walker; public class DebugStringTest { @@ -35,8 +36,8 @@ public void jsonWriterWithOptionals() throws IOException DebugStringUtil.toJsonFile(withTypeInfoCode, JSON_NAME_WITH_OPTIONALS); - final Object readObject = DebugStringUtil.fromJsonFile(WithTypeInfoCode.class, - JSON_NAME_WITH_OPTIONALS); + final Object readObject = + DebugStringUtil.fromJsonFile(WithTypeInfoCode.class, JSON_NAME_WITH_OPTIONALS); assertTrue(readObject instanceof WithTypeInfoCode); assertEquals(withTypeInfoCode, (WithTypeInfoCode)readObject); } @@ -51,8 +52,8 @@ public void jsonWriterWithoutOptionals() throws IOException DebugStringUtil.toJsonFile(withTypeInfoCode, JSON_NAME_WITHOUT_OPTIONALS); - final Object readObject = DebugStringUtil.fromJsonFile(WithTypeInfoCode.class, - JSON_NAME_WITHOUT_OPTIONALS); + final Object readObject = + DebugStringUtil.fromJsonFile(WithTypeInfoCode.class, JSON_NAME_WITHOUT_OPTIONALS); assertTrue(readObject instanceof WithTypeInfoCode); assertEquals(withTypeInfoCode, (WithTypeInfoCode)readObject); } diff --git a/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeCreator.java b/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeCreator.java index 40bdcb4da..75b649d33 100644 --- a/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeCreator.java +++ b/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeCreator.java @@ -16,22 +16,12 @@ public static WithTypeInfoCode createWithTypeInfoCode(boolean createOptionals) final SimpleStruct simpleStruct = createSimpleStruct(); final TestEnum testEnum = TestEnum._TWO; final TS32 ts32 = createTS32(); - final WithTypeInfoCode withTypeInfoCode = new WithTypeInfoCode( - simpleStruct, - createComplexStruct(createOptionals), - createParameterizedStruct(simpleStruct), - createRecursiveStruct(), - createRecursiveUnion(), - createRecursiveChoice(true, false), - testEnum, - createSimpleChoice(testEnum), - ts32, - createTemplatedParameterizedStruct_TS32(ts32), - createExternData(), - new BitBuffer[] { createExternData(), createExternData() }, - createBytesData(), - new byte[][] { createBytesData(), createBytesData() }, - new long[] {1, 4, 6, 4, 6, 1}); + final WithTypeInfoCode withTypeInfoCode = new WithTypeInfoCode(simpleStruct, + createComplexStruct(createOptionals), createParameterizedStruct(simpleStruct), + createRecursiveStruct(), createRecursiveUnion(), createRecursiveChoice(true, false), testEnum, + createSimpleChoice(testEnum), ts32, createTemplatedParameterizedStruct_TS32(ts32), + createExternData(), new BitBuffer[] {createExternData(), createExternData()}, createBytesData(), + new byte[][] {createBytesData(), createBytesData()}, new long[] {1, 4, 6, 4, 6, 1}); return withTypeInfoCode; } @@ -53,25 +43,21 @@ private static ComplexStruct createComplexStruct(boolean createOptionals) for (int i = 0; i < dynamicBitFieldArray.length; i++) dynamicBitFieldArray[i] = BigInteger.valueOf(2 * i + 1); - final ComplexStruct complexStruct = new ComplexStruct( - simpleStruct, - anotherSimpleStruct, - (createOptionals) ? createSimpleStruct() : null, - new long[] {3, 0xABCD2, 0xABCD3, 0xABCD4, 0xABCD5}, - new byte[] {3, 2, 1}, - (createOptionals) ? new ParameterizedStruct[] { createParameterizedStruct(simpleStruct), - createParameterizedStruct(anotherSimpleStruct) } : null, - BigInteger.valueOf(8), - dynamicBitFieldArray, - (createOptionals) ? TestEnum.ItemThree : null, - (createOptionals) ? - TestBitmask.Values.RED.or(TestBitmask.Values._Green).or(TestBitmask.Values.ColorBlue) : - null, - (createOptionals) ? new BitBuffer(new byte[]{(byte)0xCB, (byte)0xF0}, 12) : null, - (createOptionals) ? createBytesData() : null, - new TestEnum[] { TestEnum._TWO, TestEnum.ItemThree}, - new TestBitmask[] { TestBitmask.Values._Green, TestBitmask.Values._Green, TestBitmask.Values._Green, - TestBitmask.Values._Green, TestBitmask.Values._Green }); + final ComplexStruct complexStruct = new ComplexStruct(simpleStruct, anotherSimpleStruct, + (createOptionals) ? createSimpleStruct() : null, + new long[] {3, 0xABCD2, 0xABCD3, 0xABCD4, 0xABCD5}, new byte[] {3, 2, 1}, + (createOptionals) ? new ParameterizedStruct[] {createParameterizedStruct(simpleStruct), + createParameterizedStruct(anotherSimpleStruct)} + : null, + BigInteger.valueOf(8), dynamicBitFieldArray, (createOptionals) ? TestEnum.ItemThree : null, + (createOptionals) + ? TestBitmask.Values.RED.or(TestBitmask.Values._Green).or(TestBitmask.Values.ColorBlue) + : null, + (createOptionals) ? new BitBuffer(new byte[] {(byte)0xCB, (byte)0xF0}, 12) : null, + (createOptionals) ? createBytesData() : null, + new TestEnum[] {TestEnum._TWO, TestEnum.ItemThree}, + new TestBitmask[] {TestBitmask.Values._Green, TestBitmask.Values._Green, + TestBitmask.Values._Green, TestBitmask.Values._Green, TestBitmask.Values._Green}); return complexStruct; } @@ -81,19 +67,17 @@ private static ParameterizedStruct createParameterizedStruct(SimpleStruct simple final short[] array = new short[(int)simpleStruct.getFieldU32()]; for (int i = 0; i < array.length; i++) array[i] = (short)i; - final ParameterizedStruct parameterizedStruct = new ParameterizedStruct( - simpleStruct, array); + final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(simpleStruct, array); return parameterizedStruct; } private static RecursiveStruct createRecursiveStruct() { - final RecursiveStruct recursiveStruct = new RecursiveStruct( - 0xDEAD1, - new RecursiveStruct(0xDEAD2, null, new RecursiveStruct[0]), - new RecursiveStruct[] {new RecursiveStruct(0xDEAD3, null, new RecursiveStruct[0]), - new RecursiveStruct(0xDEAD4, null, new RecursiveStruct[0])}); + final RecursiveStruct recursiveStruct = new RecursiveStruct(0xDEAD1, + new RecursiveStruct(0xDEAD2, null, new RecursiveStruct[0]), + new RecursiveStruct[] {new RecursiveStruct(0xDEAD3, null, new RecursiveStruct[0]), + new RecursiveStruct(0xDEAD4, null, new RecursiveStruct[0])}); return recursiveStruct; } @@ -165,11 +149,11 @@ private static TemplatedParameterizedStruct_TS32 createTemplatedParameterizedStr private static BitBuffer createExternData() { - return new BitBuffer(new byte[]{(byte)0xCA, (byte)0xFE}, 15); + return new BitBuffer(new byte[] {(byte)0xCA, (byte)0xFE}, 15); } private static byte[] createBytesData() { - return new byte[] { (byte)0xAB, (byte)0xCD }; + return new byte[] {(byte)0xAB, (byte)0xCD}; } } diff --git a/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeTest.java b/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeTest.java index efa6aec31..8e512600a 100644 --- a/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeTest.java +++ b/test/arguments/with_type_info_code/java/with_type_info_code/WithTypeInfoCodeTest.java @@ -1,27 +1,28 @@ package with_type_info_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.util.List; import java.io.IOException; import java.math.BigInteger; +import java.util.List; -import zserio.runtime.typeinfo.TypeInfo; -import zserio.runtime.typeinfo.SchemaType; -import zserio.runtime.typeinfo.JavaType; -import zserio.runtime.typeinfo.TableInfo; +import org.junit.jupiter.api.Test; + +import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; +import zserio.runtime.io.SerializeUtil; +import zserio.runtime.typeinfo.CaseInfo; import zserio.runtime.typeinfo.ColumnInfo; import zserio.runtime.typeinfo.FieldInfo; -import zserio.runtime.typeinfo.ParameterInfo; import zserio.runtime.typeinfo.FunctionInfo; -import zserio.runtime.typeinfo.CaseInfo; import zserio.runtime.typeinfo.ItemInfo; +import zserio.runtime.typeinfo.JavaType; import zserio.runtime.typeinfo.MessageInfo; import zserio.runtime.typeinfo.MethodInfo; -import zserio.runtime.ZserioError; -import zserio.runtime.io.BitBuffer; -import zserio.runtime.io.SerializeUtil; +import zserio.runtime.typeinfo.ParameterInfo; +import zserio.runtime.typeinfo.SchemaType; +import zserio.runtime.typeinfo.TableInfo; +import zserio.runtime.typeinfo.TypeInfo; public class WithTypeInfoCodeTest { @@ -67,8 +68,8 @@ public void writeReadFileWithOptionals() throws IOException final WithTypeInfoCode withTypeInfoCode = WithTypeInfoCodeCreator.createWithTypeInfoCode(); SerializeUtil.serializeToFile(withTypeInfoCode, BLOB_NAME_WITH_OPTIONALS); - final WithTypeInfoCode readWithTypeInfoCode = SerializeUtil.deserializeFromFile(WithTypeInfoCode.class, - BLOB_NAME_WITH_OPTIONALS); + final WithTypeInfoCode readWithTypeInfoCode = + SerializeUtil.deserializeFromFile(WithTypeInfoCode.class, BLOB_NAME_WITH_OPTIONALS); assertEquals(withTypeInfoCode, readWithTypeInfoCode); } @@ -80,8 +81,8 @@ public void writeReadFileWithoutOptionals() throws IOException WithTypeInfoCodeCreator.createWithTypeInfoCode(createdOptionals); SerializeUtil.serializeToFile(withTypeInfoCode, BLOB_NAME_WITHOUT_OPTIONALS); - final WithTypeInfoCode readWithTypeInfoCode = SerializeUtil.deserializeFromFile(WithTypeInfoCode.class, - BLOB_NAME_WITHOUT_OPTIONALS); + final WithTypeInfoCode readWithTypeInfoCode = + SerializeUtil.deserializeFromFile(WithTypeInfoCode.class, BLOB_NAME_WITHOUT_OPTIONALS); assertEquals(withTypeInfoCode, readWithTypeInfoCode); } @@ -975,9 +976,9 @@ private void checkComplexStruct(TypeInfo typeInfo) final SimpleStruct simpleStruct = new SimpleStruct((long)0, (long)10, "Text", true, 1.0f, 2.0f, 4.0); final ComplexStruct complexStruct = new ComplexStruct(); complexStruct.setSimpleStruct(simpleStruct); - complexStruct.setArray(new long[] {(long)1 }); + complexStruct.setArray(new long[] {(long)1}); complexStruct.setDynamicBitField(BigInteger.TEN); - final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(simpleStruct); + final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(simpleStruct); complexStruct.setParamStructArray(new ParameterizedStruct[] {parameterizedStruct}); assertEquals("with_type_info_code.ComplexStruct", typeInfo.getSchemaName()); @@ -1186,8 +1187,8 @@ private void checkComplexStruct(TypeInfo typeInfo) assertEquals("setDynamicBitFieldArray", dynamicBitFieldArrayField.getSetterName()); assertEquals("bit<>", dynamicBitFieldArrayField.getTypeInfo().getSchemaName()); - assertEquals(SchemaType.DYNAMIC_UNSIGNED_BITFIELD, - dynamicBitFieldArrayField.getTypeInfo().getSchemaType()); + assertEquals( + SchemaType.DYNAMIC_UNSIGNED_BITFIELD, dynamicBitFieldArrayField.getTypeInfo().getSchemaType()); assertEquals(JavaType.BIG_INTEGER, dynamicBitFieldArrayField.getTypeInfo().getJavaType()); assertEquals(BigInteger.class, dynamicBitFieldArrayField.getTypeInfo().getJavaClass()); @@ -1355,7 +1356,7 @@ private void checkComplexStruct(TypeInfo typeInfo) private void checkParameterizedStruct(TypeInfo typeInfo) { final SimpleStruct simpleStruct = new SimpleStruct((long)0, (long)10, "Text", true, 1.0f, 2.0f, 4.0); - final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(simpleStruct); + final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(simpleStruct); assertEquals("with_type_info_code.ParameterizedStruct", typeInfo.getSchemaName()); assertEquals(SchemaType.STRUCT, typeInfo.getSchemaType()); @@ -1977,8 +1978,7 @@ private void checkTemplatedParameterizedStruct_TS32(TypeInfo typeInfo) final TemplatedParameterizedStruct_TS32 templatedParameterizedStruct_TS32 = new TemplatedParameterizedStruct_TS32(ts32); - assertEquals("with_type_info_code.TemplatedParameterizedStruct_TS32", - typeInfo.getSchemaName()); + assertEquals("with_type_info_code.TemplatedParameterizedStruct_TS32", typeInfo.getSchemaName()); assertEquals(SchemaType.STRUCT, typeInfo.getSchemaType()); assertEquals(JavaType.STRUCT, typeInfo.getJavaType()); assertEquals(TemplatedParameterizedStruct_TS32.class, typeInfo.getJavaClass()); diff --git a/test/arguments/with_validation_code/build.xml b/test/arguments/with_validation_code/build.xml index 31dfc0212..12abbe9ac 100644 --- a/test/arguments/with_validation_code/build.xml +++ b/test/arguments/with_validation_code/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/with_validation_code/java/with_validation_code/BlobTableValidationTest.java b/test/arguments/with_validation_code/java/with_validation_code/BlobTableValidationTest.java index 334ec0767..e45954d92 100644 --- a/test/arguments/with_validation_code/java/with_validation_code/BlobTableValidationTest.java +++ b/test/arguments/with_validation_code/java/with_validation_code/BlobTableValidationTest.java @@ -1,10 +1,6 @@ package with_validation_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,16 +8,20 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import with_validation_code.blob_table_validation.Blob; -import with_validation_code.blob_table_validation.BlobTableValidationDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.SerializeUtil; import zserio.runtime.validation.ValidationReport; +import test_utils.FileUtil; +import test_utils.JdbcUtil; +import with_validation_code.blob_table_validation.Blob; +import with_validation_code.blob_table_validation.BlobTableValidationDb; + public class BlobTableValidationTest { @BeforeAll @@ -68,11 +68,11 @@ private void insertRowWithNoneStandardBlob(Connection connection) throws SQLExce int argIdx = 1; statement.setLong(argIdx++, ROW_ID); - final Blob blob = new Blob(Float.isNaN(NONE_STANDARD_NAN_VALUE), NONE_STANDARD_NAN_VALUE, - END_VALUE); + final Blob blob = + new Blob(Float.isNaN(NONE_STANDARD_NAN_VALUE), NONE_STANDARD_NAN_VALUE, END_VALUE); final byte[] bytesBlob = SerializeUtil.serializeToBytes(blob); - bytesBlob[1] = (byte)0xFF; // none standard NaN - bytesBlob[2] = (byte)0xFF; // set skipped bits + bytesBlob[1] = (byte)0xFF; // none standard NaN + bytesBlob[2] = (byte)0xFF; // set skipped bits statement.setBytes(argIdx++, bytesBlob); statement.setNull(argIdx++, java.sql.Types.BLOB); @@ -81,9 +81,9 @@ private void insertRowWithNoneStandardBlob(Connection connection) throws SQLExce } } - private static final long ROW_ID = 0; + private static final long ROW_ID = 0; private static final float NONE_STANDARD_NAN_VALUE = Float.intBitsToFloat(0xFFFFFFFF); - private static final byte END_VALUE = (byte)0x23; + private static final byte END_VALUE = (byte)0x23; private static final String FILE_NAME = "blob_validation_test.sqlite"; diff --git a/test/arguments/with_validation_code/java/with_validation_code/ColumnTypeValidationTest.java b/test/arguments/with_validation_code/java/with_validation_code/ColumnTypeValidationTest.java index ca7e0b3f2..d5afee40a 100644 --- a/test/arguments/with_validation_code/java/with_validation_code/ColumnTypeValidationTest.java +++ b/test/arguments/with_validation_code/java/with_validation_code/ColumnTypeValidationTest.java @@ -1,30 +1,30 @@ package with_validation_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; -import java.sql.SQLException; +import java.math.BigInteger; import java.sql.PreparedStatement; +import java.sql.SQLException; import java.sql.Statement; -import java.math.BigInteger; -import java.util.List; import java.util.ArrayList; +import java.util.List; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import zserio.runtime.io.SerializeUtil; +import zserio.runtime.validation.ValidationError; +import zserio.runtime.validation.ValidationReport; import test_utils.FileUtil; import test_utils.JdbcUtil; - +import with_validation_code.column_type_validation.Blob; import with_validation_code.column_type_validation.ColumnTypeDb; import with_validation_code.column_type_validation.ColumnTypeTableRow; -import with_validation_code.column_type_validation.Blob; - -import zserio.runtime.validation.ValidationError; -import zserio.runtime.validation.ValidationReport; -import zserio.runtime.io.SerializeUtil; public class ColumnTypeValidationTest { @@ -144,10 +144,8 @@ public void validationBlobWhileIntegerExpected() throws SQLException, IOExceptio { populateDb(database); - try ( - final PreparedStatement statement = database.connection().prepareStatement( - "UPDATE columnTypeTable SET int64Value = ? WHERE id = 2"); - ) + try (final PreparedStatement statement = database.connection().prepareStatement( + "UPDATE columnTypeTable SET int64Value = ? WHERE id = 2");) { final byte[] blobBytes = SerializeUtil.serializeToBytes(new Blob(13)); statement.setBytes(1, blobBytes); @@ -231,10 +229,8 @@ public void validationBlobWhileFloatExpected() throws SQLException, IOException { populateDb(database); - try ( - final PreparedStatement statement = database.connection().prepareStatement( - "UPDATE columnTypeTable SET float16Value = ? WHERE id = 2"); - ) + try (final PreparedStatement statement = database.connection().prepareStatement( + "UPDATE columnTypeTable SET float16Value = ? WHERE id = 2");) { final byte[] blobBytes = SerializeUtil.serializeToBytes(new Blob(13)); statement.setBytes(1, blobBytes); @@ -284,10 +280,8 @@ public void validationBlobWhileStringExpected() throws SQLException, IOException { populateDb(database); - try ( - final PreparedStatement statement = database.connection().prepareStatement( - "UPDATE columnTypeTable SET stringValue = ? WHERE id = 2"); - ) + try (final PreparedStatement statement = database.connection().prepareStatement( + "UPDATE columnTypeTable SET stringValue = ? WHERE id = 2");) { final byte[] blobBytes = SerializeUtil.serializeToBytes(new Blob(13)); statement.setBytes(1, blobBytes); diff --git a/test/arguments/with_validation_code/java/with_validation_code/FullRangeTableValidationTest.java b/test/arguments/with_validation_code/java/with_validation_code/FullRangeTableValidationTest.java index cd28df30a..eb9f1e3c5 100644 --- a/test/arguments/with_validation_code/java/with_validation_code/FullRangeTableValidationTest.java +++ b/test/arguments/with_validation_code/java/with_validation_code/FullRangeTableValidationTest.java @@ -1,23 +1,23 @@ package with_validation_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.SQLException; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import with_validation_code.full_range_table_validation.FullRangeTableValidationDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.validation.ValidationReport; +import test_utils.FileUtil; +import test_utils.JdbcUtil; +import with_validation_code.full_range_table_validation.FullRangeTableValidationDb; + public class FullRangeTableValidationTest { @BeforeAll diff --git a/test/arguments/with_validation_code/java/with_validation_code/HiddenColumnTableValidationTest.java b/test/arguments/with_validation_code/java/with_validation_code/HiddenColumnTableValidationTest.java index 3dfb852f3..a03221788 100644 --- a/test/arguments/with_validation_code/java/with_validation_code/HiddenColumnTableValidationTest.java +++ b/test/arguments/with_validation_code/java/with_validation_code/HiddenColumnTableValidationTest.java @@ -1,23 +1,23 @@ package with_validation_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.SQLException; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import with_validation_code.hidden_column_table_validation.HiddenColumnTableValidationDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.validation.ValidationReport; +import test_utils.FileUtil; +import test_utils.JdbcUtil; +import with_validation_code.hidden_column_table_validation.HiddenColumnTableValidationDb; + public class HiddenColumnTableValidationTest { @BeforeAll diff --git a/test/arguments/with_validation_code/java/with_validation_code/SimpleTableValidationTest.java b/test/arguments/with_validation_code/java/with_validation_code/SimpleTableValidationTest.java index c0f668ed3..10952f586 100644 --- a/test/arguments/with_validation_code/java/with_validation_code/SimpleTableValidationTest.java +++ b/test/arguments/with_validation_code/java/with_validation_code/SimpleTableValidationTest.java @@ -1,33 +1,33 @@ package with_validation_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.Statement; import java.sql.SQLException; +import java.sql.Statement; import java.util.List; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import zserio.runtime.ZserioError; +import zserio.runtime.io.SerializeUtil; +import zserio.runtime.validation.ValidationError; +import zserio.runtime.validation.ValidationReport; + import test_utils.FileUtil; import test_utils.JdbcUtil; - import with_validation_code.simple_table_validation.RootStruct; import with_validation_code.simple_table_validation.SimpleTable; import with_validation_code.simple_table_validation.SimpleTableValidationDb; -import with_validation_code.simple_table_validation.TestEnum; import with_validation_code.simple_table_validation.TestBitmask; - -import zserio.runtime.ZserioError; -import zserio.runtime.io.SerializeUtil; -import zserio.runtime.validation.ValidationError; -import zserio.runtime.validation.ValidationReport; +import with_validation_code.simple_table_validation.TestEnum; public class SimpleTableValidationTest { @@ -88,8 +88,7 @@ public void validationBlobFailure() throws SQLException assertEquals("simpleTable", error.getTableName()); assertEquals("fieldBlob", error.getFieldName()); assertEquals(ValidationError.Type.BLOB_PARSE_FAILED, error.getType()); - assertEquals("Read: Wrong offset for field RootStruct.end: 14 != 4278190094!", - error.getMessage()); + assertEquals("Read: Wrong offset for field RootStruct.end: 14 != 4278190094!", error.getMessage()); final StackTraceElement[] stackTrace = error.getStackTrace(); assertNotNull(stackTrace); @@ -134,8 +133,7 @@ public void extraColumn() throws SQLException assertEquals("extraColumn", error.getFieldName()); assertEquals(null, error.getRowKeyValues()); assertEquals(ValidationError.Type.COLUMN_SUPERFLUOUS, error.getType()); - assertEquals("superfluous column simpleTable.extraColumn of type TEXT encountered", - error.getMessage()); + assertEquals("superfluous column simpleTable.extraColumn of type TEXT encountered", error.getMessage()); final StackTraceElement[] stackTrace = error.getStackTrace(); assertNotNull(stackTrace); @@ -150,12 +148,12 @@ public void missingColumn() throws SQLException { populateDb(database.connection(), new TestParameterProvider(), false); - executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + - "fieldBool INTEGER NOT NULL, fieldDynamicBit INTEGER NOT NULL, " + - "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " + - "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldDynamicBit, fieldVarInt16, " + - "fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); + executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + + "fieldBool INTEGER NOT NULL, fieldDynamicBit INTEGER NOT NULL, " + + "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " + + "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); + executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldDynamicBit, fieldVarInt16, " + + "fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); executeUpdate("DROP TABLE simpleTable"); executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -188,12 +186,12 @@ public void wrongColumnType() throws SQLException { populateDb(database.connection(), new TestParameterProvider(), false); - executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + - "fieldBool INTEGER NOT NULL, fieldBit5 TEXT, fieldDynamicBit INTEGER NOT NULL, " + - "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " + - "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + - "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); + executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + + "fieldBool INTEGER NOT NULL, fieldBit5 TEXT, fieldDynamicBit INTEGER NOT NULL, " + + "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " + + "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); + executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + + "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); executeUpdate("DROP TABLE simpleTable"); executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -211,8 +209,8 @@ public void wrongColumnType() throws SQLException assertEquals("fieldBit5", error.getFieldName()); assertEquals(null, error.getRowKeyValues()); assertEquals(ValidationError.Type.INVALID_COLUMN_TYPE, error.getType()); - assertEquals("column SimpleTable.fieldBit5 has type 'TEXT' but 'INTEGER' is expected", - error.getMessage()); + assertEquals( + "column SimpleTable.fieldBit5 has type 'TEXT' but 'INTEGER' is expected", error.getMessage()); final StackTraceElement[] stackTrace = error.getStackTrace(); assertNotNull(stackTrace); @@ -227,12 +225,12 @@ public void wrongColumnNotNullConstraint() throws SQLException { populateDb(database.connection(), new TestParameterProvider(), false); - executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + - "fieldBool INTEGER NOT NULL, fieldBit5 INTEGER NOT NULL, fieldDynamicBit INTEGER NOT NULL, " + - "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB, " + - "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + - "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); + executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER PRIMARY KEY NOT NULL, " + + "fieldBool INTEGER NOT NULL, fieldBit5 INTEGER NOT NULL, fieldDynamicBit INTEGER NOT NULL, " + + "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB, " + + "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); + executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + + "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); executeUpdate("DROP TABLE simpleTable"); executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -250,16 +248,18 @@ public void wrongColumnNotNullConstraint() throws SQLException assertEquals("fieldBit5", error.getFieldName()); assertEquals(null, error.getRowKeyValues()); assertEquals(ValidationError.Type.INVALID_COLUMN_CONSTRAINT, error.getType()); - assertEquals("column SimpleTable.fieldBit5 is NOT NULL-able, but the column is expected to be " + - "NULL-able", error.getMessage()); + assertEquals("column SimpleTable.fieldBit5 is NOT NULL-able, but the column is expected to be " + + "NULL-able", + error.getMessage()); error = errors.get(1); assertEquals("simpleTable", error.getTableName()); assertEquals("fieldBlob", error.getFieldName()); assertEquals(null, error.getRowKeyValues()); assertEquals(ValidationError.Type.INVALID_COLUMN_CONSTRAINT, error.getType()); - assertEquals("column SimpleTable.fieldBlob is NULL-able, but the column is expected to be " + - "NOT NULL-able", error.getMessage()); + assertEquals("column SimpleTable.fieldBlob is NULL-able, but the column is expected to be " + + "NOT NULL-able", + error.getMessage()); final StackTraceElement[] stackTrace = error.getStackTrace(); assertNotNull(stackTrace); @@ -274,12 +274,12 @@ public void wrongColumnPrimaryKeyConstraint() throws SQLException { populateDb(database.connection(), new TestParameterProvider(), false); - executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER NOT NULL, " + - "fieldBool INTEGER NOT NULL, fieldBit5 INTEGER, fieldDynamicBit INTEGER NOT NULL, " + - "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " + - "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); - executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + - "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); + executeUpdate("CREATE TABLE simpleTableTemp (rowid INTEGER NOT NULL, " + + "fieldBool INTEGER NOT NULL, fieldBit5 INTEGER, fieldDynamicBit INTEGER NOT NULL, " + + "fieldVarInt16 INTEGER NOT NULL, fieldString TEXT NOT NULL, fieldBlob BLOB NOT NULL, " + + "fieldEnum INTEGER, fieldBitmask INTEGER NOT NULL)"); + executeUpdate("INSERT INTO simpleTableTemp SELECT rowid, fieldBool, fieldBit5, fieldDynamicBit, " + + "fieldVarInt16, fieldString, fieldBlob, fieldEnum, fieldBitmask FROM simpleTable"); executeUpdate("DROP TABLE simpleTable"); executeUpdate("ALTER TABLE simpleTableTemp RENAME TO simpleTable"); @@ -297,8 +297,9 @@ public void wrongColumnPrimaryKeyConstraint() throws SQLException assertEquals("rowid", error.getFieldName()); assertEquals(null, error.getRowKeyValues()); assertEquals(ValidationError.Type.INVALID_COLUMN_CONSTRAINT, error.getType()); - assertEquals("column SimpleTable.rowid is not primary key, but the column is expected to be " + - "primary key", error.getMessage()); + assertEquals("column SimpleTable.rowid is not primary key, but the column is expected to be " + + "primary key", + error.getMessage()); final StackTraceElement[] stackTrace = error.getStackTrace(); assertNotNull(stackTrace); @@ -313,12 +314,11 @@ public void outOfRange() throws SQLException { populateDb(database.connection(), new TestParameterProvider(), false); - executeUpdate("UPDATE simpleTable SET fieldBit5 = 32 WHERE rowid = " + - FIELD_BIT5_OUT_OF_RANGE_ROW_ID); + executeUpdate("UPDATE simpleTable SET fieldBit5 = 32 WHERE rowid = " + FIELD_BIT5_OUT_OF_RANGE_ROW_ID); executeUpdate("UPDATE simpleTable SET fieldVarInt16 = 16384 WHERE rowid = " + FIELD_VARINT16_OUT_OF_RANGE_ROW_ID); - executeUpdate("UPDATE simpleTable SET fieldBitmask = -1 WHERE rowid = " + - FIELD_BITMASK_OUT_OF_RANGE_ROW_ID); + executeUpdate( + "UPDATE simpleTable SET fieldBitmask = -1 WHERE rowid = " + FIELD_BITMASK_OUT_OF_RANGE_ROW_ID); final TestParameterProvider parameterProvider = new TestParameterProvider(); final ValidationReport report = database.validate(parameterProvider); @@ -360,7 +360,6 @@ public void outOfRange() throws SQLException assertEquals(ValidationError.Type.VALUE_OUT_OF_RANGE, error.getType()); assertEquals("Value -1 of SimpleTable.fieldBitmask exceeds the range of 0..255", error.getMessage()); - final StackTraceElement[] stackTrace = error.getStackTrace(); assertNotNull(stackTrace); // 0 is Thread.getStackTrace, 1 is zserio.runtime.validation.ValidationError. @@ -409,8 +408,8 @@ public void invalidEnumValue() throws SQLException assertEquals("", stackTrace[1].getMethodName()); } - private void populateDb(Connection connection, TestParameterProvider parameterProvider, - boolean wrongOffset) throws SQLException + private void populateDb(Connection connection, TestParameterProvider parameterProvider, boolean wrongOffset) + throws SQLException { for (byte id = 0; id < ENTRY_COUNT; id++) { @@ -420,12 +419,12 @@ private void populateDb(Connection connection, TestParameterProvider parameterPr } } - private void insertTestRow(Connection connection, TestParameterProvider parameterProvider, - byte id, boolean wrongOffset) throws SQLException + private void insertTestRow(Connection connection, TestParameterProvider parameterProvider, byte id, + boolean wrongOffset) throws SQLException { final byte fieldBit5 = (byte)(id + 1); final long fieldDynamicBit = id; - final short fieldVarInt16 = id; + final short fieldVarInt16 = id; final String fieldString = "Test" + id; final RootStruct fieldBlob = createTestRootStruct((int)SIMPLE_TABLE_LOCAL_COUNT, id); final TestEnum fieldEnum = (id == FIELD_ENUM_RED_ROW_ID) ? TestEnum.RED : TestEnum.BLUE; @@ -456,9 +455,9 @@ private void insertRow(Connection connection, long id, boolean fieldBool, byte f * Populate the test DB. */ final String sql = - "INSERT INTO simpleTable (rowid, fieldBool, fieldBit5, fieldDynamicBit, fieldVarInt16, " + - "fieldString, fieldBlob, fieldEnum, fieldBitmask) " + - "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; + "INSERT INTO simpleTable (rowid, fieldBool, fieldBit5, fieldDynamicBit, fieldVarInt16, " + + "fieldString, fieldBlob, fieldEnum, fieldBitmask) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; try (final PreparedStatement statement = connection.prepareStatement(sql)) { diff --git a/test/arguments/with_validation_code/java/with_validation_code/VirtualTableValidationTest.java b/test/arguments/with_validation_code/java/with_validation_code/VirtualTableValidationTest.java index cf2f9cdaa..fecd57006 100644 --- a/test/arguments/with_validation_code/java/with_validation_code/VirtualTableValidationTest.java +++ b/test/arguments/with_validation_code/java/with_validation_code/VirtualTableValidationTest.java @@ -1,26 +1,25 @@ package with_validation_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; - -import java.sql.SQLException; import java.sql.Connection; import java.sql.PreparedStatement; +import java.sql.SQLException; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import with_validation_code.virtual_table_validation.VirtualTableValidationDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.validation.ValidationReport; +import test_utils.FileUtil; +import test_utils.JdbcUtil; +import with_validation_code.virtual_table_validation.VirtualTableValidationDb; + public class VirtualTableValidationTest { @BeforeAll diff --git a/test/arguments/without_cross_extension_check/build.xml b/test/arguments/without_cross_extension_check/build.xml index 2ecc96034..24c5ea130 100644 --- a/test/arguments/without_cross_extension_check/build.xml +++ b/test/arguments/without_cross_extension_check/build.xml @@ -28,7 +28,11 @@ - + + + + + diff --git a/test/arguments/without_cross_extension_check/java/without_cross_extension_check/WithoutCrossExtensionCheckTest.java b/test/arguments/without_cross_extension_check/java/without_cross_extension_check/WithoutCrossExtensionCheckTest.java index c2adc73ec..25d052087 100644 --- a/test/arguments/without_cross_extension_check/java/without_cross_extension_check/WithoutCrossExtensionCheckTest.java +++ b/test/arguments/without_cross_extension_check/java/without_cross_extension_check/WithoutCrossExtensionCheckTest.java @@ -1,6 +1,7 @@ package without_cross_extension_check; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; public class WithoutCrossExtensionCheckTest diff --git a/test/arguments/without_pubsub_code/build.xml b/test/arguments/without_pubsub_code/build.xml index b2337ba45..c56a31fbe 100644 --- a/test/arguments/without_pubsub_code/build.xml +++ b/test/arguments/without_pubsub_code/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/without_pubsub_code/java/without_pubsub_code/WithoutPubsubCodeTest.java b/test/arguments/without_pubsub_code/java/without_pubsub_code/WithoutPubsubCodeTest.java index 6a87dcd18..b93a9175a 100644 --- a/test/arguments/without_pubsub_code/java/without_pubsub_code/WithoutPubsubCodeTest.java +++ b/test/arguments/without_pubsub_code/java/without_pubsub_code/WithoutPubsubCodeTest.java @@ -1,10 +1,11 @@ package without_pubsub_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; +import org.junit.jupiter.api.Test; + public class WithoutPubsubCodeTest { @Test diff --git a/test/arguments/without_service_code/build.xml b/test/arguments/without_service_code/build.xml index eca6e3232..b26086c4a 100644 --- a/test/arguments/without_service_code/build.xml +++ b/test/arguments/without_service_code/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/without_service_code/java/without_service_code/WithoutServiceCodeTest.java b/test/arguments/without_service_code/java/without_service_code/WithoutServiceCodeTest.java index c67dc1f71..7c90961ec 100644 --- a/test/arguments/without_service_code/java/without_service_code/WithoutServiceCodeTest.java +++ b/test/arguments/without_service_code/java/without_service_code/WithoutServiceCodeTest.java @@ -1,10 +1,11 @@ package without_service_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; +import org.junit.jupiter.api.Test; + public class WithoutServiceCodeTest { @Test diff --git a/test/arguments/without_writer_code/build.xml b/test/arguments/without_writer_code/build.xml index c783b73ca..806ab96a0 100644 --- a/test/arguments/without_writer_code/build.xml +++ b/test/arguments/without_writer_code/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java b/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java index 79ae6d2bf..69ad4b7aa 100644 --- a/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java +++ b/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java @@ -1,10 +1,9 @@ package without_writer_code; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import static test_utils.AssertionUtils.assertMethodPresent; import static test_utils.AssertionUtils.assertMethodNotPresent; +import static test_utils.AssertionUtils.assertMethodPresent; import java.io.File; import java.io.FileOutputStream; @@ -14,13 +13,15 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; -import java.sql.Statement; import java.sql.SQLException; +import java.sql.Statement; import java.util.HashSet; import java.util.List; import java.util.Properties; import java.util.Set; +import org.junit.jupiter.api.Test; + import zserio.runtime.BitPositionUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.BitStreamWriter; @@ -232,8 +233,8 @@ public void readConstructor() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writeTile(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Tile tile = new Tile(reader); checkTile(tile); } @@ -258,10 +259,7 @@ public void readFile() throws IOException @Test public void readWorldDb() throws SQLException, IOException { - try ( - final Connection connection = createWorldDb(); - final WorldDb worldDb = new WorldDb(connection); - ) + try (final Connection connection = createWorldDb(); final WorldDb worldDb = new WorldDb(connection);) { final GeoMapTable europe = worldDb.getEurope(); final List europeRows = europe.read(); @@ -290,27 +288,23 @@ private Connection createWorldDb() throws SQLException, IOException try (final Statement statement = connection.createStatement()) { statement.executeUpdate("CREATE TABLE europe(tileId INTEGER PRIMARY KEY, tile BLOB)"); - statement.executeUpdate( "CREATE TABLE america(tileId INTEGER PRIMARY KEY, tile BLOB)"); + statement.executeUpdate("CREATE TABLE america(tileId INTEGER PRIMARY KEY, tile BLOB)"); } final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writeTile(writer); final byte[] tileBytes = writer.toByteArray(); - try ( - final PreparedStatement stmtEurope = connection.prepareStatement( - "INSERT INTO europe VALUES (?, ?)"); - ) + try (final PreparedStatement stmtEurope = connection.prepareStatement( + "INSERT INTO europe VALUES (?, ?)");) { stmtEurope.setInt(1, TILE_ID_EUROPE); stmtEurope.setBytes(2, tileBytes); stmtEurope.executeUpdate(); } - try ( - final PreparedStatement stmtAmerica = connection.prepareStatement( - "INSERT INTO america VALUES (?, ?)"); - ) + try (final PreparedStatement stmtAmerica = connection.prepareStatement( + "INSERT INTO america VALUES (?, ?)");) { stmtAmerica.setInt(1, TILE_ID_AMERICA); stmtAmerica.setBytes(2, tileBytes); @@ -345,13 +339,13 @@ private void writeTile(BitStreamWriter writer) throws IOException { writer.alignTo(8); // aligned because of indexed offsets // ItemChoiceHolder - final boolean hasItem = i %2 == 0; // hasItem == true for even elements + final boolean hasItem = i % 2 == 0; // hasItem == true for even elements writer.writeBool(hasItem); if (hasItem) { // Item writer.writeBits((long)PARAMS[i], 16); - //ExtraParamUnion - choiceTag CHOICE_value32 + // ExtraParamUnion - choiceTag CHOICE_value32 writer.writeVarSize(ExtraParamUnion.CHOICE_value32); writer.writeBits(EXTRA_PARAM, 32); } @@ -394,6 +388,6 @@ private void checkTile(Tile tile) private static final short VERSION = 8; private static final byte VERSION_AVAILABILITY = 1; private static final long NUM_ELEMENTS = 2; - private static final int PARAMS[] = { 13, 21 }; + private static final int PARAMS[] = {13, 21}; private static final long EXTRA_PARAM = 42; } diff --git a/test/build.xml b/test/build.xml index 425b78b89..47fe0dcd5 100644 --- a/test/build.xml +++ b/test/build.xml @@ -8,6 +8,7 @@ zserio.release_dir - Directory where to find Zserio release to test zserio_java_test.build_root_dir - Build directory where to put generated files. Default is "../build/test/java". zserio_java_test.test_suites - Test suites. Default is "**". +clang_format.exe_file - Clang-format executable file. If not set, clang-format is not run. spotbugs.home_dir - Location of the spotbugs tool. If not set, spotbugs is not run. --> @@ -193,6 +194,25 @@ spotbugs.home_dir - Location of the spotbugs tool. If not set, spo + + + + + + Command hints to reformat source using clang-format tool: + git clang-format + clang-format --style=file -i [SOURCE] + + + + + + + + + + + diff --git a/test/errors/alignment_error/build.xml b/test/errors/alignment_error/build.xml index bb6a94795..00378812d 100644 --- a/test/errors/alignment_error/build.xml +++ b/test/errors/alignment_error/build.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/test/errors/alignment_error/java/alignment_error/AlignmentErrorTest.java b/test/errors/alignment_error/java/alignment_error/AlignmentErrorTest.java index 8389f2d35..94561c2ad 100644 --- a/test/errors/alignment_error/java/alignment_error/AlignmentErrorTest.java +++ b/test/errors/alignment_error/java/alignment_error/AlignmentErrorTest.java @@ -1,11 +1,12 @@ package alignment_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class AlignmentErrorTest @@ -27,24 +28,24 @@ public void fieldAlignment() @Test public void negativeIntegerAlignment() { - final String error = "negative_integer_alignment_error.zs:5:7: Alignment expression for field " + - "'field' is not positive integer!"; + final String error = "negative_integer_alignment_error.zs:5:7: Alignment expression for field " + + "'field' is not positive integer!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void noIntegerAlignment() { - final String error = "no_integer_alignment_error.zs:5:7: Alignment expression for field 'field' " + - "is not positive integer!"; + final String error = "no_integer_alignment_error.zs:5:7: Alignment expression for field 'field' " + + "is not positive integer!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void tooBigAlignment() { - final String error = "too_big_alignment_error.zs:5:7: Alignment expression for field 'field' " + - "is bigger than integer max value (2147483647)!"; + final String error = "too_big_alignment_error.zs:5:7: Alignment expression for field 'field' " + + "is bigger than integer max value (2147483647)!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/array_types_error/build.xml b/test/errors/array_types_error/build.xml index 30c26715d..d9e1adfa0 100644 --- a/test/errors/array_types_error/build.xml +++ b/test/errors/array_types_error/build.xml @@ -75,7 +75,11 @@ - + + + + + diff --git a/test/errors/array_types_error/java/array_types_error/ArrayTypesErrorTest.java b/test/errors/array_types_error/java/array_types_error/ArrayTypesErrorTest.java index 053e05781..07fe21c85 100644 --- a/test/errors/array_types_error/java/array_types_error/ArrayTypesErrorTest.java +++ b/test/errors/array_types_error/java/array_types_error/ArrayTypesErrorTest.java @@ -1,11 +1,12 @@ package array_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ArrayTypesErrorTest @@ -19,169 +20,153 @@ public static void readZserioErrors() throws IOException @Test public void arrayLengthNotAvailable() { - final String error = "array_length_field_not_available_error.zs:7:18: " + - "Unresolved symbol 'array2Size' within expression scope!"; + final String error = "array_length_field_not_available_error.zs:7:18: " + + "Unresolved symbol 'array2Size' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void deprecatedImplicitArray() { - final String errors[] = - { - "deprecated_implicit_array_error.zs:5:5: For strong compatibility reason, please consider " + - "to use command line option '-allowImplicitArrays'.", - "deprecated_implicit_array_error.zs:5:5: Implicit arrays are deprecated and will be removed from " + - "the language!" - }; + final String errors[] = { + "deprecated_implicit_array_error.zs:5:5: For strong compatibility reason, please consider " + + "to use command line option '-allowImplicitArrays'.", + "deprecated_implicit_array_error.zs:5:5: Implicit arrays are deprecated and will be removed from " + + "the language!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void implicitArrayBitfieldWithWrongLength() { - final String error = "implicit_array_bitfield_with_wrong_length_error.zs:5:14: " + - "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; + final String error = "implicit_array_bitfield_with_wrong_length_error.zs:5:14: " + + "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayBool() { - final String error = "implicit_array_bool_error.zs:5:14: " + - "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; + final String error = "implicit_array_bool_error.zs:5:14: " + + "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayComplexWithFieldBehind() { - final String errors[] = - { - "implicit_array_complex_with_field_behind_error.zs:6:21: implicit array is used here", - "implicit_array_complex_with_field_behind_error.zs:12:24: implicit array is used here", - "implicit_array_complex_with_field_behind_error.zs:19:37: implicit array is used here", - "implicit_array_complex_with_field_behind_error.zs:41:40: implicit array is used here", - "implicit_array_complex_with_field_behind_error.zs:44:12: Field 'field' follows an implicit array!" - }; + final String errors[] = { + "implicit_array_complex_with_field_behind_error.zs:6:21: implicit array is used here", + "implicit_array_complex_with_field_behind_error.zs:12:24: implicit array is used here", + "implicit_array_complex_with_field_behind_error.zs:19:37: implicit array is used here", + "implicit_array_complex_with_field_behind_error.zs:41:40: implicit array is used here", + "implicit_array_complex_with_field_behind_error.zs:44:12: Field 'field' follows an implicit array!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void implicitArrayCompound() { - final String error = "implicit_array_compound_error.zs:10:14: " + - "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; + final String error = "implicit_array_compound_error.zs:10:14: " + + "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayDynamicBitfield() { - final String error = "implicit_array_dynamic_bitfield_error.zs:6:14: " + - "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; + final String error = "implicit_array_dynamic_bitfield_error.zs:6:14: " + + "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayNotLast() { - final String errors[] = - { - "implicit_array_not_last_error.zs:5:21: implicit array is used here", - "implicit_array_not_last_error.zs:6:21: Field 'wrong' follows an implicit array!" - }; + final String errors[] = {"implicit_array_not_last_error.zs:5:21: implicit array is used here", + "implicit_array_not_last_error.zs:6:21: Field 'wrong' follows an implicit array!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void implicitArrayString() { - final String error = "implicit_array_string_error.zs:5:14: " + - "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; + final String error = "implicit_array_string_error.zs:5:14: " + + "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayStructNotLast() { - final String errors[] = - { - "implicit_array_struct_not_last_error.zs:6:20: implicit array is used here", - "implicit_array_struct_not_last_error.zs:11:24: implicit array is used here", - "implicit_array_struct_not_last_error.zs:12:12: Field 'anotherField' follows an implicit array!" - }; + final String errors[] = { + "implicit_array_struct_not_last_error.zs:6:20: implicit array is used here", + "implicit_array_struct_not_last_error.zs:11:24: implicit array is used here", + "implicit_array_struct_not_last_error.zs:12:12: Field 'anotherField' follows an implicit array!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void implicitArrayVarint() { - final String error = "implicit_array_varint_error.zs:5:14: " + - "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; + final String error = "implicit_array_varint_error.zs:5:14: " + + "Implicit arrays are allowed only for types which have fixed size rounded to bytes!"; assertTrue(zserioErrors.isPresent(error)); } - @Test public void implicitArrayWithAutoArrayBehind() { - final String errors[] = - { - "implicit_array_with_auto_array_behind_error.zs:5:21: implicit array is used here", - "implicit_array_with_auto_array_behind_error.zs:10:24: implicit array is used here", - "implicit_array_with_auto_array_behind_error.zs:11:12: Field 'array' follows an implicit array!" - }; + final String errors[] = { + "implicit_array_with_auto_array_behind_error.zs:5:21: implicit array is used here", + "implicit_array_with_auto_array_behind_error.zs:10:24: implicit array is used here", + "implicit_array_with_auto_array_behind_error.zs:11:12: Field 'array' follows an implicit array!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void implicitArrayWithAutoOptionalBehind() { - final String errors[] = - { - "implicit_array_with_auto_optional_behind_error.zs:5:21: implicit array is used here", - "implicit_array_with_auto_optional_behind_error.zs:10:24: implicit array is used here", - "implicit_array_with_auto_optional_behind_error.zs:11:21: " + - "Field 'autoOptional' follows an implicit array!" - }; + final String errors[] = { + "implicit_array_with_auto_optional_behind_error.zs:5:21: implicit array is used here", + "implicit_array_with_auto_optional_behind_error.zs:10:24: implicit array is used here", + "implicit_array_with_auto_optional_behind_error.zs:11:21: " + + "Field 'autoOptional' follows an implicit array!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void implicitArrayWithLength() { - final String error = "implicit_array_with_length_error.zs:6:27: Length expression is not allowed " + - "for implicit arrays!"; + final String error = "implicit_array_with_length_error.zs:6:27: Length expression is not allowed " + + "for implicit arrays!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayWithIndexedOffsets() { - final String error = "implicit_array_with_indexed_offsets_error.zs:22:9: " + - "Implicit arrays cannot have indexed offsets!"; + final String error = "implicit_array_with_indexed_offsets_error.zs:22:9: " + + "Implicit arrays cannot have indexed offsets!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitArrayWithPackedArrayBehind() { - final String errors[] = - { - "implicit_array_with_packed_array_behind_error.zs:5:21: implicit array is used here", - "implicit_array_with_packed_array_behind_error.zs:24:24: implicit array is used here", - "implicit_array_with_packed_array_behind_error.zs:28:26: " + - "Field 'packedArray3' follows an implicit array!" - }; + final String errors[] = { + "implicit_array_with_packed_array_behind_error.zs:5:21: implicit array is used here", + "implicit_array_with_packed_array_behind_error.zs:24:24: implicit array is used here", + "implicit_array_with_packed_array_behind_error.zs:28:26: " + + "Field 'packedArray3' follows an implicit array!"}; assertTrue(zserioErrors.isPresent(errors)); }; @Test public void nonEmptyArrayRecursion() { - final String error = "non_empty_array_recursion_error.zs:9:33: " + - "Field 'array3' is recursive and neither optional nor array which can be empty!"; + final String error = "non_empty_array_recursion_error.zs:9:33: " + + "Field 'array3' is recursive and neither optional nor array which can be empty!"; assertTrue(zserioErrors.isPresent(error)); } @@ -195,8 +180,8 @@ public void packedImplicitArray() @Test public void wrongArrayLengthType() { - final String error = "wrong_array_length_type_error.zs:6:21: Invalid length expression for array. " + - "Length must be integer!"; + final String error = "wrong_array_length_type_error.zs:6:21: Invalid length expression for array. " + + "Length must be integer!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/bitmask_types_error/build.xml b/test/errors/bitmask_types_error/build.xml index 4790e7150..97dc8c0bf 100644 --- a/test/errors/bitmask_types_error/build.xml +++ b/test/errors/bitmask_types_error/build.xml @@ -37,7 +37,11 @@ - + + + + + diff --git a/test/errors/bitmask_types_error/java/bitmask_types_error/BitmaskTypesErrorTest.java b/test/errors/bitmask_types_error/java/bitmask_types_error/BitmaskTypesErrorTest.java index 67231b418..6037e7821 100644 --- a/test/errors/bitmask_types_error/java/bitmask_types_error/BitmaskTypesErrorTest.java +++ b/test/errors/bitmask_types_error/java/bitmask_types_error/BitmaskTypesErrorTest.java @@ -1,11 +1,12 @@ package bitmask_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class BitmaskTypesErrorTest @@ -19,8 +20,7 @@ public static void readZserioErrors() throws IOException @Test public void bitmaskTypeValueError() { - final String error = - "bitmask_type_value_error.zs:7:18: Bitmask value 'WRITE' is not an integral type!"; + final String error = "bitmask_type_value_error.zs:7:18: Bitmask value 'WRITE' is not an integral type!"; assertTrue(zserioErrors.isPresent(error)); } @@ -35,16 +35,16 @@ public void cyclicDefinition() @Test public void cyclicDefinitionUsingBitmaskValue() { - final String error = "cyclic_definition_using_bitmask_value_error.zs:7:21: " + - "'WRITE' undefined in bitmask 'OtherPermissions'!"; + final String error = "cyclic_definition_using_bitmask_value_error.zs:7:21: " + + "'WRITE' undefined in bitmask 'OtherPermissions'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cyclicDefinitionUsingConstant() { - final String error = "cyclic_definition_using_constant_error.zs:8:13: " + - "Cyclic dependency detected in expression evaluation!"; + final String error = "cyclic_definition_using_constant_error.zs:8:13: " + + "Cyclic dependency detected in expression evaluation!"; assertTrue(zserioErrors.isPresent(error)); } @@ -59,60 +59,57 @@ public void duplicatedBitmaskValue() @Test public void duplicatedBitmaskValueName() { - final String errors[] = - { - "duplicated_bitmask_value_name_error.zs:6:5: First defined here", - "duplicated_bitmask_value_name_error.zs:7:5: 'READ' is already defined in this scope!" - }; + final String errors[] = {"duplicated_bitmask_value_name_error.zs:6:5: First defined here", + "duplicated_bitmask_value_name_error.zs:7:5: 'READ' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void int32Bitmask() { - final String error = "int32_bitmask_error.zs:3:15: " + - "Bitmask 'IntBitmask' cannot use int32 type! Only unsigned integer types are allowed!"; + final String error = "int32_bitmask_error.zs:3:15: " + + "Bitmask 'IntBitmask' cannot use int32 type! Only unsigned integer types are allowed!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void notAvailableBitmaskValue() { - final String error = "not_available_bitmask_value_error.zs:6:26: " + - "'BLACK' undefined in bitmask 'NotAvailableBitmaskValue'!"; + final String error = "not_available_bitmask_value_error.zs:6:26: " + + "'BLACK' undefined in bitmask 'NotAvailableBitmaskValue'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void outOfRangeBitmaskExplicitValue() { - final String error = "out_of_range_bitmask_value_error.zs:7:5: " + - "Bitmask 'WRITE' has value (256) out of range <0,255>!"; + final String error = "out_of_range_bitmask_value_error.zs:7:5: " + + "Bitmask 'WRITE' has value (256) out of range <0,255>!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void outOfRangeBitmaskNegativeValue() { - final String error = "out_of_range_bitmask_negative_value_error.zs:7:18: " + - "Bitmask value 'WRITE(-1) cannot be negative!"; + final String error = "out_of_range_bitmask_negative_value_error.zs:7:18: " + + "Bitmask value 'WRITE(-1) cannot be negative!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void outOfRangeBitmaskValue() { - final String error = "out_of_range_bitmask_explicit_value_error.zs:7:18: " + - "Bitmask 'WRITE' has value (256) out of range <0,255>!"; + final String error = "out_of_range_bitmask_explicit_value_error.zs:7:18: " + + "Bitmask 'WRITE' has value (256) out of range <0,255>!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void stringBitmaskError() { - final String error = "string_bitmask_error.zs:3:16: " + - "Bitmask 'StringBitmask' cannot use string type! " + - "Only unsigned integer types are allowed!"; + final String error = "string_bitmask_error.zs:3:16: " + + "Bitmask 'StringBitmask' cannot use string type! " + + "Only unsigned integer types are allowed!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/builtin_types_error/build.xml b/test/errors/builtin_types_error/build.xml index 1610b897e..051b93289 100644 --- a/test/errors/builtin_types_error/build.xml +++ b/test/errors/builtin_types_error/build.xml @@ -31,7 +31,11 @@ - + + + + + diff --git a/test/errors/builtin_types_error/java/builtin_types_error/BuiltInTypesErrorTest.java b/test/errors/builtin_types_error/java/builtin_types_error/BuiltInTypesErrorTest.java index d3f919074..5386ae00a 100644 --- a/test/errors/builtin_types_error/java/builtin_types_error/BuiltInTypesErrorTest.java +++ b/test/errors/builtin_types_error/java/builtin_types_error/BuiltInTypesErrorTest.java @@ -1,11 +1,12 @@ package builtin_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class BuiltInTypesErrorTest @@ -19,32 +20,32 @@ public static void readZserioErrors() throws IOException @Test public void bitfieldCyclicDefinition() { - final String error = "bitfield_cyclic_definition_error.zs:3:11: Cyclic dependency detected in " + - "expression evaluation!"; + final String error = "bitfield_cyclic_definition_error.zs:3:11: Cyclic dependency detected in " + + "expression evaluation!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void bitfieldInvalidLengthType() { - final String error = "bitfield_invalid_length_type_error.zs:6:9: Invalid length expression for " + - "bit field. Length must be integer!"; + final String error = "bitfield_invalid_length_type_error.zs:6:9: Invalid length expression for " + + "bit field. Length must be integer!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void bitfieldLengthFieldNotAvailable() { - final String error = "bitfield_length_field_not_available_error.zs:8:9: " + - "Unresolved symbol 'prevBitfieldLength' within expression scope!"; + final String error = "bitfield_length_field_not_available_error.zs:8:9: " + + "Unresolved symbol 'prevBitfieldLength' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void bitfieldUnknownLength() { - final String error = "bitfield_unknown_length_error.zs:5:9: " + - "Unresolved symbol 'unknownLength' within expression scope!"; + final String error = "bitfield_unknown_length_error.zs:5:9: " + + "Unresolved symbol 'unknownLength' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @@ -58,16 +59,16 @@ public void bitfieldWithoutArg() @Test public void bitfield0() { - final String error = "bitfield0_error.zs:5:9: Invalid length '0' for the dynamic bit field. " + - "Length must be within range [1,64]!"; + final String error = "bitfield0_error.zs:5:9: Invalid length '0' for the dynamic bit field. " + + "Length must be within range [1,64]!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void bitfield65() { - final String error = "bitfield65_error.zs:5:9: Invalid length '65' for the dynamic bit field. " + - "Length must be within range [1,64]!"; + final String error = "bitfield65_error.zs:5:9: Invalid length '65' for the dynamic bit field. " + + "Length must be within range [1,64]!"; assertTrue(zserioErrors.isPresent(error)); } @@ -89,16 +90,16 @@ public void intfieldWithoutArg() @Test public void intfield0() { - final String error = "intfield0_error.zs:5:9: Invalid length '0' for the dynamic bit field. " + - "Length must be within range [1,64]!"; + final String error = "intfield0_error.zs:5:9: Invalid length '0' for the dynamic bit field. " + + "Length must be within range [1,64]!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void intfield65() { - final String error = "intfield65_error.zs:5:9: Invalid length '65' for the dynamic bit field. " + - "Length must be within range [1,64]!"; + final String error = "intfield65_error.zs:5:9: Invalid length '65' for the dynamic bit field. " + + "Length must be within range [1,64]!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/choice_types_error/build.xml b/test/errors/choice_types_error/build.xml index 39c4ad156..098416adf 100644 --- a/test/errors/choice_types_error/build.xml +++ b/test/errors/choice_types_error/build.xml @@ -38,7 +38,11 @@ - + + + + + diff --git a/test/errors/choice_types_error/java/choice_types_error/ChoiceTypesErrorTest.java b/test/errors/choice_types_error/java/choice_types_error/ChoiceTypesErrorTest.java index fbe7f9f8c..41ed64e12 100644 --- a/test/errors/choice_types_error/java/choice_types_error/ChoiceTypesErrorTest.java +++ b/test/errors/choice_types_error/java/choice_types_error/ChoiceTypesErrorTest.java @@ -1,11 +1,12 @@ package choice_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ChoiceTypesErrorTest @@ -19,8 +20,8 @@ public static void readZserioErrors() throws IOException @Test public void bitmaskCaseError() { - final String error = "bitmask_case_error.zs:27:10: " + - "Choice 'BitmaskParamChoice' has case with different bitmask type than selector!"; + final String error = "bitmask_case_error.zs:27:10: " + + "Choice 'BitmaskParamChoice' has case with different bitmask type than selector!"; assertTrue(zserioErrors.isPresent(error)); } @@ -34,16 +35,16 @@ public void boolCaseError() @Test public void compoundSelectorError() { - final String error = "compound_selector_error.zs:8:8: " + - "Choice 'CompoundSelectorChoice' uses forbidden COMPOUND selector!"; + final String error = "compound_selector_error.zs:8:8: " + + "Choice 'CompoundSelectorChoice' uses forbidden COMPOUND selector!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void enumCaseError() { - final String error = "enum_case_error.zs:27:10: " + - "Choice 'EnumParamChoice' has case with different enumeration type than selector!"; + final String error = "enum_case_error.zs:27:10: " + + "Choice 'EnumParamChoice' has case with different enumeration type than selector!"; assertTrue(zserioErrors.isPresent(error)); } @@ -57,8 +58,8 @@ public void fieldCaseError() @Test public void floatSelectorError() { - final String error = "float_selector_error.zs:3:8: " + - "Choice 'FloatSelectorChoice' uses forbidden FLOAT selector!"; + final String error = "float_selector_error.zs:3:8: " + + "Choice 'FloatSelectorChoice' uses forbidden FLOAT selector!"; assertTrue(zserioErrors.isPresent(error)); } @@ -72,27 +73,25 @@ public void multipleCases() @Test public void multipleCasesWithExpression() { - final String error = "multiple_cases_with_expression_error.zs:11:10: " + - "Choice 'MultipleCasesChoice' has duplicated case!"; + final String error = "multiple_cases_with_expression_error.zs:11:10: " + + "Choice 'MultipleCasesChoice' has duplicated case!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void multipleCasesOnEnum() { - final String error = "multiple_cases_on_enum_error.zs:18:10: " + - "Choice 'MultipleCasesChoice' has duplicated case!"; + final String error = "multiple_cases_on_enum_error.zs:18:10: " + + "Choice 'MultipleCasesChoice' has duplicated case!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void multipleDefaults() { - final String errors[] = - { - "multiple_defaults_error.zs:14:5: mismatched input 'default' expecting {", // ... - "multiple_defaults_error.zs:14:5: 'default' is a reserved keyword!" - }; + final String errors[] = { + "multiple_defaults_error.zs:14:5: mismatched input 'default' expecting {", // ... + "multiple_defaults_error.zs:14:5: 'default' is a reserved keyword!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -107,59 +106,56 @@ public void nonConstantCase() @Test public void optionalMember() { - final String errors[] = - { - "optional_member_error.zs:6:29: mismatched input 'if' expecting {", // ... - "optional_member_error.zs:6:29: 'if' is a reserved keyword!" - }; + final String errors[] = {"optional_member_error.zs:6:29: mismatched input 'if' expecting {", // ... + "optional_member_error.zs:6:29: 'if' is a reserved keyword!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void recursive() { - final String error = "recursive_error.zs:12:28: " + - "Field 'recursiveValue' is recursive and neither optional nor array which can be empty!"; + final String error = "recursive_error.zs:12:28: " + + "Field 'recursiveValue' is recursive and neither optional nor array which can be empty!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void stringSelectorError() { - final String error = "string_selector_error.zs:3:8: " + - "Choice 'StringSelectorChoice' uses forbidden STRING selector!"; + final String error = "string_selector_error.zs:3:8: " + + "Choice 'StringSelectorChoice' uses forbidden STRING selector!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unreachableDefault() { - final String error = "unreachable_default_error.zs:11:5: Choice 'UnreachableDefaultChoice' has " + - "unreachable default case!"; + final String error = "unreachable_default_error.zs:11:5: Choice 'UnreachableDefaultChoice' has " + + "unreachable default case!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unreachableDefaultMulticaseError() { - final String error = "unreachable_default_multicase_error.zs:9:5: " + - "Choice 'UnreachableDefaultMulticaseChoice' has unreachable default case!"; + final String error = "unreachable_default_multicase_error.zs:9:5: " + + "Choice 'UnreachableDefaultMulticaseChoice' has unreachable default case!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unresolvedEnumItem() { - final String error = "unresolved_enum_item_error.zs:19:31: " + - "Unresolved symbol 'RED' within expression scope!"; + final String error = "unresolved_enum_item_error.zs:19:31: " + + "Unresolved symbol 'RED' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unresolvedFieldInConstraint() { - final String error = "unresolved_field_in_constraint_error.zs:9:47: " + - "Unresolved symbol 'uint16Value' within expression scope!"; + final String error = "unresolved_field_in_constraint_error.zs:9:47: " + + "Unresolved symbol 'uint16Value' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/compatibility_error/build.xml b/test/errors/compatibility_error/build.xml index e37185213..cffb03841 100644 --- a/test/errors/compatibility_error/build.xml +++ b/test/errors/compatibility_error/build.xml @@ -35,7 +35,11 @@ - + + + + + diff --git a/test/errors/compatibility_error/java/compatibility_error/CompatibilityErrorTest.java b/test/errors/compatibility_error/java/compatibility_error/CompatibilityErrorTest.java index d2fdd63d7..441a52a9d 100644 --- a/test/errors/compatibility_error/java/compatibility_error/CompatibilityErrorTest.java +++ b/test/errors/compatibility_error/java/compatibility_error/CompatibilityErrorTest.java @@ -1,11 +1,12 @@ package compatibility_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class CompatibilityErrorTest @@ -19,13 +20,11 @@ public static void readZserioErrors() throws IOException @Test public void packedArrayInTemplate240() { - final String errors[] = { - "packed_array_in_template_240_error.zs:1:30: " + - "Root package requires compatibility with version '2.4.0'!", - "packed_array_in_template_240_error.zs:7:14: " + - "Packed arrays binary encoding has been changed in version '2.5.0'!", - "Java Generator: Compatibility check failed!" - }; + final String errors[] = {"packed_array_in_template_240_error.zs:1:30: " + + "Root package requires compatibility with version '2.4.0'!", + "packed_array_in_template_240_error.zs:7:14: " + + "Packed arrays binary encoding has been changed in version '2.5.0'!", + "Java Generator: Compatibility check failed!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -33,13 +32,11 @@ public void packedArrayInTemplate240() @Test public void packedCompoundArray242() { - final String errors[] = { - "packed_compound_array_242_error.zs:1:30: " + - "Root package requires compatibility with version '2.4.2'!", - "packed_compound_array_242_error.zs:16:25: " + - "Packed arrays binary encoding has been changed in version '2.5.0'!", - "Java Generator: Compatibility check failed!" - }; + final String errors[] = {"packed_compound_array_242_error.zs:1:30: " + + "Root package requires compatibility with version '2.4.2'!", + "packed_compound_array_242_error.zs:16:25: " + + "Packed arrays binary encoding has been changed in version '2.5.0'!", + "Java Generator: Compatibility check failed!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -47,30 +44,28 @@ public void packedCompoundArray242() @Test public void packedUInt32Array241() { - final String errors[] = { - "packed_uint32_array_241_error.zs:1:30: " + - "Root package requires compatibility with version '2.4.1'!", - "packed_uint32_array_241_error.zs:7:19: " + - "Packed arrays binary encoding has been changed in version '2.5.0'!", - "Java Generator: Compatibility check failed!" - }; + final String errors[] = {"packed_uint32_array_241_error.zs:1:30: " + + "Root package requires compatibility with version '2.4.1'!", + "packed_uint32_array_241_error.zs:7:19: " + + "Packed arrays binary encoding has been changed in version '2.5.0'!", + "Java Generator: Compatibility check failed!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void versionLessThanMinSupported() { - final String error = "version_less_than_min_supported_error.zs:1:30: " + - "Package specifies unsupported compatibility version '2.3.2', " + - "minimum supported version is '2.4.0'!"; + final String error = "version_less_than_min_supported_error.zs:1:30: " + + "Package specifies unsupported compatibility version '2.3.2', " + + "minimum supported version is '2.4.0'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongCompatibilityVersionFormat() { - final String error = "wrong_compatibility_version_format_error.zs:2:30: " + - "Failed to parse version string: '2.5.0-rc1' as a version!"; + final String error = "wrong_compatibility_version_format_error.zs:2:30: " + + "Failed to parse version string: '2.5.0-rc1' as a version!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/constants_error/build.xml b/test/errors/constants_error/build.xml index d918e0081..bc3dc6707 100644 --- a/test/errors/constants_error/build.xml +++ b/test/errors/constants_error/build.xml @@ -32,7 +32,11 @@ - + + + + + diff --git a/test/errors/constants_error/java/constants_error/ConstantsErrorTest.java b/test/errors/constants_error/java/constants_error/ConstantsErrorTest.java index 0665febf7..26d50877f 100644 --- a/test/errors/constants_error/java/constants_error/ConstantsErrorTest.java +++ b/test/errors/constants_error/java/constants_error/ConstantsErrorTest.java @@ -1,11 +1,12 @@ package constants_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ConstantsErrorTest @@ -19,99 +20,97 @@ public static void readZserioErrors() throws IOException @Test public void choiceTypeConstant() { - final String error = "choice_type_constant_error.zs:11:17: " + - "Constants can be defined only for built-in types, enums or bitmasks!"; + final String error = "choice_type_constant_error.zs:11:17: " + + "Constants can be defined only for built-in types, enums or bitmasks!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void constant0x8000() { - final String error = "constant_0x8000_error.zs:3:30: Initializer value '32768' of " + - "'WRONG_CONSTANT' exceeds the bounds of its type 'int16'!"; + final String error = "constant_0x8000_error.zs:3:30: Initializer value '32768' of " + + "'WRONG_CONSTANT' exceeds the bounds of its type 'int16'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void constant0xffff() { - final String error = "constant_0xffff_error.zs:3:30: Initializer value '65535' of " + - "'WRONG_CONSTANT' exceeds the bounds of its type 'int16'!"; + final String error = "constant_0xffff_error.zs:3:30: Initializer value '65535' of " + + "'WRONG_CONSTANT' exceeds the bounds of its type 'int16'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cyclicDefinitionUsingConstant() { - final String error = "cyclic_definition_using_constant_error.zs:7:25: " + - "Cyclic dependency detected in expression evaluation!"; + final String error = "cyclic_definition_using_constant_error.zs:7:25: " + + "Cyclic dependency detected in expression evaluation!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cyclicDefinitionUsingEnumValue() { - final String error = "cyclic_definition_using_enum_value_error.zs:12:37: " + - "Cyclic dependency detected in expression evaluation!"; + final String error = "cyclic_definition_using_enum_value_error.zs:12:37: " + + "Cyclic dependency detected in expression evaluation!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void invalidConstantName() { - final String errors[] = - { - "invalid_constant_name_error.zs:4:13: mismatched input 'align' expecting {", // ... - "invalid_constant_name_error.zs:4:13: 'align' is a reserved keyword!" - }; + final String errors[] = { + "invalid_constant_name_error.zs:4:13: mismatched input 'align' expecting {", // ... + "invalid_constant_name_error.zs:4:13: 'align' is a reserved keyword!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void structureTypeConstant() { - final String error = "structure_type_constant_error.zs:8:17: Constants can be defined only for " + - "built-in types, enums or bitmasks!"; + final String error = "structure_type_constant_error.zs:8:17: Constants can be defined only for " + + "built-in types, enums or bitmasks!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void subtypedCompoundTypeConstant() { - final String error = "subtyped_compound_type_constant_error.zs:12:23: Constants can be defined only " + - "for built-in types, enums or bitmasks!"; + final String error = "subtyped_compound_type_constant_error.zs:12:23: Constants can be defined only " + + "for built-in types, enums or bitmasks!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongBoolConstant() { - final String error = "wrong_bool_constant_error.zs:3:34: Wrong type of value expression " + - "(integer cannot be assigned to bool)!"; + final String error = "wrong_bool_constant_error.zs:3:34: Wrong type of value expression " + + "(integer cannot be assigned to bool)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongDecimalConstant() { - final String error = "wrong_decimal_constant_error.zs:3:38: Wrong type of value expression " + - "(boolean cannot be assigned to int32)!"; + final String error = "wrong_decimal_constant_error.zs:3:38: Wrong type of value expression " + + "(boolean cannot be assigned to int32)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongFloatConstant() { - final String error = "wrong_float_constant_error.zs:3:38: Wrong type of value expression " + - "(string cannot be assigned to float32)!"; + final String error = "wrong_float_constant_error.zs:3:38: Wrong type of value expression " + + "(string cannot be assigned to float32)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongStringConstant() { - final String error = "wrong_string_constant_error.zs:3:38: Wrong type of value expression " + - "(boolean cannot be assigned to string)!"; + final String error = "wrong_string_constant_error.zs:3:38: Wrong type of value expression " + + "(boolean cannot be assigned to string)!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/constraints_error/build.xml b/test/errors/constraints_error/build.xml index 77c21e11b..67d5c1a6e 100644 --- a/test/errors/constraints_error/build.xml +++ b/test/errors/constraints_error/build.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/test/errors/constraints_error/java/constraints_error/ConstraintsErrorTest.java b/test/errors/constraints_error/java/constraints_error/ConstraintsErrorTest.java index a16801810..94d51a565 100644 --- a/test/errors/constraints_error/java/constraints_error/ConstraintsErrorTest.java +++ b/test/errors/constraints_error/java/constraints_error/ConstraintsErrorTest.java @@ -1,13 +1,13 @@ package constraints_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; - import java.util.Arrays; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ConstraintsErrorTest @@ -21,28 +21,26 @@ public static void readZserioErrors() throws IOException @Test public void fieldInFunctionNotAvailableError() { - final String errors[] = - { - "field_in_function_not_available_error.zs:7:26: In function 'checkSpecial' called from here", - "field_in_function_not_available_error.zs:17:31: " + - "Unresolved symbol 'specialMinValue' within expression scope!" - }; + final String errors[] = { + "field_in_function_not_available_error.zs:7:26: In function 'checkSpecial' called from here", + "field_in_function_not_available_error.zs:17:31: " + + "Unresolved symbol 'specialMinValue' within expression scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void fieldNotAvailableError() { - final String error = "field_not_available_error.zs:7:41: Unresolved symbol 'specialMinValue' " + - "within expression scope!"; + final String error = "field_not_available_error.zs:7:41: Unresolved symbol 'specialMinValue' " + + "within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void noneBooleanExpression() { - final String error = "none_boolean_expression_error.zs:6:35: Constraint expression for field " + - "'constraintValue' is not boolean!"; + final String error = "none_boolean_expression_error.zs:6:35: Constraint expression for field " + + "'constraintValue' is not boolean!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/default_values_error/build.xml b/test/errors/default_values_error/build.xml index f492f2073..93c6c7b9a 100644 --- a/test/errors/default_values_error/build.xml +++ b/test/errors/default_values_error/build.xml @@ -27,7 +27,11 @@ - + + + + + diff --git a/test/errors/default_values_error/java/default_values_error/DefaultValuesErrorTest.java b/test/errors/default_values_error/java/default_values_error/DefaultValuesErrorTest.java index 5c9cae6c5..aaf4d4f87 100644 --- a/test/errors/default_values_error/java/default_values_error/DefaultValuesErrorTest.java +++ b/test/errors/default_values_error/java/default_values_error/DefaultValuesErrorTest.java @@ -1,11 +1,12 @@ package default_values_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class DefaultValuesErrorTest @@ -19,8 +20,8 @@ public static void readZserioErrors() throws IOException @Test public void arrayInitializerError() { - final String error = "array_initializer_error.zs:5:24: Wrong type of value expression " + - "(integer cannot be assigned to array type)!"; + final String error = "array_initializer_error.zs:5:24: Wrong type of value expression " + + "(integer cannot be assigned to array type)!"; assertTrue(zserioErrors.isPresent(error)); } @@ -34,40 +35,40 @@ public void fieldInitializerError() @Test public void rangeDecimalInitializerError() { - final String error = "range_decimal_initializer_error.zs:5:39: Initializer value '57005' of " + - "'wrongDecimalInitializer' exceeds the bounds of its type 'int8'!"; + final String error = "range_decimal_initializer_error.zs:5:39: Initializer value '57005' of " + + "'wrongDecimalInitializer' exceeds the bounds of its type 'int8'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongBoolInitializer() { - final String error = "wrong_bool_initializer_error.zs:5:36: Wrong type of value expression " + - "(integer cannot be assigned to bool)!"; + final String error = "wrong_bool_initializer_error.zs:5:36: Wrong type of value expression " + + "(integer cannot be assigned to bool)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongDecimalInitializer() { - final String error = "wrong_decimal_initializer_error.zs:5:39: Wrong type of value expression " + - "(boolean cannot be assigned to int32)!"; + final String error = "wrong_decimal_initializer_error.zs:5:39: Wrong type of value expression " + + "(boolean cannot be assigned to int32)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongFloatInitializer() { - final String error = "wrong_float_initializer_error.zs:5:37: Wrong type of value expression " + - "(string cannot be assigned to float64)!"; + final String error = "wrong_float_initializer_error.zs:5:37: Wrong type of value expression " + + "(string cannot be assigned to float64)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongStringInitializer() { - final String error = "wrong_string_initializer_error.zs:5:38: Wrong type of value expression " + - "(boolean cannot be assigned to string)!"; + final String error = "wrong_string_initializer_error.zs:5:38: Wrong type of value expression " + + "(boolean cannot be assigned to string)!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/enumeration_types_error/build.xml b/test/errors/enumeration_types_error/build.xml index e553f25b7..e98c23155 100644 --- a/test/errors/enumeration_types_error/build.xml +++ b/test/errors/enumeration_types_error/build.xml @@ -36,7 +36,11 @@ - + + + + + diff --git a/test/errors/enumeration_types_error/java/enumeration_types_error/EnumerationTypesErrorTest.java b/test/errors/enumeration_types_error/java/enumeration_types_error/EnumerationTypesErrorTest.java index 73e1bc6d9..2da19516d 100644 --- a/test/errors/enumeration_types_error/java/enumeration_types_error/EnumerationTypesErrorTest.java +++ b/test/errors/enumeration_types_error/java/enumeration_types_error/EnumerationTypesErrorTest.java @@ -1,11 +1,12 @@ package enumeration_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class EnumerationTypesErrorTest @@ -35,27 +36,24 @@ public void cyclicDefinition() @Test public void cyclicDefinitionUsingConstant() { - final String error = "cyclic_definition_using_constant_error.zs:8:13: Cyclic dependency detected in " + - "expression evaluation!"; + final String error = "cyclic_definition_using_constant_error.zs:8:13: Cyclic dependency detected in " + + "expression evaluation!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cyclicDefinitionUsingEnumValue() { - final String error = "cyclic_definition_using_enum_value_error.zs:7:19: Cyclic dependency detected " + - "in expression evaluation!"; + final String error = "cyclic_definition_using_enum_value_error.zs:7:19: Cyclic dependency detected " + + "in expression evaluation!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void duplicatedEnumItem() { - final String errors[] = - { - "duplicated_enum_item_error.zs:6:5: First defined here", - "duplicated_enum_item_error.zs:7:5: 'DARK_RED' is already defined in this scope!" - }; + final String errors[] = {"duplicated_enum_item_error.zs:6:5: First defined here", + "duplicated_enum_item_error.zs:7:5: 'DARK_RED' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -78,24 +76,24 @@ public void enumTypeValue() @Test public void notAvailableEnumItem() { - final String error = "not_available_enum_item_error.zs:6:26: Unresolved symbol 'DARK_BLACK' within " + - "expression scope!"; + final String error = "not_available_enum_item_error.zs:6:26: Unresolved symbol 'DARK_BLACK' within " + + "expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void outOfRangeEnumExplicitValue() { - final String error = "out_of_range_enum_explicit_value_error.zs:7:18: " + - "Enumeration item 'DARK_BLUE' has value (256) out of range <0,255>!"; + final String error = "out_of_range_enum_explicit_value_error.zs:7:18: " + + "Enumeration item 'DARK_BLUE' has value (256) out of range <0,255>!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void outOfRangeEnumValue() { - final String error = "out_of_range_enum_value_error.zs:8:5: " + - "Enumeration item 'DARK_BLACK' has value (256) out of range <0,255>!"; + final String error = "out_of_range_enum_value_error.zs:8:5: " + + "Enumeration item 'DARK_BLACK' has value (256) out of range <0,255>!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/explicit_parameters_error/build.xml b/test/errors/explicit_parameters_error/build.xml index d73314ca7..053a527b8 100644 --- a/test/errors/explicit_parameters_error/build.xml +++ b/test/errors/explicit_parameters_error/build.xml @@ -23,8 +23,14 @@ - - + + + + + + diff --git a/test/errors/explicit_parameters_error/java/explicit_parameters_error/ExplicitParametersErrorTest.java b/test/errors/explicit_parameters_error/java/explicit_parameters_error/ExplicitParametersErrorTest.java index 4d49de7a0..2a07bb078 100644 --- a/test/errors/explicit_parameters_error/java/explicit_parameters_error/ExplicitParametersErrorTest.java +++ b/test/errors/explicit_parameters_error/java/explicit_parameters_error/ExplicitParametersErrorTest.java @@ -1,11 +1,12 @@ package explicit_parameters_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ExplicitParametersErrorTest @@ -19,18 +20,18 @@ public static void readZserioErrors() throws IOException @Test public void differentBuiltinType() { - final String error = "different_builtin_type_error.zs:20:15: " + - "Type of explicit parameter 'count' resolved to 'uint8' but first used as 'uint32' at 18:10!"; + final String error = "different_builtin_type_error.zs:20:15: " + + "Type of explicit parameter 'count' resolved to 'uint8' but first used as 'uint32' at 18:10!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void differentCompoundType() { - final String error = "different_compound_type_error.zs:28:15: " + - "Type of explicit parameter 'headerParam' resolved to " + - "'different_compound_type_error.OtherHeader' " + - "but first used as 'different_compound_type_error.Header' at 26:10!"; + final String error = "different_compound_type_error.zs:28:15: " + + "Type of explicit parameter 'headerParam' resolved to " + + "'different_compound_type_error.OtherHeader' " + + "but first used as 'different_compound_type_error.Header' at 26:10!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/expressions_error/build.xml b/test/errors/expressions_error/build.xml index af061e293..12916df7a 100644 --- a/test/errors/expressions_error/build.xml +++ b/test/errors/expressions_error/build.xml @@ -49,7 +49,11 @@ - + + + + + diff --git a/test/errors/expressions_error/java/expressions_error/ExpressionsErrorTest.java b/test/errors/expressions_error/java/expressions_error/ExpressionsErrorTest.java index feeb09cea..d954a2af4 100644 --- a/test/errors/expressions_error/java/expressions_error/ExpressionsErrorTest.java +++ b/test/errors/expressions_error/java/expressions_error/ExpressionsErrorTest.java @@ -1,11 +1,12 @@ package expressions_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ExpressionsErrorTest @@ -42,56 +43,56 @@ public void stringIntegerConcatenation() @Test public void ternaryIncompatibleBitmaskTypesInArgument() { - final String error = "ternary_incompatible_bitmask_types_in_argument_error.zs:26:19: " + - "Incompatible expression types ('Bitmask1' != 'Bitmask2')!"; + final String error = "ternary_incompatible_bitmask_types_in_argument_error.zs:26:19: " + + "Incompatible expression types ('Bitmask1' != 'Bitmask2')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void ternaryIncompatibleBitmaskTypesInConstraint() { - final String error = "ternary_incompatible_bitmask_types_in_constraint_error.zs:20:50: " + - "Incompatible expression types ('Bitmask1' != 'Bitmask2')!"; + final String error = "ternary_incompatible_bitmask_types_in_constraint_error.zs:20:50: " + + "Incompatible expression types ('Bitmask1' != 'Bitmask2')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void ternaryIncompatibleCompoundTypesInArgument() { - final String error = "ternary_incompatible_compound_types_in_argument_error.zs:23:19: " + - "Incompatible expression types ('Param1' != 'Param2')!"; + final String error = "ternary_incompatible_compound_types_in_argument_error.zs:23:19: " + + "Incompatible expression types ('Param1' != 'Param2')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void ternaryIncompatibleCompoundTypesInConstraint() { - final String error = "ternary_incompatible_compound_types_in_constraint_error.zs:18:42: " + - "Incompatible expression types ('Compound1' != 'Compound2')!"; + final String error = "ternary_incompatible_compound_types_in_constraint_error.zs:18:42: " + + "Incompatible expression types ('Compound1' != 'Compound2')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void ternaryIncompatibleEnumTypesInArgument() { - final String error = "ternary_incompatible_enum_types_in_argument_error.zs:26:19: " + - "Incompatible expression types ('Enum1' != 'Enum2')!"; + final String error = "ternary_incompatible_enum_types_in_argument_error.zs:26:19: " + + "Incompatible expression types ('Enum1' != 'Enum2')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void ternaryIncompatibleEnumTypesInOptional() { - final String error = "ternary_incompatible_enum_types_in_optional_error.zs:20:24: " + - "Incompatible expression types ('Enum1' != 'Enum2')!"; + final String error = "ternary_incompatible_enum_types_in_optional_error.zs:20:24: " + + "Incompatible expression types ('Enum1' != 'Enum2')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongFullType() { - final String error = "wrong_full_type_error.zs:7:33: " + - "Unresolved symbol 'wrong_full_type_error.someStructure' within expression scope!"; + final String error = "wrong_full_type_error.zs:7:33: " + + "Unresolved symbol 'wrong_full_type_error.someStructure' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/expressions_error/java/expressions_error/isset_operators/IsSetOperatorsErrorTest.java b/test/errors/expressions_error/java/expressions_error/isset_operators/IsSetOperatorsErrorTest.java index dddbc5d23..653d0829e 100644 --- a/test/errors/expressions_error/java/expressions_error/isset_operators/IsSetOperatorsErrorTest.java +++ b/test/errors/expressions_error/java/expressions_error/isset_operators/IsSetOperatorsErrorTest.java @@ -1,11 +1,12 @@ package expressions_error.isset_operators; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class IsSetOperatorsErrorTest diff --git a/test/errors/expressions_error/java/expressions_error/valueof_operators/ValueOfOperatorsErrorTest.java b/test/errors/expressions_error/java/expressions_error/valueof_operators/ValueOfOperatorsErrorTest.java index 6049ecc16..3ea58718f 100644 --- a/test/errors/expressions_error/java/expressions_error/valueof_operators/ValueOfOperatorsErrorTest.java +++ b/test/errors/expressions_error/java/expressions_error/valueof_operators/ValueOfOperatorsErrorTest.java @@ -1,11 +1,12 @@ package expressions_error.valueof_operators; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ValueOfOperatorsErrorTest diff --git a/test/errors/extended_members_error/build.xml b/test/errors/extended_members_error/build.xml index cc750a38b..28193993e 100644 --- a/test/errors/extended_members_error/build.xml +++ b/test/errors/extended_members_error/build.xml @@ -36,7 +36,11 @@ - + + + + + diff --git a/test/errors/extended_members_error/java/ExtendedMembersErrorTest.java b/test/errors/extended_members_error/java/ExtendedMembersErrorTest.java index 2878baff4..32a24a81f 100644 --- a/test/errors/extended_members_error/java/ExtendedMembersErrorTest.java +++ b/test/errors/extended_members_error/java/ExtendedMembersErrorTest.java @@ -1,11 +1,12 @@ package functions_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ExtendedMembersErrorTest @@ -19,13 +20,10 @@ public static void readZserioErrors() throws IOException @Test public void extendedDeepNested() { - final String errors[] = - { - "extended_deep_nested_error.zs:6:19: extended field used here", - "extended_deep_nested_error.zs:18:14: extended field used here", - "extended_deep_nested_error.zs:24:15: extended field used here", - "extended_deep_nested_error.zs:12:19: Field 'choiceArray' contains an extended field!" - }; + final String errors[] = {"extended_deep_nested_error.zs:6:19: extended field used here", + "extended_deep_nested_error.zs:18:14: extended field used here", + "extended_deep_nested_error.zs:24:15: extended field used here", + "extended_deep_nested_error.zs:12:19: Field 'choiceArray' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -39,11 +37,8 @@ public void extendedInChoice() @Test public void extendedInRecursion() { - final String errors[] = - { - "extended_in_recursion_error.zs:7:19: extended field used here", - "extended_in_recursion_error.zs:6:23: Field 'recursive' contains an extended field!" - }; + final String errors[] = {"extended_in_recursion_error.zs:7:19: extended field used here", + "extended_in_recursion_error.zs:6:23: Field 'recursive' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -57,93 +52,70 @@ public void extendedInUnion() @Test public void extendedMultipleNotLast() { - final String errors[] = - { - "extended_multiple_not_last_error.zs:6:19: extended field used here", - "extended_multiple_not_last_error.zs:9:13: " + - "Field 'field5' follows an extended field and is not marked as extended!" - }; + final String errors[] = {"extended_multiple_not_last_error.zs:6:19: extended field used here", + "extended_multiple_not_last_error.zs:9:13: " + + "Field 'field5' follows an extended field and is not marked as extended!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void extendedNestedInArray() { - final String errors[] = - { - "extended_nested_in_array_error.zs:6:19: extended field used here", - "extended_nested_in_array_error.zs:11:14: Field 'array' contains an extended field!" - }; + final String errors[] = {"extended_nested_in_array_error.zs:6:19: extended field used here", + "extended_nested_in_array_error.zs:11:14: Field 'array' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); }; @Test public void extendedNestedInChoice() { - final String errors[] = - { - "extended_nested_in_choice_error.zs:6:19: extended field used here", - "extended_nested_in_choice_error.zs:14:18: Field 'extended' contains an extended field!" - }; + final String errors[] = {"extended_nested_in_choice_error.zs:6:19: extended field used here", + "extended_nested_in_choice_error.zs:14:18: Field 'extended' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void extendedNestedInUnion() { - final String errors[] = - { - "extended_nested_in_union_error.zs:6:19: extended field used here", - "extended_nested_in_union_error.zs:12:14: Field 'extended' contains an extended field!" - }; + final String errors[] = {"extended_nested_in_union_error.zs:6:19: extended field used here", + "extended_nested_in_union_error.zs:12:14: Field 'extended' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); }; @Test public void extendedNotLast() { - final String errors[] = - { - "extended_not_last_error.zs:6:19: extended field used here", - "extended_not_last_error.zs:7:13: " + - "Field 'field3' follows an extended field and is not marked as extended!" - }; + final String errors[] = {"extended_not_last_error.zs:6:19: extended field used here", + "extended_not_last_error.zs:7:13: " + + "Field 'field3' follows an extended field and is not marked as extended!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void extendedNotLastInTemplate() { - final String errors[] = - { - "extended_not_last_in_template_error.zs:10:13: " + - " In instantiation of 'Extended' required from here", - "extended_not_last_in_template_error.zs:6:14: extended field used here", - "extended_not_last_in_template_error.zs:7:13: " + - "Field 'field3' follows an extended field and is not marked as extended!" - }; + final String errors[] = {"extended_not_last_in_template_error.zs:10:13: " + + " In instantiation of 'Extended' required from here", + "extended_not_last_in_template_error.zs:6:14: extended field used here", + "extended_not_last_in_template_error.zs:7:13: " + + "Field 'field3' follows an extended field and is not marked as extended!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void extendedNotTopLevel() { - final String errors[] = - { - "extended_not_top_level_error.zs:6:19: extended field used here", - "extended_not_top_level_error.zs:11:14: Field 'extended' contains an extended field!" - }; + final String errors[] = {"extended_not_top_level_error.zs:6:19: extended field used here", + "extended_not_top_level_error.zs:11:14: Field 'extended' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void extendedNotTopLevelInTemplate() { - final String errors[] = - { - "extended_not_top_level_in_template_error.zs:6:14: extended field used here", - "extended_not_top_level_in_template_error.zs:11:22: Field 'extended' contains an extended field!" - }; + final String errors[] = { + "extended_not_top_level_in_template_error.zs:6:14: extended field used here", + "extended_not_top_level_in_template_error.zs:11:22: Field 'extended' contains an extended field!"}; assertTrue(zserioErrors.isPresent(errors)); } diff --git a/test/errors/functions_error/build.xml b/test/errors/functions_error/build.xml index 4088b42ef..fe8198c4a 100644 --- a/test/errors/functions_error/build.xml +++ b/test/errors/functions_error/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/errors/functions_error/java/functions_error/FunctionsErrorTest.java b/test/errors/functions_error/java/functions_error/FunctionsErrorTest.java index 100e19f0e..4b667ec96 100644 --- a/test/errors/functions_error/java/functions_error/FunctionsErrorTest.java +++ b/test/errors/functions_error/java/functions_error/FunctionsErrorTest.java @@ -1,11 +1,12 @@ package functions_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class FunctionsErrorTest @@ -19,33 +20,26 @@ public static void readZserioErrors() throws IOException @Test public void compoundFieldNotAvailable() { - final String errors[] = - { - "compound_field_not_available_error.zs:7:23: In function 'hasOptional2' called from here", - "compound_field_not_available_error.zs:17:16: Unresolved symbol 'header2' within expression scope!" - }; + final String errors[] = { + "compound_field_not_available_error.zs:7:23: In function 'hasOptional2' called from here", + "compound_field_not_available_error.zs:17:16: Unresolved symbol 'header2' within expression scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void differentScopes() { - final String errors[] = - { - "different_scopes_error.zs:15:27: In function 'getValue' called from here", - "different_scopes_error.zs:20:55: Unresolved symbol 'val3' within expression scope!" - }; + final String errors[] = {"different_scopes_error.zs:15:27: In function 'getValue' called from here", + "different_scopes_error.zs:20:55: Unresolved symbol 'val3' within expression scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void fieldNotAvailable() { - final String errors[] = - { - "field_not_available_error.zs:7:28: In function 'hasSpecial' called from here", - "field_not_available_error.zs:17:16: Unresolved symbol 'hasSpecialData' within expression scope!" - }; + final String errors[] = { + "field_not_available_error.zs:7:28: In function 'hasSpecial' called from here", + "field_not_available_error.zs:17:16: Unresolved symbol 'hasSpecialData' within expression scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -59,11 +53,9 @@ public void functionCallWithArgument() @Test public void functionWithParameter() { - final String errors[] = - { - "function_with_parameter_error.zs:7:38: mismatched input 'int32' expecting ')'", - "function_with_parameter_error.zs:7:38: 'int32' is a reserved keyword!" - }; + final String errors[] = { + "function_with_parameter_error.zs:7:38: mismatched input 'int32' expecting ')'", + "function_with_parameter_error.zs:7:38: 'int32' is a reserved keyword!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -77,8 +69,8 @@ public void recursive() @Test public void wrongReturnType() { - final String error = "wrong_return_type_error.zs:9:16: Wrong type of value expression (integer " + - "cannot be assigned to bool)!"; + final String error = "wrong_return_type_error.zs:9:16: Wrong type of value expression (integer " + + "cannot be assigned to bool)!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/identifiers_error/build.xml b/test/errors/identifiers_error/build.xml index 70288215a..f0f396eae 100644 --- a/test/errors/identifiers_error/build.xml +++ b/test/errors/identifiers_error/build.xml @@ -109,7 +109,11 @@ - + + + + + diff --git a/test/errors/identifiers_error/java/identifiers_error/clashing_identifiers/ClashingIdentifiersErrorTest.java b/test/errors/identifiers_error/java/identifiers_error/clashing_identifiers/ClashingIdentifiersErrorTest.java index 73940a340..949680d73 100644 --- a/test/errors/identifiers_error/java/identifiers_error/clashing_identifiers/ClashingIdentifiersErrorTest.java +++ b/test/errors/identifiers_error/java/identifiers_error/clashing_identifiers/ClashingIdentifiersErrorTest.java @@ -1,11 +1,12 @@ package identifiers_error.clashing_identifiers; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ClashingIdentifiersErrorTest @@ -19,68 +20,54 @@ public static void readZserioErrors() throws IOException @Test public void choiceChoiceNameConflict() { - final String errors[] = - { - "choice_choice_name_conflict_error.zs:3:8: First defined here", - "choice_choice_name_conflict_error.zs:11:8: 'Test' is already defined in this package!" - }; + final String errors[] = {"choice_choice_name_conflict_error.zs:3:8: First defined here", + "choice_choice_name_conflict_error.zs:11:8: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void choiceStructureNameConflict() { - final String errors[] = - { - "choice_structure_name_conflict_error.zs:3:8: First defined here", - "choice_structure_name_conflict_error.zs:11:8: 'Test' is already defined in this package!" - }; + final String errors[] = {"choice_structure_name_conflict_error.zs:3:8: First defined here", + "choice_structure_name_conflict_error.zs:11:8: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void choiceUnionNameConflict() { - final String errors[] = - { - "choice_union_name_conflict_error.zs:3:8: First defined here", - "choice_union_name_conflict_error.zs:11:7: 'Test' is already defined in this package!" - }; + final String errors[] = {"choice_union_name_conflict_error.zs:3:8: First defined here", + "choice_union_name_conflict_error.zs:11:7: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingChoiceParamNames() { - final String errors[] = - { - "clashing_choice_param_names_error.zs:8:21: Conflicting symbol defined here", - "clashing_choice_param_names_error.zs:8:35: " + - "Symbol 'Param' differs only in a case of its first letter!" - }; + final String errors[] = { + "clashing_choice_param_names_error.zs:8:21: Conflicting symbol defined here", + "clashing_choice_param_names_error.zs:8:35: " + + "Symbol 'Param' differs only in a case of its first letter!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingIdentifiersWithinPackage() { - final String errors[] = - { - "clashing_identifiers_within_package_error.zs:3:8: Conflicting symbol defined here", - "clashing_identifiers_within_package_error.zs:8:13: " + - "Symbol 'TEST' is not unique (case insensitive) within this package!" - }; + final String errors[] = { + "clashing_identifiers_within_package_error.zs:3:8: Conflicting symbol defined here", + "clashing_identifiers_within_package_error.zs:8:13: " + + "Symbol 'TEST' is not unique (case insensitive) within this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingPubsubMessageNames() { - final String errors[] = - { - "clashing_pubsub_message_names_error.zs:10:29: Conflicting symbol defined here", - "clashing_pubsub_message_names_error.zs:11:29: " + - "Symbol 'X_message' differs only in a case of its first letter!", + final String errors[] = { + "clashing_pubsub_message_names_error.zs:10:29: Conflicting symbol defined here", + "clashing_pubsub_message_names_error.zs:11:29: " + + "Symbol 'X_message' differs only in a case of its first letter!", }; assertTrue(zserioErrors.isPresent(errors)); } @@ -88,247 +75,192 @@ public void clashingPubsubMessageNames() @Test public void clashingServiceMethodNames() { - final String errors[] = - { - "clashing_service_method_names_error.zs:10:10: Conflicting symbol defined here", - "clashing_service_method_names_error.zs:11:10: " + - "Symbol 'X_method' differs only in a case of its first letter!" - }; + final String errors[] = { + "clashing_service_method_names_error.zs:10:10: Conflicting symbol defined here", + "clashing_service_method_names_error.zs:11:10: " + + "Symbol 'X_method' differs only in a case of its first letter!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingSqlDatabaseTableNames() { - final String errors[] = - { - "clashing_sql_database_table_names_error.zs:10:11: Conflicting symbol defined here", - "clashing_sql_database_table_names_error.zs:11:11: " + - "Symbol 'tBl_x' is not unique (case insensitive) within the SQL type!" - }; + final String errors[] = { + "clashing_sql_database_table_names_error.zs:10:11: Conflicting symbol defined here", + "clashing_sql_database_table_names_error.zs:11:11: " + + "Symbol 'tBl_x' is not unique (case insensitive) within the SQL type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingSqlTableColumnNames() { - final String errors[] = - { - "clashing_sql_table_column_names_error.zs:5:11: Conflicting symbol defined here", - "clashing_sql_table_column_names_error.zs:6:11: " + - "Symbol 'fieldabc' is not unique (case insensitive) within the SQL type!" - }; + final String errors[] = { + "clashing_sql_table_column_names_error.zs:5:11: Conflicting symbol defined here", + "clashing_sql_table_column_names_error.zs:6:11: " + + "Symbol 'fieldabc' is not unique (case insensitive) within the SQL type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingStructureFieldAndParamNames() { - final String errors[] = - { - "clashing_structure_field_and_param_names_error.zs:3:24: Conflicting symbol defined here", - "clashing_structure_field_and_param_names_error.zs:5:11: " + - "Symbol 'value' differs only in a case of its first letter!" - }; + final String errors[] = { + "clashing_structure_field_and_param_names_error.zs:3:24: Conflicting symbol defined here", + "clashing_structure_field_and_param_names_error.zs:5:11: " + + "Symbol 'value' differs only in a case of its first letter!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingStructureFieldNames() { - final String errors[] = - { - "clashing_structure_field_names_error.zs:5:11: Conflicting symbol defined here", - "clashing_structure_field_names_error.zs:6:11: " + - "Symbol 'Field1' differs only in a case of its first letter!" - }; + final String errors[] = { + "clashing_structure_field_names_error.zs:5:11: Conflicting symbol defined here", + "clashing_structure_field_names_error.zs:6:11: " + + "Symbol 'Field1' differs only in a case of its first letter!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingStructureFunctionNames() { - final String errors[] = - { - "clashing_structure_function_names_error.zs:5:20: Conflicting symbol defined here", - "clashing_structure_function_names_error.zs:10:20: " + - "Symbol 'Func1' differs only in a case of its first letter!" - }; + final String errors[] = { + "clashing_structure_function_names_error.zs:5:20: Conflicting symbol defined here", + "clashing_structure_function_names_error.zs:10:20: " + + "Symbol 'Func1' differs only in a case of its first letter!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingTypeNamesWithinPackage() { - final String errors[] = - { - "clashing_type_names_within_package_error.zs:3:8: Conflicting symbol defined here", - "clashing_type_names_within_package_error.zs:8:7: " + - "Symbol 'TEst' is not unique (case insensitive) within this package!" - }; + final String errors[] = { + "clashing_type_names_within_package_error.zs:3:8: Conflicting symbol defined here", + "clashing_type_names_within_package_error.zs:8:7: " + + "Symbol 'TEst' is not unique (case insensitive) within this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void clashingUnionFieldNames() { - final String errors[] = - { - "clashing_union_field_names_error.zs:5:11: Conflicting symbol defined here", - "clashing_union_field_names_error.zs:6:11: " + - "Symbol 'Field1' differs only in a case of its first letter!" - }; + final String errors[] = { + "clashing_union_field_names_error.zs:5:11: Conflicting symbol defined here", + "clashing_union_field_names_error.zs:6:11: " + + "Symbol 'Field1' differs only in a case of its first letter!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void constConstNameConflict() { - final String errors[] = - { - "const_const_name_conflict_error.zs:3:13: First defined here", - "const_const_name_conflict_error.zs:4:14: 'Test' is already defined in this package!" - }; + final String errors[] = {"const_const_name_conflict_error.zs:3:13: First defined here", + "const_const_name_conflict_error.zs:4:14: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void constServiceNameConflict() { - final String errors[] = - { - "const_service_name_conflict_error.zs:3:14: First defined here", - "const_service_name_conflict_error.zs:15:9: 'Math' is already defined in this package!" - }; + final String errors[] = {"const_service_name_conflict_error.zs:3:14: First defined here", + "const_service_name_conflict_error.zs:15:9: 'Math' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void constStructureNameConflict() { - final String errors[] = - { - "const_structure_name_conflict_error.zs:3:13: First defined here", - "const_structure_name_conflict_error.zs:5:8: 'Test' is already defined in this package!" - }; + final String errors[] = {"const_structure_name_conflict_error.zs:3:13: First defined here", + "const_structure_name_conflict_error.zs:5:8: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void constSubtypeNameConflict() { - final String errors[] = - { - "const_subtype_name_conflict_error.zs:3:13: First defined here", - "const_subtype_name_conflict_error.zs:5:16: 'Test' is already defined in this package!" - }; + final String errors[] = {"const_subtype_name_conflict_error.zs:3:13: First defined here", + "const_subtype_name_conflict_error.zs:5:16: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void serviceServiceNameConflict() { - final String errors[] = - { - "service_service_name_conflict_error.zs:13:9: First defined here", - "service_service_name_conflict_error.zs:18:9: 'Math' is already defined in this package!" - }; + final String errors[] = {"service_service_name_conflict_error.zs:13:9: First defined here", + "service_service_name_conflict_error.zs:18:9: 'Math' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void structureEnumNameConflict() { - final String errors[] = - { - "structure_enum_name_conflict_error.zs:3:8: First defined here", - "structure_enum_name_conflict_error.zs:8:12: 'Test' is already defined in this package!" - }; + final String errors[] = {"structure_enum_name_conflict_error.zs:3:8: First defined here", + "structure_enum_name_conflict_error.zs:8:12: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void structureNameFirstLowerCase() { - final String error = "structure_name_first_lower_case_error.zs:3:8: " + - "Symbols defined in a package must start with an upper case letter!"; + final String error = "structure_name_first_lower_case_error.zs:3:8: " + + "Symbols defined in a package must start with an upper case letter!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void structureParamStructureNameConflict() { - final String errors[] = - { - "structure_param_structure_name_conflict_error.zs:3:8: First defined here", - "structure_param_structure_name_conflict_error.zs:8:8: 'Test' is already defined in this package!" - }; + final String errors[] = {"structure_param_structure_name_conflict_error.zs:3:8: First defined here", + "structure_param_structure_name_conflict_error.zs:8:8: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void structureServiceNameConflict() { - final String errors[] = - { - "structure_service_name_conflict_error.zs:3:8: First defined here", - "structure_service_name_conflict_error.zs:19:9: 'Math' is already defined in this package!" - }; + final String errors[] = {"structure_service_name_conflict_error.zs:3:8: First defined here", + "structure_service_name_conflict_error.zs:19:9: 'Math' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void structureStructureNameConflict() { - final String errors[] = - { - "structure_structure_name_conflict_error.zs:3:8: First defined here", - "structure_structure_name_conflict_error.zs:8:8: 'Test' is already defined in this package!" - }; + final String errors[] = {"structure_structure_name_conflict_error.zs:3:8: First defined here", + "structure_structure_name_conflict_error.zs:8:8: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void structureUnionNameConflict() { - final String errors[] = - { - "structure_union_name_conflict_error.zs:3:8: First defined here", - "structure_union_name_conflict_error.zs:8:7: 'Test' is already defined in this package!" - }; + final String errors[] = {"structure_union_name_conflict_error.zs:3:8: First defined here", + "structure_union_name_conflict_error.zs:8:7: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void subtypeStructureNameConflict() { - final String errors[] = - { - "subtype_structure_name_conflict_error.zs:3:15: First defined here", - "subtype_structure_name_conflict_error.zs:5:8: 'Test' is already defined in this package!" - }; + final String errors[] = {"subtype_structure_name_conflict_error.zs:3:15: First defined here", + "subtype_structure_name_conflict_error.zs:5:8: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void subtypeSubtypeNameConflict() { - final String errors[] = - { - "subtype_subtype_name_conflict_error.zs:3:15: First defined here", - "subtype_subtype_name_conflict_error.zs:5:16: 'Test' is already defined in this package!" - }; + final String errors[] = {"subtype_subtype_name_conflict_error.zs:3:15: First defined here", + "subtype_subtype_name_conflict_error.zs:5:16: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void unionUnionNameConflict() { - final String errors[] = - { - "union_union_name_conflict_error.zs:3:7: First defined here", - "union_union_name_conflict_error.zs:9:7: 'Test' is already defined in this package!" - }; + final String errors[] = {"union_union_name_conflict_error.zs:3:7: First defined here", + "union_union_name_conflict_error.zs:9:7: 'Test' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } diff --git a/test/errors/identifiers_error/java/identifiers_error/invalid_name/InvalidNameErrorTest.java b/test/errors/identifiers_error/java/identifiers_error/invalid_name/InvalidNameErrorTest.java index b8fe22108..fbce552e4 100644 --- a/test/errors/identifiers_error/java/identifiers_error/invalid_name/InvalidNameErrorTest.java +++ b/test/errors/identifiers_error/java/identifiers_error/invalid_name/InvalidNameErrorTest.java @@ -1,11 +1,12 @@ package identifiers_error.invalid_name; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class InvalidNameErrorTest @@ -19,8 +20,8 @@ public static void readZserioErrors() throws IOException @Test public void constName() { - final String error = "const_name_error.zs:3:13: " + - "Symbols defined in a package must start with an upper case letter!"; + final String error = "const_name_error.zs:3:13: " + + "Symbols defined in a package must start with an upper case letter!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/identifiers_error/java/identifiers_error/prefix_zserio/PrefixZserioErrorTest.java b/test/errors/identifiers_error/java/identifiers_error/prefix_zserio/PrefixZserioErrorTest.java index 9045436a3..d3e13827b 100644 --- a/test/errors/identifiers_error/java/identifiers_error/prefix_zserio/PrefixZserioErrorTest.java +++ b/test/errors/identifiers_error/java/identifiers_error/prefix_zserio/PrefixZserioErrorTest.java @@ -1,12 +1,13 @@ package identifiers_error.prefix_zserio; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.beans.Transient; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class PrefixZserioErrorTest @@ -20,96 +21,96 @@ public static void readZserioErrors() throws IOException @Test public void zserioPackageName() { - final String error = "zserio.zs:1:9: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "zserio.zs:1:9: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void zserioPrefixPackageName() { - final String error = "zserio_prefix_package_name_error.zs:1:9: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "zserio_prefix_package_name_error.zs:1:9: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void arrayFieldName() { - final String error = "array_field_name_error.zs:6:12: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "array_field_name_error.zs:6:12: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void choiceName() { - final String error = "choice_name_error.zs:9:8: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "choice_name_error.zs:9:8: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void constName() { - final String error = "const_name_error.zs:5:14: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "const_name_error.zs:5:14: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void fieldName() { - final String error = "field_name_error.zs:7:12: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "field_name_error.zs:7:12: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void functionName() { - final String error = "function_name_error.zs:12:19: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "function_name_error.zs:12:19: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void parameterName() { - final String error = "parameter_name_error.zs:8:26: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "parameter_name_error.zs:8:26: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void structName() { - final String error = "struct_name_error.zs:8:8: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "struct_name_error.zs:8:8: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void subtypeName() { - final String error = "subtype_name_error.zs:5:16: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "subtype_name_error.zs:5:16: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unionName() { - final String error = "union_name_error.zs:8:7: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "union_name_error.zs:8:7: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void zserioSubpackageName() { - final String error = "zserio_subpackage_name_error.zs:1:23: " + - "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; + final String error = "zserio_subpackage_name_error.zs:1:23: " + + "ZSERIO (case insensitive) is a reserved prefix and cannot be used in identifiers!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/identifiers_error/java/identifiers_error/reserved_keywords/ReservedKeywordsErrorTest.java b/test/errors/identifiers_error/java/identifiers_error/reserved_keywords/ReservedKeywordsErrorTest.java index 6751845f2..4651bf449 100644 --- a/test/errors/identifiers_error/java/identifiers_error/reserved_keywords/ReservedKeywordsErrorTest.java +++ b/test/errors/identifiers_error/java/identifiers_error/reserved_keywords/ReservedKeywordsErrorTest.java @@ -1,11 +1,12 @@ package identifiers_error.reserved_keywords; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ReservedKeywordsErrorTest @@ -19,59 +20,57 @@ public static void readZserioErrors() throws IOException @Test public void javaKeywordFieldName() { - final String error = "java_keyword_field_name_error.zs:6:13: " + - "Field 'abstract' clashes with a Java keyword and may not be used as an identifier!"; + final String error = "java_keyword_field_name_error.zs:6:13: " + + "Field 'abstract' clashes with a Java keyword and may not be used as an identifier!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cppKeywordFieldName() { - final String error = "cpp_keyword_field_name_error.zs:6:13: " + - "Field 'auto' clashes with a C++ keyword and may not be used as an identifier!"; + final String error = "cpp_keyword_field_name_error.zs:6:13: " + + "Field 'auto' clashes with a C++ keyword and may not be used as an identifier!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cppKeywordFunctionName() { - final String error = "cpp_keyword_function_name_error.zs:6:19: " + - "Function 'auto' clashes with a C++ keyword and may not be used as an identifier!"; + final String error = "cpp_keyword_function_name_error.zs:6:19: " + + "Function 'auto' clashes with a C++ keyword and may not be used as an identifier!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void cppKeywordStructName() { - final String error = "cpp_keyword_struct_name_error.zs:3:8: " + - "Symbols defined in a package must start with an upper case letter!"; + final String error = "cpp_keyword_struct_name_error.zs:3:8: " + + "Symbols defined in a package must start with an upper case letter!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void pythonKeywordFieldName() { - final String error = "python_keyword_field_name_error.zs:6:13: " + - "Field 'def' clashes with a Python keyword and may not be used as an identifier!"; + final String error = "python_keyword_field_name_error.zs:6:13: " + + "Field 'def' clashes with a Python keyword and may not be used as an identifier!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void pythonKeywordParameterName() { - final String error = "python_keyword_parameter_name_error.zs:3:20: " + - "Parameter 'def' clashes with a Python keyword and may not be used as an identifier!"; + final String error = "python_keyword_parameter_name_error.zs:3:20: " + + "Parameter 'def' clashes with a Python keyword and may not be used as an identifier!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void zserioKeywordFieldName() { - final String errors[] = - { - "zserio_keyword_field_name_error.zs:6:11: mismatched input 'varint' expecting {", // ... - "zserio_keyword_field_name_error.zs:6:11: 'varint' is a reserved keyword!" - }; + final String errors[] = { + "zserio_keyword_field_name_error.zs:6:11: mismatched input 'varint' expecting {", // ... + "zserio_keyword_field_name_error.zs:6:11: 'varint' is a reserved keyword!"}; assertTrue(zserioErrors.isPresent(errors)); } diff --git a/test/errors/indexed_offsets_error/build.xml b/test/errors/indexed_offsets_error/build.xml index 87b18efaa..2f33b6b06 100644 --- a/test/errors/indexed_offsets_error/build.xml +++ b/test/errors/indexed_offsets_error/build.xml @@ -33,7 +33,11 @@ - + + + + + diff --git a/test/errors/indexed_offsets_error/java/indexed_offsets_error/IndexedOffsetsErrorTest.java b/test/errors/indexed_offsets_error/java/indexed_offsets_error/IndexedOffsetsErrorTest.java index 2744a0449..3a98d5a1c 100644 --- a/test/errors/indexed_offsets_error/java/indexed_offsets_error/IndexedOffsetsErrorTest.java +++ b/test/errors/indexed_offsets_error/java/indexed_offsets_error/IndexedOffsetsErrorTest.java @@ -1,11 +1,12 @@ package indexed_offsets_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class IndexedOffsetsErrorTest @@ -74,40 +75,40 @@ public void optionalExpression() @Test public void packedComplexOffsetArray() { - final String error = "packed_complex_offset_array_error.zs:19:1: " + - "Packed array cannot be used as offset array!"; + final String error = "packed_complex_offset_array_error.zs:19:1: " + + "Packed array cannot be used as offset array!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void packedParamOffsetArray() { - final String error = "packed_param_offset_array_error.zs:18:1: " + - "Packed array cannot be used as offset array!"; + final String error = "packed_param_offset_array_error.zs:18:1: " + + "Packed array cannot be used as offset array!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void packedSimpleOffsetArray() { - final String error = "packed_simple_offset_array_error.zs:7:1: " + - "Packed array cannot be used as offset array!"; + final String error = "packed_simple_offset_array_error.zs:7:1: " + + "Packed array cannot be used as offset array!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void parameterNoArray() { - final String error = "parameter_no_array_error.zs:10:19: " + - "Index operator is not allowed in this context!"; + final String error = "parameter_no_array_error.zs:10:19: " + + "Index operator is not allowed in this context!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void varuintOffsetArray() { - final String error = "varuint_offset_array_error.zs:6:1: " + - "Offset expression for field 'fields' is not an unsigned fixed sized integer type!"; + final String error = "varuint_offset_array_error.zs:6:1: " + + "Offset expression for field 'fields' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/java_generator_error/build.xml b/test/errors/java_generator_error/build.xml index 210d9b0dd..4b8a5a5b0 100644 --- a/test/errors/java_generator_error/build.xml +++ b/test/errors/java_generator_error/build.xml @@ -25,7 +25,11 @@ - + + + + + diff --git a/test/errors/java_generator_error/java/JavaGeneratorErrorTest.java b/test/errors/java_generator_error/java/JavaGeneratorErrorTest.java index 6dbee2933..0bc424ca2 100644 --- a/test/errors/java_generator_error/java/JavaGeneratorErrorTest.java +++ b/test/errors/java_generator_error/java/JavaGeneratorErrorTest.java @@ -1,11 +1,12 @@ package java_generator_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class JavaGeneratorErrorTest @@ -19,18 +20,18 @@ public static void readZserioErrors() throws IOException @Test public void bitmaskValuesClassClash() { - final String error = "bitmask_values_class_clash_error.zs:4:15: " + - "Class name 'Values' generated for bitmask clashes with its inner class 'Values' " + - "generated in Java code."; + final String error = "bitmask_values_class_clash_error.zs:4:15: " + + "Class name 'Values' generated for bitmask clashes with its inner class 'Values' " + + "generated in Java code."; assertTrue(zserioErrors.isPresent(error)); } @Test public void sqlTableParameterProviderClassClash() { - final String error = "sql_table_parameter_provider_class_clash_error.zs:3:11: " + - "Class name 'ParameterProvider' generated for SQL table clashes with its inner class " + - "'ParameterProvider' generated in Java code."; + final String error = "sql_table_parameter_provider_class_clash_error.zs:3:11: " + + "Class name 'ParameterProvider' generated for SQL table clashes with its inner class " + + "'ParameterProvider' generated in Java code."; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/literals_error/build.xml b/test/errors/literals_error/build.xml index fe7b9cfac..db0369484 100644 --- a/test/errors/literals_error/build.xml +++ b/test/errors/literals_error/build.xml @@ -23,7 +23,11 @@ - + + + + + diff --git a/test/errors/literals_error/java/literals_error/LiteralsErrorTest.java b/test/errors/literals_error/java/literals_error/LiteralsErrorTest.java index 3b7a16b6c..1b21f3307 100644 --- a/test/errors/literals_error/java/literals_error/LiteralsErrorTest.java +++ b/test/errors/literals_error/java/literals_error/LiteralsErrorTest.java @@ -1,11 +1,12 @@ package literals_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class LiteralsErrorTest @@ -19,8 +20,8 @@ public static void readZserioErrors() throws IOException @Test public void hexadecimalStringLiteral() { - final String error = "hexadecimal_string_literal_error.zs:3:43: '\"This is wrong escaped hexadecimal " + - "character \\xWRONG\"' is an invalid string literal!"; + final String error = "hexadecimal_string_literal_error.zs:3:43: '\"This is wrong escaped hexadecimal " + + "character \\xWRONG\"' is an invalid string literal!"; assertTrue(zserioErrors.isPresent(error)); } @@ -29,32 +30,30 @@ public void multilineStringLiteral() { final String errors[] = { "multiline_string_literal_error.zs:3:41: '\"This is forbidden multiline string literal", - "which is not enclosed by quotes in each row.\"' is an invalid string literal!" - }; + "which is not enclosed by quotes in each row.\"' is an invalid string literal!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void octalStringLiteral() { - final String error = "octal_string_literal_error.zs:3:37: '\"This is wrong escaped octal character " + - "\\09\"' is an invalid string literal!"; + final String error = "octal_string_literal_error.zs:3:37: '\"This is wrong escaped octal character " + + "\\09\"' is an invalid string literal!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unicodeStringLiteral() { - final String error = "unicode_string_literal_error.zs:3:39: '\"This is wrong escaped unicode " + - "character \\uBAD\"' is an invalid string literal!"; + final String error = "unicode_string_literal_error.zs:3:39: '\"This is wrong escaped unicode " + + "character \\uBAD\"' is an invalid string literal!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongHexadecimalLiteral() { - final String error = - "wrong_hexadecimal_literal_error.zs:3:41: '0xWRONG' is an invalid token!"; + final String error = "wrong_hexadecimal_literal_error.zs:3:41: '0xWRONG' is an invalid token!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/member_access_error/build.xml b/test/errors/member_access_error/build.xml index 2f1c0215d..8bab52472 100644 --- a/test/errors/member_access_error/build.xml +++ b/test/errors/member_access_error/build.xml @@ -19,7 +19,11 @@ - + + + + + diff --git a/test/errors/member_access_error/java/member_access_error/MemberAccessErrorTest.java b/test/errors/member_access_error/java/member_access_error/MemberAccessErrorTest.java index f13193eb1..502320727 100644 --- a/test/errors/member_access_error/java/member_access_error/MemberAccessErrorTest.java +++ b/test/errors/member_access_error/java/member_access_error/MemberAccessErrorTest.java @@ -1,10 +1,11 @@ package member_access_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class MemberAccessErrorTest @@ -13,8 +14,8 @@ public class MemberAccessErrorTest public void wrongFieldName() throws IOException { final ZserioErrorOutput zserioErrors = new ZserioErrorOutput(); - final String error = "wrong_field_name_error.zs:6:34: " + - "Unresolved symbol 'wrongFieldName' within expression scope!"; + final String error = "wrong_field_name_error.zs:6:34: " + + "Unresolved symbol 'wrongFieldName' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @@ -22,8 +23,8 @@ public void wrongFieldName() throws IOException public void wrongFieldUsage() throws IOException { final ZserioErrorOutput zserioErrors = new ZserioErrorOutput(); - final String error = "wrong_field_usage_error.zs:5:34: " + - "Unresolved symbol 'data' within expression scope!"; + final String error = "wrong_field_usage_error.zs:5:34: " + + "Unresolved symbol 'data' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } } diff --git a/test/errors/offsets_error/build.xml b/test/errors/offsets_error/build.xml index fcf68ff7b..92f6fc716 100644 --- a/test/errors/offsets_error/build.xml +++ b/test/errors/offsets_error/build.xml @@ -29,7 +29,11 @@ - + + + + + diff --git a/test/errors/offsets_error/java/offsets_error/OffsetsErrorTest.java b/test/errors/offsets_error/java/offsets_error/OffsetsErrorTest.java index 5c90b8c61..5b4153bd9 100644 --- a/test/errors/offsets_error/java/offsets_error/OffsetsErrorTest.java +++ b/test/errors/offsets_error/java/offsets_error/OffsetsErrorTest.java @@ -1,11 +1,12 @@ package offsets_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class OffsetsErrorTest @@ -19,16 +20,16 @@ public static void readZserioErrors() throws IOException @Test public void arrayNoIndex() { - final String error = "array_no_index_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "array_no_index_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void builtinTypeParameter() { - final String error = "builtin_type_parameter_error.zs:6:1: " + - "Built-in type parameter 'param' cannot be used as an offset!"; + final String error = "builtin_type_parameter_error.zs:6:1: " + + "Built-in type parameter 'param' cannot be used as an offset!"; assertTrue(zserioErrors.isPresent(error)); } @@ -42,8 +43,8 @@ public void constant() @Test public void floatError() { - final String error = "float_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "float_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } @@ -64,48 +65,48 @@ public void packed_offset_array() @Test public void signed_bitfield() { - final String error = "signed_bitfield_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "signed_bitfield_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void signed_integer() { - final String error = "signed_integer_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "signed_integer_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void string() { - final String error = "string_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "string_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void ternaryOperatorError() { - final String error = "ternary_operator_error.zs:8:1: " + - "Ternary operator cannot be used for offset setting!"; + final String error = "ternary_operator_error.zs:8:1: " + + "Ternary operator cannot be used for offset setting!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void varint() { - final String error = "varint_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "varint_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void varuint() { - final String error = "varuint_error.zs:6:1: " + - "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; + final String error = "varuint_error.zs:6:1: " + + "Offset expression for field 'values' is not an unsigned fixed sized integer type!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/optional_members_error/build.xml b/test/errors/optional_members_error/build.xml index 7fe3aabdf..9a9e1d39b 100644 --- a/test/errors/optional_members_error/build.xml +++ b/test/errors/optional_members_error/build.xml @@ -27,7 +27,11 @@ - + + + + + diff --git a/test/errors/optional_members_error/java/optional_members_error/OptionalMembersErrorTest.java b/test/errors/optional_members_error/java/optional_members_error/OptionalMembersErrorTest.java index 38033dd5f..669808378 100644 --- a/test/errors/optional_members_error/java/optional_members_error/OptionalMembersErrorTest.java +++ b/test/errors/optional_members_error/java/optional_members_error/OptionalMembersErrorTest.java @@ -1,11 +1,12 @@ package optional_members_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class OptionalMembersErrorTest @@ -19,40 +20,40 @@ public static void readZserioErrors() throws IOException @Test public void autoOptionalWithExpression() { - final String error = "auto_optional_with_expression_error.zs:6:39: " + - "Auto optional field 'autoOptionalValue' cannot contain if clause!"; + final String error = "auto_optional_with_expression_error.zs:6:39: " + + "Auto optional field 'autoOptionalValue' cannot contain if clause!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void compoundFieldNotAvailable() { - final String error = "compound_field_not_available_error.zs:7:23: " + - "Unresolved symbol 'header2' within expression scope!"; + final String error = "compound_field_not_available_error.zs:7:23: " + + "Unresolved symbol 'header2' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void fieldItselfNotAvailable() { - final String error = "field_itself_not_available_error.zs:6:26: " + - "Unresolved symbol 'extraData' within expression scope!"; + final String error = "field_itself_not_available_error.zs:6:26: " + + "Unresolved symbol 'extraData' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void fieldNotAvailable() { - final String error = "field_not_available_error.zs:7:28: " + - "Unresolved symbol 'hasSpecialData' within expression scope!"; + final String error = "field_not_available_error.zs:7:28: " + + "Unresolved symbol 'hasSpecialData' within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void noneBooleanExpression() { - final String error = "none_boolean_expression_error.zs:6:34: " + - "Optional expression for field 'optionalValue' is not boolean!"; + final String error = "none_boolean_expression_error.zs:6:34: " + + "Optional expression for field 'optionalValue' is not boolean!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/packages_error/build.xml b/test/errors/packages_error/build.xml index cc503c536..77fbecf5f 100644 --- a/test/errors/packages_error/build.xml +++ b/test/errors/packages_error/build.xml @@ -30,7 +30,11 @@ - + + + + + diff --git a/test/errors/packages_error/java/packages_error/PackagesErrorTest.java b/test/errors/packages_error/java/packages_error/PackagesErrorTest.java index 47454adba..1d3d85979 100644 --- a/test/errors/packages_error/java/packages_error/PackagesErrorTest.java +++ b/test/errors/packages_error/java/packages_error/PackagesErrorTest.java @@ -1,11 +1,12 @@ package packages_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class PackagesErrorTest @@ -19,32 +20,26 @@ public static void readZserioErrors() throws IOException @Test public void ambiguousSingleSymbolImport() { - final String errors[] = - { - "imported.zs:3:14: Found here", - "ambiguous_single_symbol_import_error.zs:5:14: Found here", - "ambiguous_single_symbol_import_error.zs:9:20: Ambiguous symbol 'CONST'" - }; + final String errors[] = {"imported.zs:3:14: Found here", + "ambiguous_single_symbol_import_error.zs:5:14: Found here", + "ambiguous_single_symbol_import_error.zs:9:20: Ambiguous symbol 'CONST'"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void ambiguousSingleTypeImport() { - final String errors[] = - { - "imported.zs:3:8: Found here", - "ambiguous_single_type_import_error.zs:5:8: Found here", - "ambiguous_single_type_import_error.zs:12:5: Ambiguous symbol 'Structure'" - }; + final String errors[] = {"imported.zs:3:8: Found here", + "ambiguous_single_type_import_error.zs:5:8: Found here", + "ambiguous_single_type_import_error.zs:12:5: Ambiguous symbol 'Structure'"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void defaultPackageWithDir() { - final String error = "default_package.zs:1:1: Default package cannot be compiled with path! " + - "Consider to specify package name or set source path to 'default_package_with_path_error'."; + final String error = "default_package.zs:1:1: Default package cannot be compiled with path! " + + "Consider to specify package name or set source path to 'default_package_with_path_error'."; assertTrue(zserioErrors.isPresent(error)); } @@ -58,8 +53,8 @@ public void importedDefaultPackage() @Test public void importedUnknownSingleType() { - final String error = "imported_unknown_single_type_error.zs:4:8: " + - "Unresolved import of 'simple_database.UnknownTable'!"; + final String error = "imported_unknown_single_type_error.zs:4:8: " + + "Unresolved import of 'simple_database.UnknownTable'!"; assertTrue(zserioErrors.isPresent(error)); } @@ -80,8 +75,8 @@ public void transitiveImport() @Test public void upperCaseLetterInPackageName() { - final String error = "upper_case_letter_in_Package_name_error.zs:1:9: " + - "Package name cannot contain upper case letters!"; + final String error = "upper_case_letter_in_Package_name_error.zs:1:9: " + + "Package name cannot contain upper case letters!"; assertTrue(zserioErrors.isPresent(error)); } @@ -95,8 +90,8 @@ public void wrongImportName() @Test public void wrongPackageName() { - final String error = "bad_package_name.zs:2:9: Package 'bad_really_bad' does not match to the source " + - "file name!"; + final String error = "bad_package_name.zs:2:9: Package 'bad_really_bad' does not match to the source " + + "file name!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/parameterized_types_error/build.xml b/test/errors/parameterized_types_error/build.xml index 19311ffc2..3a1face88 100644 --- a/test/errors/parameterized_types_error/build.xml +++ b/test/errors/parameterized_types_error/build.xml @@ -43,7 +43,12 @@ - + + + + + diff --git a/test/errors/parameterized_types_error/java/parameterized_types_error/ParameterizedTypesErrorTest.java b/test/errors/parameterized_types_error/java/parameterized_types_error/ParameterizedTypesErrorTest.java index fbdd22062..26fd7e775 100644 --- a/test/errors/parameterized_types_error/java/parameterized_types_error/ParameterizedTypesErrorTest.java +++ b/test/errors/parameterized_types_error/java/parameterized_types_error/ParameterizedTypesErrorTest.java @@ -1,11 +1,12 @@ package parameterized_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ParameterizedTypesErrorTest @@ -33,24 +34,20 @@ public void noParameters() @Test public void referencedBuiltInType() { - final String[] errors = { - "referenced_builtin_type_error.zs:3:9: See 'uint32' definition here", - "referenced_builtin_type_error.zs:3:16: See subtype 'Item' definition here", - "referenced_builtin_type_error.zs:5:14: See subtype 'Subtype' definition here", - "referenced_builtin_type_error.zs:10:5: " + - "Referenced type 'Subtype' is not a parameterized type!" - }; + final String[] errors = {"referenced_builtin_type_error.zs:3:9: See 'uint32' definition here", + "referenced_builtin_type_error.zs:3:16: See subtype 'Item' definition here", + "referenced_builtin_type_error.zs:5:14: See subtype 'Subtype' definition here", + "referenced_builtin_type_error.zs:10:5: " + + "Referenced type 'Subtype' is not a parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void referencedEnumType() { - final String[] errors = { - "referenced_enum_type_error.zs:3:13: See 'Item' definition here", - "referenced_enum_type_error.zs:12:5: " + - "Referenced type 'Item' is not a parameterized type!" - }; + final String[] errors = {"referenced_enum_type_error.zs:3:13: See 'Item' definition here", + "referenced_enum_type_error.zs:12:5: " + + "Referenced type 'Item' is not a parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -58,21 +55,18 @@ public void referencedEnumType() public void referencedNonParameterizedType() { final String[] errors = { - "referenced_non_parameterized_type_error.zs:3:8: See 'Item' definition here", - "referenced_non_parameterized_type_error.zs:12:5: " + - "Referenced type 'Item' is not a parameterized type!" - }; + "referenced_non_parameterized_type_error.zs:3:8: See 'Item' definition here", + "referenced_non_parameterized_type_error.zs:12:5: " + + "Referenced type 'Item' is not a parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void referencedParameterizedType() { - final String[] errors = { - "referenced_parameterized_type_error.zs:3:8: See 'Item' definition here", - "referenced_parameterized_type_error.zs:12:5: " + - "Referenced type 'Item' is defined as parameterized type!" - }; + final String[] errors = {"referenced_parameterized_type_error.zs:3:8: See 'Item' definition here", + "referenced_parameterized_type_error.zs:12:5: " + + "Referenced type 'Item' is defined as parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -87,56 +81,54 @@ public void referencedUnknownParameterizedType() @Test public void wrongArgumentType() { - final String error = "wrong_argument_type_error.zs:12:10: " + - "Wrong type of value expression (float cannot be assigned to uint32)!"; + final String error = "wrong_argument_type_error.zs:12:10: " + + "Wrong type of value expression (float cannot be assigned to uint32)!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongBitmaskArgumentType() { - final String error = "wrong_bitmask_argument_type_error.zs:25:19: " + - "Wrong type of value expression ('Bitmask2' cannot be assigned to 'Bitmask1')!"; + final String error = "wrong_bitmask_argument_type_error.zs:25:19: " + + "Wrong type of value expression ('Bitmask2' cannot be assigned to 'Bitmask1')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongCompoundArgumentType() { - final String error = "wrong_compound_argument_type_error.zs:23:19: " + - "Wrong type of value expression ('Param2' cannot be assigned to 'Param1')!"; + final String error = "wrong_compound_argument_type_error.zs:23:19: " + + "Wrong type of value expression ('Param2' cannot be assigned to 'Param1')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void wrongEnumArgumentType() { - final String error = "wrong_enum_argument_type_error.zs:25:19: " + - "Wrong type of value expression ('Enum2' cannot be assigned to 'Enum1')!"; + final String error = "wrong_enum_argument_type_error.zs:25:19: " + + "Wrong type of value expression ('Enum2' cannot be assigned to 'Enum1')!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void tooFewArguments() { - final String[] errors = { - "too_few_arguments_error.zs:3:8: See 'Item' definition here", - "too_few_arguments_error.zs:13:5: " + - "Parameterized type instantiation of 'Item' has too few arguments! Expecting 2, got 1!" - }; + final String[] errors = {"too_few_arguments_error.zs:3:8: See 'Item' definition here", + "too_few_arguments_error.zs:13:5: " + + + "Parameterized type instantiation of 'Item' has too few arguments! Expecting 2, got 1!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void tooManyArguments() { - final String[] errors = { - "too_many_arguments_error.zs:3:8: See 'Item' definition here", - "too_many_arguments_error.zs:9:26: See template instantiation 'ItemU16' definition here", - "too_many_arguments_error.zs:11:17: See subtype 'Subtype' definition here", - "too_many_arguments_error.zs:17:5: " + - "Parameterized type instantiation of 'Subtype' has too many arguments! Expecting 1, got 2!" - }; + final String[] errors = {"too_many_arguments_error.zs:3:8: See 'Item' definition here", + "too_many_arguments_error.zs:9:26: See template instantiation 'ItemU16' definition here", + "too_many_arguments_error.zs:11:17: See subtype 'Subtype' definition here", + "too_many_arguments_error.zs:17:5: " + + + "Parameterized type instantiation of 'Subtype' has too many arguments! Expecting 1, got 2!"}; assertTrue(zserioErrors.isPresent(errors)); } diff --git a/test/errors/pubsub_types_error/build.xml b/test/errors/pubsub_types_error/build.xml index 7878ca08e..713c94235 100644 --- a/test/errors/pubsub_types_error/build.xml +++ b/test/errors/pubsub_types_error/build.xml @@ -25,7 +25,11 @@ - + + + + + diff --git a/test/errors/pubsub_types_error/java/pubsub_types_error/PubsubTypesErrorTest.java b/test/errors/pubsub_types_error/java/pubsub_types_error/PubsubTypesErrorTest.java index cecf5f9a6..f7c1c292b 100644 --- a/test/errors/pubsub_types_error/java/pubsub_types_error/PubsubTypesErrorTest.java +++ b/test/errors/pubsub_types_error/java/pubsub_types_error/PubsubTypesErrorTest.java @@ -1,11 +1,12 @@ package pubsub_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class PubsubTypesErrorTest @@ -19,29 +20,26 @@ public static void readZserioErrors() throws IOException @Test public void builtinType() { - final String error = "builtin_type_error.zs:5:36: " + - "Only non-parameterized compound types or bytes can be used in pubsub messages, " + - "'int32' is not a compound type!"; + final String error = "builtin_type_error.zs:5:36: " + + "Only non-parameterized compound types or bytes can be used in pubsub messages, " + + "'int32' is not a compound type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void choiceType() { - final String error = "choice_type_error.zs:14:36: " + - "Only non-parameterized compound types or bytes can be used in pubsub messages, " + - "'Data' is a parameterized type!"; + final String error = "choice_type_error.zs:14:36: " + + "Only non-parameterized compound types or bytes can be used in pubsub messages, " + + "'Data' is a parameterized type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void duplicatedMethod() { - final String errors[] = - { - "duplicated_method_error.zs:15:44: First defined here", - "duplicated_method_error.zs:16:44: 'powerOfTwo' is already defined in this scope!" - }; + final String errors[] = {"duplicated_method_error.zs:15:44: First defined here", + "duplicated_method_error.zs:16:44: 'powerOfTwo' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -56,34 +54,34 @@ public void invalidIntegerTopic() @Test public void nonCompoundSubtype() { - final String error = "non_compound_subtype_error.zs:7:38: " + - "Only non-parameterized compound types or bytes can be used in pubsub messages, " + - "'Data' is not a compound type!"; + final String error = "non_compound_subtype_error.zs:7:38: " + + "Only non-parameterized compound types or bytes can be used in pubsub messages, " + + "'Data' is not a compound type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void parameterizedStruct() { - final String error = "parameterized_struct_error.zs:11:38: " + - "Only non-parameterized compound types or bytes can be used in pubsub messages, " + - "'Data' is a parameterized type!"; + final String error = "parameterized_struct_error.zs:11:38: " + + "Only non-parameterized compound types or bytes can be used in pubsub messages, " + + "'Data' is a parameterized type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void sqlDatabaseType() { - final String error = "sql_database_type_error.zs:15:36: " + - "Invalid usage of SQL database 'Data' as a type!"; + final String error = "sql_database_type_error.zs:15:36: " + + "Invalid usage of SQL database 'Data' as a type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void sqlTableType() { - final String error = "sql_table_type_error.zs:10:28: " + - "SQL table 'Data' cannot be used in pubsub messages!"; + final String error = "sql_table_type_error.zs:10:28: " + + "SQL table 'Data' cannot be used in pubsub messages!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/rules_error/build.xml b/test/errors/rules_error/build.xml index 2c5ec80a7..4dd6c426c 100644 --- a/test/errors/rules_error/build.xml +++ b/test/errors/rules_error/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/errors/rules_error/java/rules_error/RulesErrorTest.java b/test/errors/rules_error/java/rules_error/RulesErrorTest.java index ba4afd138..1c35a875f 100644 --- a/test/errors/rules_error/java/rules_error/RulesErrorTest.java +++ b/test/errors/rules_error/java/rules_error/RulesErrorTest.java @@ -1,11 +1,12 @@ package rules_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class RulesErrorTest @@ -19,51 +20,44 @@ public static void readZserioErrors() throws IOException @Test public void duplicatedIdBetweenPackages() { - final String errors[] = - { - "duplicated_id_between_packages_error.zs:11:10: Conflicting rule defined here", - "package_rules.zs:13:10: Rule ID 'rule-two' is not unique (case insensitive) between all packages!" - }; + final String errors[] = { + "duplicated_id_between_packages_error.zs:11:10: Conflicting rule defined here", + "package_rules.zs:13:10: Rule ID 'rule-two' is not unique (case insensitive) between all packages!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void duplicatedIdWithinGroup() { - final String errors[] = - { - "duplicated_id_within_group_error.zs:6:10: Conflicting rule defined here", - "duplicated_id_within_group_error.zs:12:10: Rule ID 'rule-one' is not unique (case insensitive) " + - "within a package!" - }; + final String errors[] = {"duplicated_id_within_group_error.zs:6:10: Conflicting rule defined here", + "duplicated_id_within_group_error.zs:12:10: Rule ID 'rule-one' is not unique (case insensitive) " + + "within a package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void duplicatedIdWithinPackage() { - final String errors[] = - { - "duplicated_id_within_package_error.zs:6:10: Conflicting rule defined here", - "duplicated_id_within_package_error.zs:15:10: Rule ID 'rule-ONE' is not unique (case " + - "insensitive) within a package!" - }; + final String errors[] = { + "duplicated_id_within_package_error.zs:6:10: Conflicting rule defined here", + "duplicated_id_within_package_error.zs:15:10: Rule ID 'rule-ONE' is not unique (case " + + "insensitive) within a package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void idInvalidExpressionType() { - final String error = "id_invalid_expression_type_error.zs:5:10: " + - "Rule identifier must be a constant string expression!"; + final String error = "id_invalid_expression_type_error.zs:5:10: " + + "Rule identifier must be a constant string expression!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void invalidIdFormatError() { - final String error = "invalid_id_format_error.zs:5:10: Invalid rule identifier! " + - "Rule identifier must match pattern '[a-zA-Z][a-zA-Z0-9_:.-]*'!"; + final String error = "invalid_id_format_error.zs:5:10: Invalid rule identifier! " + + "Rule identifier must match pattern '[a-zA-Z][a-zA-Z0-9_:.-]*'!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/service_types_error/build.xml b/test/errors/service_types_error/build.xml index f4875790e..15666c8cd 100644 --- a/test/errors/service_types_error/build.xml +++ b/test/errors/service_types_error/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/errors/service_types_error/java/service_types_error/ServiceTypesErrorTest.java b/test/errors/service_types_error/java/service_types_error/ServiceTypesErrorTest.java index f2fe9805f..b4d020f14 100644 --- a/test/errors/service_types_error/java/service_types_error/ServiceTypesErrorTest.java +++ b/test/errors/service_types_error/java/service_types_error/ServiceTypesErrorTest.java @@ -1,11 +1,12 @@ package service_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ServiceTypesErrorTest @@ -19,63 +20,60 @@ public static void readZserioErrors() throws IOException @Test public void builtinType() { - final String error = "builtin_type_error.zs:10:25: " + - "Only non-parameterized compound types or bytes can be used in service methods, " + - "'int32' is not a compound type!"; + final String error = "builtin_type_error.zs:10:25: " + + "Only non-parameterized compound types or bytes can be used in service methods, " + + "'int32' is not a compound type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void choiceType() { - final String error = "choice_type_error.zs:19:25: " + - "Only non-parameterized compound types or bytes can be used in service methods, " + - "'Request' is a parameterized type!"; + final String error = "choice_type_error.zs:19:25: " + + "Only non-parameterized compound types or bytes can be used in service methods, " + + "'Request' is a parameterized type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void duplicatedMethod() { - final String errors[] = - { - "duplicated_method_error.zs:20:14: First defined here", - "duplicated_method_error.zs:21:14: 'powerOfTwo' is already defined in this scope!" - }; + final String errors[] = {"duplicated_method_error.zs:20:14: First defined here", + "duplicated_method_error.zs:21:14: 'powerOfTwo' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void nonCompoundSubtype() { - final String error = "non_compound_subtype_error.zs:12:25: " + - "Only non-parameterized compound types or bytes can be used in service methods, " + - "'Request' is not a compound type!"; + final String error = "non_compound_subtype_error.zs:12:25: " + + "Only non-parameterized compound types or bytes can be used in service methods, " + + "'Request' is not a compound type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void parameterizedStruct() { - final String error = "parameterized_struct_error.zs:16:25: " + - "Only non-parameterized compound types or bytes can be used in service methods, " + - "'Request' is a parameterized type!"; + final String error = "parameterized_struct_error.zs:16:25: " + + "Only non-parameterized compound types or bytes can be used in service methods, " + + "'Request' is a parameterized type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void sqlDatabaseType() { - final String error = "sql_database_type_error.zs:20:25: " + - "Invalid usage of SQL database 'Request' as a type!"; + final String error = "sql_database_type_error.zs:20:25: " + + "Invalid usage of SQL database 'Request' as a type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void sqlTableType() { - final String error = "sql_table_type_error.zs:15:25: " + - "SQL table 'Request' cannot be used in service methods!"; + final String error = "sql_table_type_error.zs:15:25: " + + "SQL table 'Request' cannot be used in service methods!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/sql_constraints_error/build.xml b/test/errors/sql_constraints_error/build.xml index 64c5c0392..a339f0708 100644 --- a/test/errors/sql_constraints_error/build.xml +++ b/test/errors/sql_constraints_error/build.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/test/errors/sql_constraints_error/java/sql_constraints_error/SqlConstraintsErrorTest.java b/test/errors/sql_constraints_error/java/sql_constraints_error/SqlConstraintsErrorTest.java index d48e06829..f4290ebbc 100644 --- a/test/errors/sql_constraints_error/java/sql_constraints_error/SqlConstraintsErrorTest.java +++ b/test/errors/sql_constraints_error/java/sql_constraints_error/SqlConstraintsErrorTest.java @@ -1,11 +1,12 @@ package sql_constraints_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlConstraintsErrorTest @@ -19,16 +20,16 @@ public static void readZserioErrors() throws IOException @Test public void invalidIntegerConstraint() { - final String error = "invalid_integer_constraint_error.zs:6:37: SQL constraint expression must be " + - "a constant string!"; + final String error = "invalid_integer_constraint_error.zs:6:37: SQL constraint expression must be " + + "a constant string!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void invalidStringConstraint() { - final String error = "invalid_string_constraint_error.zs:7:33: SQL constraint expression must be " + - "a constant string!"; + final String error = "invalid_string_constraint_error.zs:7:33: SQL constraint expression must be " + + "a constant string!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/sql_databases_error/build.xml b/test/errors/sql_databases_error/build.xml index 68380a56c..562fbb741 100644 --- a/test/errors/sql_databases_error/build.xml +++ b/test/errors/sql_databases_error/build.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/test/errors/sql_databases_error/java/sql_databases_error/SqlDatabasesErrorTest.java b/test/errors/sql_databases_error/java/sql_databases_error/SqlDatabasesErrorTest.java index f1a3d8aa9..04f8c16d0 100644 --- a/test/errors/sql_databases_error/java/sql_databases_error/SqlDatabasesErrorTest.java +++ b/test/errors/sql_databases_error/java/sql_databases_error/SqlDatabasesErrorTest.java @@ -1,11 +1,12 @@ package sql_databases_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlDatabasesErrorTest @@ -19,8 +20,8 @@ public static void readZserioErrors() throws IOException @Test public void databaseField() { - final String error = "database_field_error.zs:20:5: " + - "Invalid usage of SQL database 'TestDatabase' as a type!"; + final String error = "database_field_error.zs:20:5: " + + "Invalid usage of SQL database 'TestDatabase' as a type!"; assertTrue(zserioErrors.isPresent(error)); } @@ -41,8 +42,8 @@ public void structureField() @Test public void subtypedStructureField() { - final String error = "subtyped_structure_field_error.zs:15:23: " + - "Field 'subtypedTestStructure' is not a sql table!"; + final String error = "subtyped_structure_field_error.zs:15:23: " + + "Field 'subtypedTestStructure' is not a sql table!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/sql_tables_error/build.xml b/test/errors/sql_tables_error/build.xml index 85c54a789..8e28e5d47 100644 --- a/test/errors/sql_tables_error/build.xml +++ b/test/errors/sql_tables_error/build.xml @@ -29,7 +29,11 @@ - + + + + + diff --git a/test/errors/sql_tables_error/java/sql_tables_error/SqlTablesErrorTest.java b/test/errors/sql_tables_error/java/sql_tables_error/SqlTablesErrorTest.java index f67338fb0..fe6f5b2a2 100644 --- a/test/errors/sql_tables_error/java/sql_tables_error/SqlTablesErrorTest.java +++ b/test/errors/sql_tables_error/java/sql_tables_error/SqlTablesErrorTest.java @@ -1,11 +1,12 @@ package sql_tables_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlTablesErrorTest @@ -26,19 +27,16 @@ public void databaseArrayField() @Test public void databaseField() { - final String error = "database_field_error.zs:20:5: " + - "Invalid usage of SQL database 'TestDatabase' as a type!"; + final String error = "database_field_error.zs:20:5: " + + "Invalid usage of SQL database 'TestDatabase' as a type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void duplicatedFieldName() { - final String errors[] = - { - "duplicated_field_name_error.zs:5:13: First defined here", - "duplicated_field_name_error.zs:7:13: 'columnA' is already defined in this scope!" - }; + final String errors[] = {"duplicated_field_name_error.zs:5:13: First defined here", + "duplicated_field_name_error.zs:7:13: 'columnA' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -66,8 +64,8 @@ public void tableFieldConstraint() @Test public void subtypedTableField() { - final String error = "subtyped_table_field_error.zs:17:19: " + - "Field 'subtypedTestTable' cannot be a sql table!"; + final String error = "subtyped_table_field_error.zs:17:19: " + + "Field 'subtypedTestTable' cannot be a sql table!"; assertTrue(zserioErrors.isPresent(error)); } @@ -88,24 +86,24 @@ public void tableField() @Test public void unknownPrimaryKeyColumn() { - final String error = "unknown_primary_key_column_error.zs:9:9: " + - "Primary key column 'unknownColumn' not found in sql table 'TestTable'!"; + final String error = "unknown_primary_key_column_error.zs:9:9: " + + "Primary key column 'unknownColumn' not found in sql table 'TestTable'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unknownUniqueColumn() { - final String error = "unknown_unique_column_error.zs:9:9: " + - "Unique column 'unknownColumn' not found in sql table 'TestTable'!"; + final String error = "unknown_unique_column_error.zs:9:9: " + + "Unique column 'unknownColumn' not found in sql table 'TestTable'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void virtualColumn() { - final String error = "virtual_column_error.zs:6:25: " + - "Ordinary table 'TestTable' cannot contain virtual column 'columnB'!"; + final String error = "virtual_column_error.zs:6:25: " + + "Ordinary table 'TestTable' cannot contain virtual column 'columnB'!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/sql_virtual_tables_error/build.xml b/test/errors/sql_virtual_tables_error/build.xml index 40af47dd2..99f8753d6 100644 --- a/test/errors/sql_virtual_tables_error/build.xml +++ b/test/errors/sql_virtual_tables_error/build.xml @@ -19,7 +19,12 @@ - + + + + + diff --git a/test/errors/sql_virtual_tables_error/java/sql_virtual_tables_error/SqlVirtualTablesErrorTest.java b/test/errors/sql_virtual_tables_error/java/sql_virtual_tables_error/SqlVirtualTablesErrorTest.java index 98a4c12d9..67a59afce 100644 --- a/test/errors/sql_virtual_tables_error/java/sql_virtual_tables_error/SqlVirtualTablesErrorTest.java +++ b/test/errors/sql_virtual_tables_error/java/sql_virtual_tables_error/SqlVirtualTablesErrorTest.java @@ -1,11 +1,12 @@ package sql_virtual_tables_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlVirtualTablesErrorTest diff --git a/test/errors/sql_without_rowid_tables_error/build.xml b/test/errors/sql_without_rowid_tables_error/build.xml index 11255f8cd..1466e54b5 100644 --- a/test/errors/sql_without_rowid_tables_error/build.xml +++ b/test/errors/sql_without_rowid_tables_error/build.xml @@ -20,7 +20,12 @@ srcPath="${sql_without_rowid_tables_error.base_dir}/java"/> - + + + + + diff --git a/test/errors/sql_without_rowid_tables_error/java/sql_without_rowid_tables_error/SqlWithoutRowIdTablesErrorTest.java b/test/errors/sql_without_rowid_tables_error/java/sql_without_rowid_tables_error/SqlWithoutRowIdTablesErrorTest.java index dd5535792..bb311d221 100644 --- a/test/errors/sql_without_rowid_tables_error/java/sql_without_rowid_tables_error/SqlWithoutRowIdTablesErrorTest.java +++ b/test/errors/sql_without_rowid_tables_error/java/sql_without_rowid_tables_error/SqlWithoutRowIdTablesErrorTest.java @@ -1,11 +1,12 @@ package sql_without_rowid_tables_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlWithoutRowIdTablesErrorTest @@ -19,8 +20,8 @@ public static void readZserioErrors() throws IOException @Test public void noPrimaryKeyColumn() { - final String error = "no_primary_key_column_error.zs:4:11: " + - "No primary key in without rowid table 'WrongWithoutRowIdTable'!"; + final String error = "no_primary_key_column_error.zs:4:11: " + + "No primary key in without rowid table 'WrongWithoutRowIdTable'!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/structure_types_error/build.xml b/test/errors/structure_types_error/build.xml index 87503b8d2..e78af78e3 100644 --- a/test/errors/structure_types_error/build.xml +++ b/test/errors/structure_types_error/build.xml @@ -31,7 +31,11 @@ - + + + + + diff --git a/test/errors/structure_types_error/java/structure_types_error/StructureTypesErrorTest.java b/test/errors/structure_types_error/java/structure_types_error/StructureTypesErrorTest.java index 584bf105a..24d4da373 100644 --- a/test/errors/structure_types_error/java/structure_types_error/StructureTypesErrorTest.java +++ b/test/errors/structure_types_error/java/structure_types_error/StructureTypesErrorTest.java @@ -1,11 +1,12 @@ package structure_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class StructureTypesErrorTest @@ -27,40 +28,40 @@ public void constantUsedAsType() @Test public void databaseArrayField() { - final String error = "database_array_field_error.zs:20:5: " + - "Invalid usage of SQL database 'TestDatabaseForArray' as a type!"; + final String error = "database_array_field_error.zs:20:5: " + + "Invalid usage of SQL database 'TestDatabaseForArray' as a type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void implicitNonArray() { - final String error = "implicit_non_array_field_error.zs:6:5: " + - "Implicit keyword can be used only for arrays!"; + final String error = "implicit_non_array_field_error.zs:6:5: " + + "Implicit keyword can be used only for arrays!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void indirectArrayRecursion() { - final String error = "indirect_array_recursion_error.zs:13:17: " + - "Indirect recursion between 'Item' and 'ItemHolder'!"; + final String error = "indirect_array_recursion_error.zs:13:17: " + + "Indirect recursion between 'Item' and 'ItemHolder'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void indirectRecursion() { - final String error = "indirect_recursion_error.zs:13:17: " + - "Indirect recursion between 'Item' and 'ItemHolder'!"; + final String error = "indirect_recursion_error.zs:13:17: " + + "Indirect recursion between 'Item' and 'ItemHolder'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void recursive() { - final String error = "recursive_error.zs:7:17: " + - "Field 'item' is recursive and neither optional nor array which can be empty!"; + final String error = "recursive_error.zs:7:17: " + + "Field 'item' is recursive and neither optional nor array which can be empty!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/subtypes_error/build.xml b/test/errors/subtypes_error/build.xml index cc58852bf..6402d08ed 100644 --- a/test/errors/subtypes_error/build.xml +++ b/test/errors/subtypes_error/build.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/test/errors/subtypes_error/java/subtypes_error/SubtypesErrorTest.java b/test/errors/subtypes_error/java/subtypes_error/SubtypesErrorTest.java index 4e9daccb3..d4313f2b9 100644 --- a/test/errors/subtypes_error/java/subtypes_error/SubtypesErrorTest.java +++ b/test/errors/subtypes_error/java/subtypes_error/SubtypesErrorTest.java @@ -1,11 +1,12 @@ package subtypes_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SubtypesErrorTest @@ -19,36 +20,33 @@ public static void readZserioErrors() throws IOException @Test public void databaseSubtype() { - final String error = "database_subtype_error.zs:13:9: " + - "Invalid usage of SQL database 'TestDatabase' as a type!"; + final String error = "database_subtype_error.zs:13:9: " + + "Invalid usage of SQL database 'TestDatabase' as a type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void parameterizedSubtype() { - final String error = "parameterized_subtype_error.zs:12:5: " + - "Referenced type 'Subtype' is defined as parameterized type!"; + final String error = "parameterized_subtype_error.zs:12:5: " + + "Referenced type 'Subtype' is defined as parameterized type!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void simpleCyclicDependency() { - final String error = "simple_cyclic_dependency_error.zs:3:11: " + - "Cyclic dependency detected in subtype 'X'!"; + final String error = "simple_cyclic_dependency_error.zs:3:11: " + + "Cyclic dependency detected in subtype 'X'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void transitiveCyclicDependency() { - final String errors[] = - { - "transitive_cyclic_dependency_error.zs:4:11: Through subtype 'Z' here", - "transitive_cyclic_dependency_error.zs:5:11: Through subtype 'X' here", - "transitive_cyclic_dependency_error.zs:3:11: Cyclic dependency detected in subtype 'Y'!" - }; + final String errors[] = {"transitive_cyclic_dependency_error.zs:4:11: Through subtype 'Z' here", + "transitive_cyclic_dependency_error.zs:5:11: Through subtype 'X' here", + "transitive_cyclic_dependency_error.zs:3:11: Cyclic dependency detected in subtype 'Y'!"}; assertTrue(zserioErrors.isPresent(errors)); } diff --git a/test/errors/syntax_error/build.xml b/test/errors/syntax_error/build.xml index 6b16441bd..54c52a7d9 100644 --- a/test/errors/syntax_error/build.xml +++ b/test/errors/syntax_error/build.xml @@ -29,7 +29,11 @@ - + + + + + diff --git a/test/errors/syntax_error/java/syntax_error/SyntaxErrorTest.java b/test/errors/syntax_error/java/syntax_error/SyntaxErrorTest.java index 83a63c833..72e21a08e 100644 --- a/test/errors/syntax_error/java/syntax_error/SyntaxErrorTest.java +++ b/test/errors/syntax_error/java/syntax_error/SyntaxErrorTest.java @@ -1,11 +1,12 @@ package syntax_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SyntaxErrorTest @@ -26,40 +27,40 @@ public void rshiftWithSpace() @Test public void unexpectedEofInArrayLength() { - final String error = "unexpected_eof_in_array_length_error.zs:6:1: " + - "mismatched input '' expecting {"; // ... + final String error = "unexpected_eof_in_array_length_error.zs:6:1: " + + "mismatched input '' expecting {"; // ... assertTrue(zserioErrors.isPresent(error)); } @Test public void unexpectedEofInConstDefinition() { - final String error = "unexpected_eof_in_const_definition_error.zs:4:1: " + - "mismatched input '' expecting {"; // ... + final String error = "unexpected_eof_in_const_definition_error.zs:4:1: " + + "mismatched input '' expecting {"; // ... assertTrue(zserioErrors.isPresent(error)); } @Test public void unexpectedEofInFieldDefinition() { - final String error = "unexpected_eof_in_field_definition_error.zs:6:1: " + - "mismatched input '' expecting {"; // ... + final String error = "unexpected_eof_in_field_definition_error.zs:6:1: " + + "mismatched input '' expecting {"; // ... assertTrue(zserioErrors.isPresent(error)); } @Test public void unexpectedEofInParameterizedFieldDefinition() { - final String error = "unexpected_eof_in_parameterized_field_definition_error.zs:11:1: " + - "mismatched input '' expecting {"; // ... + final String error = "unexpected_eof_in_parameterized_field_definition_error.zs:11:1: " + + "mismatched input '' expecting {"; // ... assertTrue(zserioErrors.isPresent(error)); } @Test public void unexpectedEofInStructDefinition() { - final String error = "unexpected_eof_in_struct_definition_error.zs:6:1: " + - "extraneous input '' expecting {"; // ... + final String error = "unexpected_eof_in_struct_definition_error.zs:6:1: " + + "extraneous input '' expecting {"; // ... assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/templates_error/build.xml b/test/errors/templates_error/build.xml index 6e1b7eba3..c7f23fae2 100644 --- a/test/errors/templates_error/build.xml +++ b/test/errors/templates_error/build.xml @@ -71,7 +71,11 @@ - + + + + + diff --git a/test/errors/templates_error/java/templates_error/TemplatesErrorTest.java b/test/errors/templates_error/java/templates_error/TemplatesErrorTest.java index 7044489df..b21f1929b 100644 --- a/test/errors/templates_error/java/templates_error/TemplatesErrorTest.java +++ b/test/errors/templates_error/java/templates_error/TemplatesErrorTest.java @@ -1,11 +1,12 @@ package templates_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class TemplatesErrorTest @@ -19,34 +20,25 @@ public static void readZserioErrors() throws IOException @Test public void constUsedAsType() { - final String errors[] = - { - "constant_used_as_type_error.zs:12:16: Invalid usage of 'CONST' as a type!" - }; + final String errors[] = {"constant_used_as_type_error.zs:12:16: Invalid usage of 'CONST' as a type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void constraintExpressionsExpectsConstant() { - final String errors[] = - { - "constraint_expression_expects_constant_error.zs:10:5: " + - " In instantiation of 'TestStruct' required from here", - "constraint_expression_expects_constant_error.zs:5:27: " + - "Unresolved symbol 'uint32' within expression scope!" - }; + final String errors[] = {"constraint_expression_expects_constant_error.zs:10:5: " + + " In instantiation of 'TestStruct' required from here", + "constraint_expression_expects_constant_error.zs:5:27: " + + "Unresolved symbol 'uint32' within expression scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void duplicatedFieldName() { - final String errors[] = - { - "duplicated_field_name_error.zs:5:7: First defined here", - "duplicated_field_name_error.zs:6:7: 'value' is already defined in this scope!" - }; + final String errors[] = {"duplicated_field_name_error.zs:5:7: First defined here", + "duplicated_field_name_error.zs:6:7: 'value' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -60,133 +52,104 @@ public void enumNotATemplate() @Test public void fieldNotAvailableInFunction() { - final String errors[] = - { - "field_not_available_in_function_error.zs:21:5: " + - " In instantiation of 'TestStruct' required from here", - "field_not_available_in_function_error.zs:16:5: " + - " In instantiation of 'FieldNotAvailable' required from here", - "field_not_available_in_function_error.zs:5:30: In function 'getField2' called from here", - "field_not_available_in_function_error.zs:10:16: " + - "Unresolved symbol 'field2' within expression scope!" - }; + final String errors[] = {"field_not_available_in_function_error.zs:21:5: " + + " In instantiation of 'TestStruct' required from here", + "field_not_available_in_function_error.zs:16:5: " + + " In instantiation of 'FieldNotAvailable' required from here", + "field_not_available_in_function_error.zs:5:30: In function 'getField2' called from here", + "field_not_available_in_function_error.zs:10:16: " + + "Unresolved symbol 'field2' within expression scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void hashedTemplateNameClash() { - final String errors[] = - { - "hashed_template_name_clash_error.zs:21:5: " + - " In instantiation of 'Test' required from here", - "hashed_template_name_clash_error.zs:25:8: " + - " First defined here", - "hashed_template_name_clash_error.zs:8:8: " + - "'Test_A_uint32_F2945EA9' is already defined in package 'hashed_template_name_clash_error'!" - }; + final String errors[] = {"hashed_template_name_clash_error.zs:21:5: " + + " In instantiation of 'Test' required from here", + "hashed_template_name_clash_error.zs:25:8: " + + " First defined here", + "hashed_template_name_clash_error.zs:8:8: " + + + "'Test_A_uint32_F2945EA9' is already defined in package 'hashed_template_name_clash_error'!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateDuplicated() { - final String errors[] = - { - "instantiate_duplicated_error.zs:8:26: First requested here", - "instantiate_duplicated_error.zs:9:26: Ambiguous request to instantiate template 'Test'!" - }; + final String errors[] = {"instantiate_duplicated_error.zs:8:26: First requested here", + "instantiate_duplicated_error.zs:9:26: Ambiguous request to instantiate template 'Test'!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateDuplicatedName() { - final String errors[] = - { - "instantiate_duplicated_name_error.zs:8:26: First defined here", - "instantiate_duplicated_name_error.zs:9:27: 'Str' is already defined in this package!" - }; + final String errors[] = {"instantiate_duplicated_name_error.zs:8:26: First defined here", + "instantiate_duplicated_name_error.zs:9:27: 'Str' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateDuplicatedViaImport() { - final String errors[] = - { - "instantiate_duplicated_via_import_error.zs:5:13: " + - " In instantiation of 'Test' required from here", - "instantiate_duplicated_via_import_error.zs:5:26: First requested here", - "pkg.zs:8:26: Ambiguous request to instantiate template 'Test'!" - }; + final String errors[] = {"instantiate_duplicated_via_import_error.zs:5:13: " + + " In instantiation of 'Test' required from here", + "instantiate_duplicated_via_import_error.zs:5:26: First requested here", + "pkg.zs:8:26: Ambiguous request to instantiate template 'Test'!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateDuplicatedViaInstantiate() { - final String errors[] = - { - "instantiate_duplicated_via_instantiate_error.zs:8:13: " + - " In instantiation of 'Data' required from here", - "instantiate_duplicated_via_instantiate_error.zs:15:26: First requested here", - "instantiate_duplicated_via_instantiate_error.zs:16:32: " + - "Ambiguous request to instantiate template 'Other'!" - }; + final String errors[] = {"instantiate_duplicated_via_instantiate_error.zs:8:13: " + + " In instantiation of 'Data' required from here", + "instantiate_duplicated_via_instantiate_error.zs:15:26: First requested here", + "instantiate_duplicated_via_instantiate_error.zs:16:32: " + + "Ambiguous request to instantiate template 'Other'!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateMissingTemplateArguments() { - final String error = "instantiate_missing_template_arguments_error.zs:8:13: " + - "Missing template arguments for template 'Test'!"; + final String error = "instantiate_missing_template_arguments_error.zs:8:13: " + + "Missing template arguments for template 'Test'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void instantiateNameClash() { - final String errors[] = - { - "instantiate_name_clash_error.zs:13:26: First defined here", - "instantiate_name_clash_error.zs:14:27: 'U32' is already defined in this package!" - }; + final String errors[] = {"instantiate_name_clash_error.zs:13:26: First defined here", + "instantiate_name_clash_error.zs:14:27: 'U32' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateNameClashWithSingleImport() { - final String errors[] = - { - "pkg.zs:3:8: Found here", - "instantiate_name_clash_with_single_import_error.zs:5:30: Found here", - "instantiate_name_clash_with_single_import_error.zs:5:13: Ambiguous symbol 'Template'" - }; + final String errors[] = {"pkg.zs:3:8: Found here", + "instantiate_name_clash_with_single_import_error.zs:5:30: Found here", + "instantiate_name_clash_with_single_import_error.zs:5:13: Ambiguous symbol 'Template'"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateNameClashWithTemplate() { - final String errors[] = - { - "instantiate_name_clash_with_template_error.zs:3:8: First defined here", - "instantiate_name_clash_with_template_error.zs:8:30: 'Template' is already defined in this package!" - }; + final String errors[] = {"instantiate_name_clash_with_template_error.zs:3:8: First defined here", + "instantiate_name_clash_with_template_error.zs:8:30: 'Template' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiateNameClashWithType() { - final String errors[] = - { - "instantiate_name_clash_with_type_error.zs:3:8: First defined here", - "instantiate_name_clash_with_type_error.zs:13:26: 'Other' is already defined in this package!" - }; + final String errors[] = {"instantiate_name_clash_with_type_error.zs:3:8: First defined here", + "instantiate_name_clash_with_type_error.zs:13:26: 'Other' is already defined in this package!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -207,24 +170,24 @@ public void instantiateSubtype() @Test public void instantiateTypeCycle() { - final String error = "instantiate_type_cycle_error.zs:3:30: " + - "Cyclic dependency detected in template instantiation 'Template'!"; + final String error = "instantiate_type_cycle_error.zs:3:30: " + + "Cyclic dependency detected in template instantiation 'Template'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void instantiateTypeFullNameCycle() { - final String error = "instantiate_type_full_name_cycle_error.zs:3:69: " + - "Cyclic dependency detected in template instantiation 'Template'!"; + final String error = "instantiate_type_full_name_cycle_error.zs:3:69: " + + "Cyclic dependency detected in template instantiation 'Template'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void instantiateTypeImportedCycle() { - final String error = "instantiate_type_imported_cycle_error.zs:8:30: " + - "Cyclic dependency detected in template instantiation 'Template'!"; + final String error = "instantiate_type_imported_cycle_error.zs:8:30: " + + "Cyclic dependency detected in template instantiation 'Template'!"; assertTrue(zserioErrors.isPresent(error)); } @@ -238,89 +201,74 @@ public void instantiateTypeInInstantiate() @Test public void instantiateTypeIsSqlTable() { - final String error = "instantiate_type_is_sql_table_error.zs:13:14: " + - "Field 'field' cannot be a sql table!"; + final String error = "instantiate_type_is_sql_table_error.zs:13:14: " + + "Field 'field' cannot be a sql table!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void instantiateTypeTransitiveCycle() { - final String[] errors = { - "instantiate_type_transitive_cycle_error.zs:4:27: " + - " Through template instantiation 'Some' here", - "instantiate_type_transitive_cycle_error.zs:5:26: " + - " Through template instantiation 'Template' here", - "instantiate_type_transitive_cycle_error.zs:3:30: " + - "Cyclic dependency detected in template instantiation 'Other'!" - }; + final String[] errors = {"instantiate_type_transitive_cycle_error.zs:4:27: " + + " Through template instantiation 'Some' here", + "instantiate_type_transitive_cycle_error.zs:5:26: " + + " Through template instantiation 'Template' here", + "instantiate_type_transitive_cycle_error.zs:3:30: " + + "Cyclic dependency detected in template instantiation 'Other'!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void instantiationViaSubtype() { - final String errors[] = - { - "instantiation_via_subtype_error.zs:13:9: " + - " In instantiation of 'TestStructure' required from here", - "instantiation_via_subtype_error.zs:9:16: Unexpected dot expression 'field'!" - }; + final String errors[] = {"instantiation_via_subtype_error.zs:13:9: " + + " In instantiation of 'TestStructure' required from here", + "instantiation_via_subtype_error.zs:9:16: Unexpected dot expression 'field'!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void missingTemplateArguments() { - final String error = "missing_template_arguments_error.zs:10:5: " + - "Missing template arguments for template 'TestStruct'!"; + final String error = "missing_template_arguments_error.zs:10:5: " + + "Missing template arguments for template 'TestStruct'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void missingTypeParameters() { - final String errors[] = - { - "missing_type_parameters_error.zs:15:5: In instantiation of 'TestStruct' required from here", - "missing_type_parameters_error.zs:5:5: " + - "Referenced type 'Parameterized' is defined as parameterized type!" - }; + final String errors[] = { + "missing_type_parameters_error.zs:15:5: In instantiation of 'TestStruct' required from here", + "missing_type_parameters_error.zs:5:5: " + + "Referenced type 'Parameterized' is defined as parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void parameterizedBuiltinType() { - final String errors[] = - { - "parameterized_builtin_type_error.zs:11:5: In instantiation of 'TestStruct' required from here", - "parameterized_builtin_type_error.zs:6:5: Referenced type 'uint32' is not a parameterized type!" - }; + final String errors[] = { + "parameterized_builtin_type_error.zs:11:5: In instantiation of 'TestStruct' required from here", + "parameterized_builtin_type_error.zs:6:5: Referenced type 'uint32' is not a parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void parameterizedCompoundType() { - final String errors[] = - { - "parameterized_compound_type_error.zs:16:5: " + - " In instantiation of 'TestStruct' required from here", - "parameterized_compound_type_error.zs:11:5: " + - "Referenced type 'Compound' is not a parameterized type!" - }; + final String errors[] = {"parameterized_compound_type_error.zs:16:5: " + + " In instantiation of 'TestStruct' required from here", + "parameterized_compound_type_error.zs:11:5: " + + "Referenced type 'Compound' is not a parameterized type!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void symbolWithTemplateParameterClash() { - final String errors[] = - { - "symbol_with_template_parameter_clash_error.zs:3:19: First defined here", - "symbol_with_template_parameter_clash_error.zs:5:12: 'T' is already defined in this scope!" - }; + final String errors[] = {"symbol_with_template_parameter_clash_error.zs:3:19: First defined here", + "symbol_with_template_parameter_clash_error.zs:5:12: 'T' is already defined in this scope!"}; assertTrue(zserioErrors.isPresent(errors)); } @@ -334,59 +282,55 @@ public void templatableNotATemplate() @Test public void templatedTemplateParameter() { - final String error = "templated_template_parameter_error.zs:5:5: " + - "Template parameter cannot be used as a template!"; + final String error = "templated_template_parameter_error.zs:5:5: " + + "Template parameter cannot be used as a template!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void tooFewArguments() { - final String errors[] = - { - "too_few_arguments_error.zs:11:5: In instantiation of 'TestStruct' required from here", - "too_few_arguments_error.zs:3:8: See 'TestStruct' definition here", - "too_few_arguments_error.zs:11:5: " + - "Template instantiation of 'TestStruct' has too few arguments! Expecting 2, got 1!" - }; + final String errors[] = { + "too_few_arguments_error.zs:11:5: In instantiation of 'TestStruct' required from here", + "too_few_arguments_error.zs:3:8: See 'TestStruct' definition here", + "too_few_arguments_error.zs:11:5: " + + "Template instantiation of 'TestStruct' has too few arguments! Expecting 2, got 1!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void tooManyArguments() { - final String errors[] = - { - "too_many_arguments_error.zs:16:5: In instantiation of 'OtherStruct' required from here", - "too_many_arguments_error.zs:11:5: In instantiation of 'TestStruct' required from here", - "too_many_arguments_error.zs:3:8: See 'TestStruct' definition here", - "too_many_arguments_error.zs:11:5: " + - "Template instantiation of 'TestStruct' has too many arguments! Expecting 2, got 3!" - }; + final String errors[] = { + "too_many_arguments_error.zs:16:5: In instantiation of 'OtherStruct' required from here", + "too_many_arguments_error.zs:11:5: In instantiation of 'TestStruct' required from here", + "too_many_arguments_error.zs:3:8: See 'TestStruct' definition here", + "too_many_arguments_error.zs:11:5: " + + "Template instantiation of 'TestStruct' has too many arguments! Expecting 2, got 3!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void unresolvedReferenceInTemplate() { - final String error = "unresolved_reference_in_template_error.zs:5:5: " + - "Unresolved referenced type 'Unresolved'!"; + final String error = "unresolved_reference_in_template_error.zs:5:5: " + + "Unresolved referenced type 'Unresolved'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unresolvedTemplateInstantiation() { - final String error = "unresolved_template_instantiation_error.zs:5:5: " + - "Unresolved referenced type 'TemplatedStruct'!"; + final String error = "unresolved_template_instantiation_error.zs:5:5: " + + "Unresolved referenced type 'TemplatedStruct'!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unresolvedTemplateInstantiationInTemplate() { - final String error = "unresolved_template_instantiation_in_template_error.zs:5:5: " + - "Unresolved referenced type 'Unresolved'!"; + final String error = "unresolved_template_instantiation_in_template_error.zs:5:5: " + + "Unresolved referenced type 'Unresolved'!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/errors/union_types_error/build.xml b/test/errors/union_types_error/build.xml index 33ee67f03..42951748b 100644 --- a/test/errors/union_types_error/build.xml +++ b/test/errors/union_types_error/build.xml @@ -21,7 +21,11 @@ - + + + + + diff --git a/test/errors/union_types_error/java/union_types_error/UnionTypesErrorTest.java b/test/errors/union_types_error/java/union_types_error/UnionTypesErrorTest.java index be7968744..88426232f 100644 --- a/test/errors/union_types_error/java/union_types_error/UnionTypesErrorTest.java +++ b/test/errors/union_types_error/java/union_types_error/UnionTypesErrorTest.java @@ -1,11 +1,12 @@ package union_types_error; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class UnionTypesErrorTest @@ -19,27 +20,24 @@ public static void readZserioErrors() throws IOException @Test public void optionalMember() { - final String errors[] = - { - "optional_field_error.zs:6:18: mismatched input 'if' expecting {", // ... - "optional_field_error.zs:6:18: 'if' is a reserved keyword!" - }; + final String errors[] = {"optional_field_error.zs:6:18: mismatched input 'if' expecting {", // ... + "optional_field_error.zs:6:18: 'if' is a reserved keyword!"}; assertTrue(zserioErrors.isPresent(errors)); } @Test public void recursive() { - final String error = "recursive_error.zs:6:17: " + - "Field 'field2' is recursive and neither optional nor array which can be empty!"; + final String error = "recursive_error.zs:6:17: " + + "Field 'field2' is recursive and neither optional nor array which can be empty!"; assertTrue(zserioErrors.isPresent(error)); } @Test public void unresolvedFieldInConstraint() { - final String error = "unresolved_field_in_constraint_error.zs:6:35: Unresolved symbol 'field1' " + - "within expression scope!"; + final String error = "unresolved_field_in_constraint_error.zs:6:35: Unresolved symbol 'field1' " + + "within expression scope!"; assertTrue(zserioErrors.isPresent(error)); } diff --git a/test/language/alignment/build.xml b/test/language/alignment/build.xml index 8bbc669d3..8e121ba1e 100644 --- a/test/language/alignment/build.xml +++ b/test/language/alignment/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/alignment/java/alignment/AutoOptionalMemberAlignmentTest.java b/test/language/alignment/java/alignment/AutoOptionalMemberAlignmentTest.java index 0ffdb1920..2ce81046a 100644 --- a/test/language/alignment/java/alignment/AutoOptionalMemberAlignmentTest.java +++ b/test/language/alignment/java/alignment/AutoOptionalMemberAlignmentTest.java @@ -1,17 +1,18 @@ package alignment; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import alignment.auto_optional_member_alignment.AutoOptionalMemberAlignment; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.BitBuffer; + +import alignment.auto_optional_member_alignment.AutoOptionalMemberAlignment; public class AutoOptionalMemberAlignmentTest { @@ -39,24 +40,24 @@ public void readWithoutOptional() throws IOException, ZserioError @Test public void bitSizeOfWithOptional() { - final AutoOptionalMemberAlignment autoOptionalMemberAlignment = new AutoOptionalMemberAlignment(0x4433, - 0x1122); + final AutoOptionalMemberAlignment autoOptionalMemberAlignment = + new AutoOptionalMemberAlignment(0x4433, 0x1122); assertEquals(WITH_AUTO_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE, autoOptionalMemberAlignment.bitSizeOf()); } @Test public void bitSizeOfWithoutOptional() { - final AutoOptionalMemberAlignment autoOptionalMemberAlignment = new AutoOptionalMemberAlignment(null, - 0x7624); + final AutoOptionalMemberAlignment autoOptionalMemberAlignment = + new AutoOptionalMemberAlignment(null, 0x7624); assertEquals(WITHOUT_AUTO_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE, autoOptionalMemberAlignment.bitSizeOf()); } @Test public void initializeOffsetsWithOptional() { - final AutoOptionalMemberAlignment autoOptionalMemberAlignment = new AutoOptionalMemberAlignment(0x1111, - 0x3333); + final AutoOptionalMemberAlignment autoOptionalMemberAlignment = + new AutoOptionalMemberAlignment(0x1111, 0x3333); int bitPosition = 0; for (; bitPosition < 32; ++bitPosition) assertEquals(WITH_AUTO_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE, @@ -69,8 +70,8 @@ public void initializeOffsetsWithOptional() @Test public void initializeOffsetsWithoutOptional() { - final AutoOptionalMemberAlignment autoOptionalMemberAlignment = new AutoOptionalMemberAlignment(null, - 0x3334); + final AutoOptionalMemberAlignment autoOptionalMemberAlignment = + new AutoOptionalMemberAlignment(null, 0x3334); final int bitPosition = 1; assertEquals(WITHOUT_AUTO_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE + bitPosition, autoOptionalMemberAlignment.initializeOffsets(bitPosition)); @@ -81,13 +82,13 @@ public void writeWithOptional() throws IOException, ZserioError { final int autoOptionalField = 0x9ADB; final int field = 0x8ACD; - final AutoOptionalMemberAlignment autoOptionalMemberAlignment = new AutoOptionalMemberAlignment( - autoOptionalField, field); + final AutoOptionalMemberAlignment autoOptionalMemberAlignment = + new AutoOptionalMemberAlignment(autoOptionalField, field); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); autoOptionalMemberAlignment.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final AutoOptionalMemberAlignment readAutoOptionalMemberAlignment = new AutoOptionalMemberAlignment(reader); checkAutoOptionalMemberAlignment(readAutoOptionalMemberAlignment, autoOptionalField, field); @@ -98,13 +99,13 @@ public void writeWithOptional() throws IOException, ZserioError public void writeWithoutOptional() throws IOException, ZserioError { final int field = 0x7ACF; - final AutoOptionalMemberAlignment autoOptionalMemberAlignment = new AutoOptionalMemberAlignment( - null, field); + final AutoOptionalMemberAlignment autoOptionalMemberAlignment = + new AutoOptionalMemberAlignment(null, field); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); autoOptionalMemberAlignment.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final AutoOptionalMemberAlignment readAutoOptionalMemberAlignment = new AutoOptionalMemberAlignment(reader); checkAutoOptionalMemberAlignment(readAutoOptionalMemberAlignment, null, field); @@ -132,8 +133,8 @@ private BitBuffer writeAutoOptionalMemberAlignmentToBitBuffer(Integer autoOption } } - private void checkAutoOptionalMemberAlignment(AutoOptionalMemberAlignment autoOptionalMemberAlignment, - Integer autoOptionalField, int field) + private void checkAutoOptionalMemberAlignment( + AutoOptionalMemberAlignment autoOptionalMemberAlignment, Integer autoOptionalField, int field) { if (autoOptionalField != null) { diff --git a/test/language/alignment/java/alignment/BitAlignmentTest.java b/test/language/alignment/java/alignment/BitAlignmentTest.java index 11587e7ce..b19a7eb59 100644 --- a/test/language/alignment/java/alignment/BitAlignmentTest.java +++ b/test/language/alignment/java/alignment/BitAlignmentTest.java @@ -1,11 +1,10 @@ package alignment; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import alignment.bit_alignment.BitAlignment; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -13,6 +12,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import alignment.bit_alignment.BitAlignment; + public class BitAlignmentTest { @Test @@ -64,8 +65,8 @@ public void write() throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); bitAlignment.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final BitAlignment readBitAlignment = new BitAlignment(reader); checkBitAlignment(readBitAlignment); assertTrue(bitAlignment.equals(readBitAlignment)); @@ -129,10 +130,10 @@ private void checkBitAlignment(BitAlignment bitAlignment) private static BitAlignment createBitAlignment() { - return new BitAlignment(ALIGNED1_FIELD_VALUE, ALIGNED2_FIELD_VALUE, - ALIGNED3_FIELD_VALUE, ALIGNED4_FIELD_VALUE, ALIGNED5_FIELD_VALUE, ALIGNED6_FIELD_VALUE, - ALIGNED7_FIELD_VALUE, ALIGNED8_FIELD_VALUE, (byte) 0, ALIGNED16_FIELD_VALUE, - (byte) 0, ALIGNED32_FIELD_VALUE, 0, ALIGNED64_FIELD_VALUE); + return new BitAlignment(ALIGNED1_FIELD_VALUE, ALIGNED2_FIELD_VALUE, ALIGNED3_FIELD_VALUE, + ALIGNED4_FIELD_VALUE, ALIGNED5_FIELD_VALUE, ALIGNED6_FIELD_VALUE, ALIGNED7_FIELD_VALUE, + ALIGNED8_FIELD_VALUE, (byte)0, ALIGNED16_FIELD_VALUE, (byte)0, ALIGNED32_FIELD_VALUE, 0, + ALIGNED64_FIELD_VALUE); } private static final int BIT_ALIGNMENT_BIT_SIZE = 320; diff --git a/test/language/alignment/java/alignment/OptionalMemberAlignmentTest.java b/test/language/alignment/java/alignment/OptionalMemberAlignmentTest.java index 57be78829..f6d5c52f4 100644 --- a/test/language/alignment/java/alignment/OptionalMemberAlignmentTest.java +++ b/test/language/alignment/java/alignment/OptionalMemberAlignmentTest.java @@ -1,11 +1,10 @@ package alignment; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import alignment.optional_member_alignment.OptionalMemberAlignment; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -13,6 +12,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import alignment.optional_member_alignment.OptionalMemberAlignment; + public class OptionalMemberAlignmentTest { @Test @@ -41,24 +42,24 @@ public void readWithoutOptional() throws IOException, ZserioError @Test public void bitSizeOfWithOptional() { - final OptionalMemberAlignment optionalMemberAlignment = new OptionalMemberAlignment(true, 0x4433, - 0x1122); + final OptionalMemberAlignment optionalMemberAlignment = + new OptionalMemberAlignment(true, 0x4433, 0x1122); assertEquals(WITH_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE, optionalMemberAlignment.bitSizeOf()); } @Test public void bitSizeOfWithoutOptional() { - final OptionalMemberAlignment optionalMemberAlignment = new OptionalMemberAlignment(false, null, - 0x7624); + final OptionalMemberAlignment optionalMemberAlignment = + new OptionalMemberAlignment(false, null, 0x7624); assertEquals(WITHOUT_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE, optionalMemberAlignment.bitSizeOf()); } @Test public void initializeOffsetsWithOptional() { - final OptionalMemberAlignment optionalMemberAlignment = new OptionalMemberAlignment(true, 0x1111, - 0x3333); + final OptionalMemberAlignment optionalMemberAlignment = + new OptionalMemberAlignment(true, 0x1111, 0x3333); int bitPosition = 0; for (; bitPosition < 32; ++bitPosition) assertEquals(WITH_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE, @@ -71,8 +72,8 @@ public void initializeOffsetsWithOptional() @Test public void initializeOffsetsWithoutOptional() { - final OptionalMemberAlignment optionalMemberAlignment = new OptionalMemberAlignment(false, null, - 0x3334); + final OptionalMemberAlignment optionalMemberAlignment = + new OptionalMemberAlignment(false, null, 0x3334); final int bitPosition = 1; assertEquals(WITHOUT_OPTIONAL_MEMBER_ALIGNMENT_BIT_SIZE + bitPosition, optionalMemberAlignment.initializeOffsets(bitPosition)); @@ -84,12 +85,12 @@ public void writeWithOptional() throws IOException, ZserioError final boolean hasOptional = true; final int optionalField = 0x9ADB; final int field = 0x8ACD; - final OptionalMemberAlignment optionalMemberAlignment = new OptionalMemberAlignment(hasOptional, - optionalField, field); + final OptionalMemberAlignment optionalMemberAlignment = + new OptionalMemberAlignment(hasOptional, optionalField, field); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); optionalMemberAlignment.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OptionalMemberAlignment readOptionalMemberAlignment = new OptionalMemberAlignment(reader); checkOptionalMemberAlignment(readOptionalMemberAlignment, hasOptional, optionalField, field); assertTrue(optionalMemberAlignment.equals(readOptionalMemberAlignment)); @@ -100,19 +101,19 @@ public void writeWithoutOptional() throws IOException, ZserioError { final boolean hasOptional = false; final int field = 0x7ACF; - final OptionalMemberAlignment optionalMemberAlignment = new OptionalMemberAlignment(hasOptional, - null, field); + final OptionalMemberAlignment optionalMemberAlignment = + new OptionalMemberAlignment(hasOptional, null, field); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); optionalMemberAlignment.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OptionalMemberAlignment readOptionalMemberAlignment = new OptionalMemberAlignment(reader); checkOptionalMemberAlignment(readOptionalMemberAlignment, hasOptional, null, field); assertTrue(optionalMemberAlignment.equals(readOptionalMemberAlignment)); } - private BitBuffer writeOptionalMemberAlignmentToBitBuffer(boolean hasOptional, Integer optionalField, - int field) throws IOException + private BitBuffer writeOptionalMemberAlignmentToBitBuffer( + boolean hasOptional, Integer optionalField, int field) throws IOException { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { diff --git a/test/language/array_types/build.xml b/test/language/array_types/build.xml index 14d462069..8dd70caef 100644 --- a/test/language/array_types/build.xml +++ b/test/language/array_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/array_types/java/array_types/ArraysMappingTest.java b/test/language/array_types/java/array_types/ArraysMappingTest.java index 6a408a65d..d41951317 100644 --- a/test/language/array_types/java/array_types/ArraysMappingTest.java +++ b/test/language/array_types/java/array_types/ArraysMappingTest.java @@ -1,17 +1,18 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import array_types.arrays_mapping.ArraysMapping; -import array_types.arrays_mapping.TestStructure; -import array_types.arrays_mapping.TestEnum; import array_types.arrays_mapping.TestBitmask; +import array_types.arrays_mapping.TestEnum; +import array_types.arrays_mapping.TestStructure; public class ArraysMappingTest { diff --git a/test/language/array_types/java/array_types/AutoArrayBitfieldParamTest.java b/test/language/array_types/java/array_types/AutoArrayBitfieldParamTest.java index 02f7c0b29..e9b6c8266 100644 --- a/test/language/array_types/java/array_types/AutoArrayBitfieldParamTest.java +++ b/test/language/array_types/java/array_types/AutoArrayBitfieldParamTest.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import array_types.auto_array_bitfield_param.ParameterizedBitfieldLength; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import array_types.auto_array_bitfield_param.ParameterizedBitfieldLength; + public class AutoArrayBitfieldParamTest { @Test @@ -30,8 +32,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); parameterizedBitfieldLength.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); checkParameterizedBitfieldLengthInStream(reader, parameterizedBitfieldLength); reader.setBitPosition(0); final ParameterizedBitfieldLength readParameterizedBitfieldLength = diff --git a/test/language/array_types/java/array_types/AutoArrayStructRecursionTest.java b/test/language/array_types/java/array_types/AutoArrayStructRecursionTest.java index 485ba5fd4..cb174fcc9 100644 --- a/test/language/array_types/java/array_types/AutoArrayStructRecursionTest.java +++ b/test/language/array_types/java/array_types/AutoArrayStructRecursionTest.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.auto_array_struct_recursion.AutoArrayRecursion; public class AutoArrayStructRecursionTest @@ -106,7 +108,7 @@ private AutoArrayRecursion createAutoArrayRecursion(short numElements) autoArray[i - 1] = element; } - return new AutoArrayRecursion((short) 0, autoArray); + return new AutoArrayRecursion((short)0, autoArray); } private void checkAutoArrayRecursion(AutoArrayRecursion autoArrayRecursion, short numElements) @@ -126,7 +128,7 @@ private BitBuffer writeAutoArrayRecursionToBitBuffer(short numElements) throws I { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { - writer.writeUnsignedByte((short) 0); + writer.writeUnsignedByte((short)0); writer.writeVarSize(numElements); for (short i = 1; i <= numElements; ++i) { diff --git a/test/language/array_types/java/array_types/AutoArraySubtypedUInt8Test.java b/test/language/array_types/java/array_types/AutoArraySubtypedUInt8Test.java index 528769023..29e95ae84 100644 --- a/test/language/array_types/java/array_types/AutoArraySubtypedUInt8Test.java +++ b/test/language/array_types/java/array_types/AutoArraySubtypedUInt8Test.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.auto_array_subtyped_uint8.AutoArray; public class AutoArraySubtypedUInt8Test diff --git a/test/language/array_types/java/array_types/AutoArrayUInt8Test.java b/test/language/array_types/java/array_types/AutoArrayUInt8Test.java index 62f58a062..5cafc2c66 100644 --- a/test/language/array_types/java/array_types/AutoArrayUInt8Test.java +++ b/test/language/array_types/java/array_types/AutoArrayUInt8Test.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.auto_array_uint8.AutoArray; public class AutoArrayUInt8Test diff --git a/test/language/array_types/java/array_types/FixedArrayUInt8Test.java b/test/language/array_types/java/array_types/FixedArrayUInt8Test.java index 1b311d6f4..8282082f4 100644 --- a/test/language/array_types/java/array_types/FixedArrayUInt8Test.java +++ b/test/language/array_types/java/array_types/FixedArrayUInt8Test.java @@ -1,14 +1,16 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.fixed_array_uint8.FixedArray; public class FixedArrayUInt8Test @@ -68,7 +70,6 @@ public void writeRead() throws IOException, ZserioError FixedArray fixedArray = new FixedArray(uint8Array); SerializeUtil.serializeToFile(fixedArray, BLOB_NAME); - final FixedArray readFixedArray = SerializeUtil.deserializeFromFile(FixedArray.class, BLOB_NAME); final short[] readUint8Array = readFixedArray.getUint8Array(); assertEquals(FIXED_ARRAY_LENGTH, readUint8Array.length); diff --git a/test/language/array_types/java/array_types/PackedArraysMappingTest.java b/test/language/array_types/java/array_types/PackedArraysMappingTest.java index f72080a28..791679270 100644 --- a/test/language/array_types/java/array_types/PackedArraysMappingTest.java +++ b/test/language/array_types/java/array_types/PackedArraysMappingTest.java @@ -1,15 +1,16 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import array_types.packed_arrays_mapping.PackedArraysMapping; -import array_types.packed_arrays_mapping.TestStructure; -import array_types.packed_arrays_mapping.TestEnum; import array_types.packed_arrays_mapping.TestBitmask; +import array_types.packed_arrays_mapping.TestEnum; +import array_types.packed_arrays_mapping.TestStructure; public class PackedArraysMappingTest { diff --git a/test/language/array_types/java/array_types/PackedAutoArrayBitfieldParamTest.java b/test/language/array_types/java/array_types/PackedAutoArrayBitfieldParamTest.java index 291d8350a..4ca908127 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayBitfieldParamTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayBitfieldParamTest.java @@ -1,11 +1,13 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.SerializeUtil; + import array_types.packed_auto_array_bitfield_param.ParameterizedBitfieldLength; public class PackedAutoArrayBitfieldParamTest diff --git a/test/language/array_types/java/array_types/PackedAutoArrayEmptyCompoundsTest.java b/test/language/array_types/java/array_types/PackedAutoArrayEmptyCompoundsTest.java index 3a1c613fc..c5eb67adf 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayEmptyCompoundsTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayEmptyCompoundsTest.java @@ -1,12 +1,14 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; + +import array_types.packed_auto_array_empty_compounds.EmptyChoice; import array_types.packed_auto_array_empty_compounds.EmptyStruct; import array_types.packed_auto_array_empty_compounds.EmptyUnion; -import array_types.packed_auto_array_empty_compounds.EmptyChoice; import array_types.packed_auto_array_empty_compounds.Main; import array_types.packed_auto_array_empty_compounds.PackedAutoArray; @@ -16,15 +18,12 @@ public class PackedAutoArrayEmptyCompoundsTest public void writeReadFile() { final PackedAutoArray packedAutoArray = new PackedAutoArray( - new EmptyStruct[] {new EmptyStruct(), new EmptyStruct(), new EmptyStruct()}, - new EmptyUnion[] {new EmptyUnion(), new EmptyUnion(), new EmptyUnion()}, - new EmptyChoice[] {new EmptyChoice(0), new EmptyChoice(0), new EmptyChoice(0)}, - new Main[] { - new Main(new EmptyStruct(), new EmptyUnion(), 0, new EmptyChoice(0)), - new Main(new EmptyStruct(), new EmptyUnion(), 1, new EmptyChoice(1)), - new Main(new EmptyStruct(), new EmptyUnion(), 2, new EmptyChoice(2)) - } - ); + new EmptyStruct[] {new EmptyStruct(), new EmptyStruct(), new EmptyStruct()}, + new EmptyUnion[] {new EmptyUnion(), new EmptyUnion(), new EmptyUnion()}, + new EmptyChoice[] {new EmptyChoice(0), new EmptyChoice(0), new EmptyChoice(0)}, + new Main[] {new Main(new EmptyStruct(), new EmptyUnion(), 0, new EmptyChoice(0)), + new Main(new EmptyStruct(), new EmptyUnion(), 1, new EmptyChoice(1)), + new Main(new EmptyStruct(), new EmptyUnion(), 2, new EmptyChoice(2))}); SerializeUtil.serializeToFile(packedAutoArray, BLOB_NAME); final PackedAutoArray readPackedAutoArray = diff --git a/test/language/array_types/java/array_types/PackedAutoArrayRemovedEnumItemTest.java b/test/language/array_types/java/array_types/PackedAutoArrayRemovedEnumItemTest.java index c13c3528f..bb2baa750 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayRemovedEnumItemTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayRemovedEnumItemTest.java @@ -1,14 +1,15 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import array_types.packed_auto_array_removed_enum_item.PackedAutoArrayRemovedEnumItem; -import array_types.packed_auto_array_removed_enum_item.Traffic; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.SerializeUtil; +import array_types.packed_auto_array_removed_enum_item.PackedAutoArrayRemovedEnumItem; +import array_types.packed_auto_array_removed_enum_item.Traffic; + public class PackedAutoArrayRemovedEnumItemTest { @Test @@ -28,8 +29,8 @@ public void writeReadFile() public void writeRemovedException() { final PackedAutoArrayRemovedEnumItem packedAutoArrayRemovedEnumItem = - new PackedAutoArrayRemovedEnumItem(new Traffic[] { - Traffic.NONE, Traffic.LIGHT, Traffic.MID, Traffic.ZSERIO_REMOVED_HEAVY}); + new PackedAutoArrayRemovedEnumItem( + new Traffic[] {Traffic.NONE, Traffic.LIGHT, Traffic.MID, Traffic.ZSERIO_REMOVED_HEAVY}); assertThrows(ZserioError.class, () -> SerializeUtil.serialize(packedAutoArrayRemovedEnumItem)); } diff --git a/test/language/array_types/java/array_types/PackedAutoArrayStructRecursionTest.java b/test/language/array_types/java/array_types/PackedAutoArrayStructRecursionTest.java index 81a26e3fb..60c7fee92 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayStructRecursionTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayStructRecursionTest.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.packed_auto_array_struct_recursion.PackedAutoArrayRecursion; public class PackedAutoArrayStructRecursionTest @@ -125,16 +127,16 @@ private PackedAutoArrayRecursion createPackedAutoArrayRecursion(short numElement final PackedAutoArrayRecursion[] autoArray = new PackedAutoArrayRecursion[numElements]; for (short i = 1; i <= numElements; ++i) { - final PackedAutoArrayRecursion element = new PackedAutoArrayRecursion(i, - new PackedAutoArrayRecursion[0]); + final PackedAutoArrayRecursion element = + new PackedAutoArrayRecursion(i, new PackedAutoArrayRecursion[0]); autoArray[i - 1] = element; } - return new PackedAutoArrayRecursion((short) 0, autoArray); + return new PackedAutoArrayRecursion((short)0, autoArray); } - private void checkPackedAutoArrayRecursion(PackedAutoArrayRecursion packedAutoArrayRecursion, - short numElements) + private void checkPackedAutoArrayRecursion( + PackedAutoArrayRecursion packedAutoArrayRecursion, short numElements) { assertEquals(0, packedAutoArrayRecursion.getId()); final PackedAutoArrayRecursion[] autoArray = packedAutoArrayRecursion.getPackedAutoArrayRecursion(); diff --git a/test/language/array_types/java/array_types/PackedAutoArrayStructWithBytesTest.java b/test/language/array_types/java/array_types/PackedAutoArrayStructWithBytesTest.java index 58609aba7..46ac209ef 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayStructWithBytesTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayStructWithBytesTest.java @@ -1,12 +1,14 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; + import array_types.packed_auto_array_struct_with_bytes.PackedAutoArray; import array_types.packed_auto_array_struct_with_bytes.TestStructure; @@ -34,10 +36,10 @@ private PackedAutoArray createPackedAutoArray() private static final long[] UINT32_FIELD = { 100000, 110000, 120000, 130000, 140000, 150000, 160000, 170000, 180000, 190000}; - private static final byte[][] BYTES_FIELD = new byte[][]{ - new byte[]{(byte)0xAB, (byte)0xCD, (byte)0xEF}, new byte[]{(byte)0x00}, - new byte[]{(byte)0x01}, new byte[]{(byte)0x00}, new byte[]{(byte)0x01}, new byte[]{(byte)0x00}, - new byte[]{(byte)0x01}, new byte[]{(byte)0x00}, new byte[]{(byte)0x01}, new byte[]{(byte)0x00}}; + private static final byte[][] BYTES_FIELD = new byte[][] {new byte[] {(byte)0xAB, (byte)0xCD, (byte)0xEF}, + new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, + new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, + new byte[] {(byte)0x00}}; private static final short[] UINT8_FIELD = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18}; private static final String BLOB_NAME = "packed_auto_array_struct_with_bytes.blob"; diff --git a/test/language/array_types/java/array_types/PackedAutoArrayStructWithExternTest.java b/test/language/array_types/java/array_types/PackedAutoArrayStructWithExternTest.java index 633b48ad7..440ecc3d7 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayStructWithExternTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayStructWithExternTest.java @@ -1,13 +1,15 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.SerializeUtil; + import array_types.packed_auto_array_struct_with_extern.PackedAutoArray; import array_types.packed_auto_array_struct_with_extern.TestStructure; @@ -35,10 +37,10 @@ private PackedAutoArray createPackedAutoArray() private static final long[] UINT32_FIELD = { 100000, 110000, 120000, 130000, 140000, 150000, 160000, 170000, 180000, 190000}; - private static final byte[][] EXTERN_FIELD = new byte[][]{ - new byte[]{(byte)0xAB, (byte)0xCD, (byte)0xEF}, new byte[]{(byte)0x00}, - new byte[]{(byte)0x01}, new byte[]{(byte)0x00}, new byte[]{(byte)0x01}, new byte[]{(byte)0x00}, - new byte[]{(byte)0x01}, new byte[]{(byte)0x00}, new byte[]{(byte)0x01}, new byte[]{(byte)0x00}}; + private static final byte[][] EXTERN_FIELD = new byte[][] {new byte[] {(byte)0xAB, (byte)0xCD, (byte)0xEF}, + new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, + new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, new byte[] {(byte)0x00}, new byte[] {(byte)0x01}, + new byte[] {(byte)0x00}}; private static final short[] UINT8_FIELD = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18}; private static final String BLOB_NAME = "packed_auto_array_struct_with_extern.blob"; diff --git a/test/language/array_types/java/array_types/PackedAutoArrayStructWithUnpackedFieldTest.java b/test/language/array_types/java/array_types/PackedAutoArrayStructWithUnpackedFieldTest.java index 32b36c0c3..60474cca2 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayStructWithUnpackedFieldTest.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayStructWithUnpackedFieldTest.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + +import zserio.runtime.io.SerializeUtil; + import array_types.packed_auto_array_struct_with_unpacked_field.PackedAutoArray; import array_types.packed_auto_array_struct_with_unpacked_field.TestStructure; -import zserio.runtime.io.SerializeUtil; public class PackedAutoArrayStructWithUnpackedFieldTest { @@ -50,13 +52,12 @@ private PackedAutoArray createPackedAutoArray() } private static final short[] UINT8_FIELD = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18}; - private static final BigInteger[] UNPACKED_FIELD = { - BigInteger.valueOf(5000000), BigInteger.ZERO, BigInteger.ONE, BigInteger.ZERO, - BigInteger.ONE, BigInteger.ZERO, BigInteger.ONE, BigInteger.ZERO, BigInteger.ONE, BigInteger.ZERO}; + private static final BigInteger[] UNPACKED_FIELD = {BigInteger.valueOf(5000000), BigInteger.ZERO, + BigInteger.ONE, BigInteger.ZERO, BigInteger.ONE, BigInteger.ZERO, BigInteger.ONE, BigInteger.ZERO, + BigInteger.ONE, BigInteger.ZERO}; private static final int UINT8_MAX_BIT_NUMBER = 2; - private static final int PACKED_AUTO_ARRAY_BIT_SIZE = - 8 + // auto array size: varsize + private static final int PACKED_AUTO_ARRAY_BIT_SIZE = 8 + // auto array size: varsize 1 + // uint8Field packing descriptor: isPacked (true) 6 + // uint8Field is packed: maxBitNumber 1 + // unpackedField packing descriptor: isPacked (false) diff --git a/test/language/array_types/java/array_types/PackedAutoArrayUInt8Test.java b/test/language/array_types/java/array_types/PackedAutoArrayUInt8Test.java index af0e12446..2cdaf6b15 100644 --- a/test/language/array_types/java/array_types/PackedAutoArrayUInt8Test.java +++ b/test/language/array_types/java/array_types/PackedAutoArrayUInt8Test.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.packed_auto_array_uint8.PackedAutoArray; public class PackedAutoArrayUInt8Test diff --git a/test/language/array_types/java/array_types/PackedFixedArrayUInt8Test.java b/test/language/array_types/java/array_types/PackedFixedArrayUInt8Test.java index 3fd2fd0ce..33fc77692 100644 --- a/test/language/array_types/java/array_types/PackedFixedArrayUInt8Test.java +++ b/test/language/array_types/java/array_types/PackedFixedArrayUInt8Test.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.packed_fixed_array_uint8.PackedFixedArray; public class PackedFixedArrayUInt8Test diff --git a/test/language/array_types/java/array_types/PackedVariableArrayStructRecursionTest.java b/test/language/array_types/java/array_types/PackedVariableArrayStructRecursionTest.java index 26e6f4798..6aec9ad66 100644 --- a/test/language/array_types/java/array_types/PackedVariableArrayStructRecursionTest.java +++ b/test/language/array_types/java/array_types/PackedVariableArrayStructRecursionTest.java @@ -1,13 +1,15 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.SerializeUtil; + import array_types.packed_variable_array_struct_recursion.Block; import array_types.packed_variable_array_struct_recursion.PackedVariableArray; @@ -57,9 +59,11 @@ private void checkBitSizeOf(int numElements) throws IOException, ZserioError final int packedBitsizeOf = packedVariableArray.bitSizeOf(); final double minCompressionRatio = 0.9; - assertTrue(unpackedBitsizeOf * minCompressionRatio > packedBitsizeOf, () -> - "Unpacked array has " + unpackedBitsizeOf + " bits, packed array has " + packedBitsizeOf + - " bits, " + "compression ratio is " + packedBitsizeOf * 100.0 / unpackedBitsizeOf + "%!"); + assertTrue(unpackedBitsizeOf * minCompressionRatio > packedBitsizeOf, + () + -> "Unpacked array has " + unpackedBitsizeOf + " bits, packed array has " + + packedBitsizeOf + " bits, " + + "compression ratio is " + packedBitsizeOf * 100.0 / unpackedBitsizeOf + "%!"); } private void checkWriteRead(int numElements) throws IOException, ZserioError diff --git a/test/language/array_types/java/array_types/PackedVariableArrayStructTest.java b/test/language/array_types/java/array_types/PackedVariableArrayStructTest.java index 246e09aa7..d8e1c013c 100644 --- a/test/language/array_types/java/array_types/PackedVariableArrayStructTest.java +++ b/test/language/array_types/java/array_types/PackedVariableArrayStructTest.java @@ -1,15 +1,17 @@ - package array_types; +package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.SerializeUtil; + import array_types.packed_variable_array_struct.Empty; import array_types.packed_variable_array_struct.PackedVariableArray; import array_types.packed_variable_array_struct.TestBitmask; @@ -77,9 +79,11 @@ private void checkBitSizeOf(int numElements) throws IOException, ZserioError final int unpackedBitSizeOf = packedVariableArray.getTestUnpackedArray().bitSizeOf(); final int packedBitSizeOf = packedVariableArray.getTestPackedArray().bitSizeOf(); final double minCompressionRatio = 0.622; - assertTrue(unpackedBitSizeOf * minCompressionRatio > packedBitSizeOf, () -> - "Unpacked array has " + unpackedBitSizeOf + " bits, packed array has " + packedBitSizeOf + - " bits, " + "compression ratio is " + packedBitSizeOf * 100.0 / unpackedBitSizeOf + "%!"); + assertTrue(unpackedBitSizeOf * minCompressionRatio > packedBitSizeOf, + () + -> "Unpacked array has " + unpackedBitSizeOf + " bits, packed array has " + + packedBitSizeOf + " bits, " + + "compression ratio is " + packedBitSizeOf * 100.0 / unpackedBitSizeOf + "%!"); } private void checkWriteRead(int numElements) throws IOException, ZserioError @@ -88,7 +92,7 @@ private void checkWriteRead(int numElements) throws IOException, ZserioError final File file = new File(BLOB_NAME_BASE + numElements + ".blob"); SerializeUtil.serializeToFile(packedVariableArray, file); final PackedVariableArray readPackedVariableArray = - SerializeUtil.deserializeFromFile(PackedVariableArray.class, file); + SerializeUtil.deserializeFromFile(PackedVariableArray.class, file); assertEquals(packedVariableArray, readPackedVariableArray); } @@ -133,26 +137,16 @@ else if (index == 5) testUnion.setValue32(new Value32((long)index * 2)); final TestEnum testEnum = ((index % 2) == 0) ? TestEnum.DARK_RED : TestEnum.DARK_GREEN; - final TestBitmask testBitmask = ((index % 2) == 0) ? TestBitmask.Values.READ : - TestBitmask.Values.CREATE; + final TestBitmask testBitmask = + ((index % 2) == 0) ? TestBitmask.Values.READ : TestBitmask.Values.CREATE; final Short testOptional = ((index % 2) == 0) ? (short)index : null; final BigInteger testDynamicBitfield = BigInteger.valueOf(index % 3); - final BigInteger values[] = new BigInteger[] { - BigInteger.valueOf(1), - BigInteger.valueOf(4), - BigInteger.valueOf(7), - BigInteger.valueOf(10), - BigInteger.valueOf(13), - BigInteger.valueOf(16)}; - final Empty empties[] = new Empty[] { - new Empty(), - new Empty(), - new Empty(), - new Empty(), - new Empty(), - new Empty()}; + final BigInteger values[] = new BigInteger[] {BigInteger.valueOf(1), BigInteger.valueOf(4), + BigInteger.valueOf(7), BigInteger.valueOf(10), BigInteger.valueOf(13), BigInteger.valueOf(16)}; + final Empty empties[] = + new Empty[] {new Empty(), new Empty(), new Empty(), new Empty(), new Empty(), new Empty()}; return new TestStructure(index, name, data, bytesData, testChoice, testUnion, testEnum, testBitmask, testOptional, testDynamicBitfield, values.length, values, values, empties); diff --git a/test/language/array_types/java/array_types/PackedVariableArrayUInt8Test.java b/test/language/array_types/java/array_types/PackedVariableArrayUInt8Test.java index a6d8d36b7..f3021b60b 100644 --- a/test/language/array_types/java/array_types/PackedVariableArrayUInt8Test.java +++ b/test/language/array_types/java/array_types/PackedVariableArrayUInt8Test.java @@ -1,15 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import array_types.packed_variable_array_uint8.PackedVariableArray; public class PackedVariableArrayUInt8Test diff --git a/test/language/array_types/java/array_types/PackingInterfaceOptimizationTest.java b/test/language/array_types/java/array_types/PackingInterfaceOptimizationTest.java index 74496ed47..fad9e650a 100644 --- a/test/language/array_types/java/array_types/PackingInterfaceOptimizationTest.java +++ b/test/language/array_types/java/array_types/PackingInterfaceOptimizationTest.java @@ -1,47 +1,46 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import static test_utils.AssertionUtils.assertMethodPresent; -import static test_utils.AssertionUtils.assertMethodNotPresent; -import static test_utils.AssertionUtils.assertInnerClassPresent; import static test_utils.AssertionUtils.assertInnerClassNotPresent; +import static test_utils.AssertionUtils.assertInnerClassPresent; +import static test_utils.AssertionUtils.assertMethodNotPresent; +import static test_utils.AssertionUtils.assertMethodPresent; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; -import array_types.packing_interface_optimization.PackingInterfaceOptimization; -import array_types.packing_interface_optimization.UnpackedColorsHolder; -import array_types.packing_interface_optimization.PackedColorsHolder; -import array_types.packing_interface_optimization.UnpackedColorStruct; -import array_types.packing_interface_optimization.UnpackedColorChoice; -import array_types.packing_interface_optimization.UnpackedColorUnion; -import array_types.packing_interface_optimization.UnpackedColorBitmask; -import array_types.packing_interface_optimization.UnpackedColorEnum; -import array_types.packing_interface_optimization.MixedColorStruct; -import array_types.packing_interface_optimization.MixedColorChoice; -import array_types.packing_interface_optimization.MixedColorUnion; import array_types.packing_interface_optimization.MixedColorBitmask; +import array_types.packing_interface_optimization.MixedColorChoice; import array_types.packing_interface_optimization.MixedColorEnum; -import array_types.packing_interface_optimization.PackedColorStruct; -import array_types.packing_interface_optimization.PackedColorChoice; -import array_types.packing_interface_optimization.PackedColorUnion; +import array_types.packing_interface_optimization.MixedColorStruct; +import array_types.packing_interface_optimization.MixedColorUnion; import array_types.packing_interface_optimization.PackedColorBitmask; +import array_types.packing_interface_optimization.PackedColorChoice; import array_types.packing_interface_optimization.PackedColorEnum; +import array_types.packing_interface_optimization.PackedColorStruct; +import array_types.packing_interface_optimization.PackedColorUnion; +import array_types.packing_interface_optimization.PackedColorsHolder; +import array_types.packing_interface_optimization.PackingInterfaceOptimization; +import array_types.packing_interface_optimization.UnpackedColorBitmask; +import array_types.packing_interface_optimization.UnpackedColorChoice; +import array_types.packing_interface_optimization.UnpackedColorEnum; +import array_types.packing_interface_optimization.UnpackedColorStruct; +import array_types.packing_interface_optimization.UnpackedColorUnion; +import array_types.packing_interface_optimization.UnpackedColorsHolder; public class PackingInterfaceOptimizationTest { @Test public void writeReadFile() { - final PackingInterfaceOptimization packingInterfaceOptimization = new PackingInterfaceOptimization( - createUnpackedColorsHolder(), - createPackedColorsHolder() - ); + final PackingInterfaceOptimization packingInterfaceOptimization = + new PackingInterfaceOptimization(createUnpackedColorsHolder(), createPackedColorsHolder()); SerializeUtil.serializeToFile(packingInterfaceOptimization, BLOB_NAME); - final PackingInterfaceOptimization readPackingInterfaceOptimization = SerializeUtil.deserializeFromFile( - PackingInterfaceOptimization.class, BLOB_NAME); + final PackingInterfaceOptimization readPackingInterfaceOptimization = + SerializeUtil.deserializeFromFile(PackingInterfaceOptimization.class, BLOB_NAME); assertEquals(packingInterfaceOptimization, readPackingInterfaceOptimization); } @@ -60,19 +59,19 @@ public void unpackedColorsHolderMethods() assertInnerClassPresent(UnpackedColorsHolder.class, "ZserioElementFactory_unpackedColors"); assertInnerClassPresent(UnpackedColorsHolder.class, "ZserioElementFactory_mixedColors"); - final Class zserioElementFactory_unpackedColors_class = getPrivateInnerClass( - UnpackedColorsHolder.class, "ZserioElementFactory_unpackedColors"); + final Class zserioElementFactory_unpackedColors_class = + getPrivateInnerClass(UnpackedColorsHolder.class, "ZserioElementFactory_unpackedColors"); assertMethodPresent(zserioElementFactory_unpackedColors_class, "create"); assertMethodNotPresent(zserioElementFactory_unpackedColors_class, "createPackingContext"); - assertMethodNotPresent(zserioElementFactory_unpackedColors_class, - "create(zserio.runtime.array.PackingContext"); + assertMethodNotPresent( + zserioElementFactory_unpackedColors_class, "create(zserio.runtime.array.PackingContext"); - final Class zserioElementFactory_mixedColors_class = getPrivateInnerClass( - UnpackedColorsHolder.class, "ZserioElementFactory_mixedColors"); + final Class zserioElementFactory_mixedColors_class = + getPrivateInnerClass(UnpackedColorsHolder.class, "ZserioElementFactory_mixedColors"); assertMethodPresent(zserioElementFactory_mixedColors_class, "create"); assertMethodPresent(zserioElementFactory_mixedColors_class, "createPackingContext"); - assertMethodPresent(zserioElementFactory_mixedColors_class, - "create(zserio.runtime.array.PackingContext"); + assertMethodPresent( + zserioElementFactory_mixedColors_class, "create(zserio.runtime.array.PackingContext"); } @Test @@ -83,19 +82,19 @@ public void packedColorsHolderMethods() assertInnerClassPresent(PackedColorsHolder.class, "ZserioElementFactory_mixedColors"); assertInnerClassPresent(PackedColorsHolder.class, "ZserioElementFactory_packedColors"); - final Class zserioElementFactory_mixedColors_class = getPrivateInnerClass( - PackedColorsHolder.class, "ZserioElementFactory_mixedColors"); + final Class zserioElementFactory_mixedColors_class = + getPrivateInnerClass(PackedColorsHolder.class, "ZserioElementFactory_mixedColors"); assertMethodPresent(zserioElementFactory_mixedColors_class, "create"); assertMethodPresent(zserioElementFactory_mixedColors_class, "createPackingContext"); - assertMethodPresent(zserioElementFactory_mixedColors_class, - "create(zserio.runtime.array.PackingContext"); + assertMethodPresent( + zserioElementFactory_mixedColors_class, "create(zserio.runtime.array.PackingContext"); - final Class zserioElementFactory_packedColors_class = getPrivateInnerClass( - PackedColorsHolder.class, "ZserioElementFactory_packedColors"); + final Class zserioElementFactory_packedColors_class = + getPrivateInnerClass(PackedColorsHolder.class, "ZserioElementFactory_packedColors"); assertMethodPresent(zserioElementFactory_packedColors_class, "create"); assertMethodPresent(zserioElementFactory_packedColors_class, "createPackingContext"); - assertMethodPresent(zserioElementFactory_packedColors_class, - "create(zserio.runtime.array.PackingContext"); + assertMethodPresent( + zserioElementFactory_packedColors_class, "create(zserio.runtime.array.PackingContext"); } @Test @@ -125,19 +124,20 @@ public void unpackedColorEnumMethods() assertMethodNotPresent(UnpackedColorEnum.class, "readEnum(zserio.runtime.array.PackingContext"); assertMethodNotPresent(UnpackedColorEnum.class, "initPackingContext"); assertMethodNotPresent(UnpackedColorEnum.class, "bitSizeOf(zserio.runtime.array.PackingContext"); - assertMethodNotPresent(UnpackedColorEnum.class, "initializeOffsets(zserio.runtime.array.PackingContext"); + assertMethodNotPresent( + UnpackedColorEnum.class, "initializeOffsets(zserio.runtime.array.PackingContext"); assertMethodNotPresent(UnpackedColorEnum.class, "write(zserio.runtime.array.PackingContext"); } @Test public void unpackedColorBitmaskMethods() { - assertMethodNotPresent(UnpackedColorBitmask.class, - "UnpackedColorBitmask(zserio.runtime.array.PackingContext"); + assertMethodNotPresent( + UnpackedColorBitmask.class, "UnpackedColorBitmask(zserio.runtime.array.PackingContext"); assertMethodNotPresent(UnpackedColorBitmask.class, "initPackingContext"); assertMethodNotPresent(UnpackedColorBitmask.class, "bitSizeOf(zserio.runtime.array.PackingContext"); - assertMethodNotPresent(UnpackedColorBitmask.class, - "initializeOffsets(zserio.runtime.array.PackingContext"); + assertMethodNotPresent( + UnpackedColorBitmask.class, "initializeOffsets(zserio.runtime.array.PackingContext"); assertMethodNotPresent(UnpackedColorBitmask.class, "write(zserio.runtime.array.PackingContext"); } @@ -175,12 +175,10 @@ public void mixedColorEnumMethods() @Test public void mixedColorBitmaskMethods() { - assertMethodPresent(MixedColorBitmask.class, - "MixedColorBitmask(zserio.runtime.array.PackingContext"); + assertMethodPresent(MixedColorBitmask.class, "MixedColorBitmask(zserio.runtime.array.PackingContext"); assertMethodPresent(MixedColorBitmask.class, "initPackingContext"); assertMethodPresent(MixedColorBitmask.class, "bitSizeOf(zserio.runtime.array.PackingContext"); - assertMethodPresent(MixedColorBitmask.class, - "initializeOffsets(zserio.runtime.array.PackingContext"); + assertMethodPresent(MixedColorBitmask.class, "initializeOffsets(zserio.runtime.array.PackingContext"); assertMethodPresent(MixedColorBitmask.class, "write(zserio.runtime.array.PackingContext"); } @@ -218,12 +216,10 @@ public void packedColorEnumMethods() @Test public void packedColorBitmaskMethods() { - assertMethodPresent(PackedColorBitmask.class, - "PackedColorBitmask(zserio.runtime.array.PackingContext"); + assertMethodPresent(PackedColorBitmask.class, "PackedColorBitmask(zserio.runtime.array.PackingContext"); assertMethodPresent(PackedColorBitmask.class, "initPackingContext"); assertMethodPresent(PackedColorBitmask.class, "bitSizeOf(zserio.runtime.array.PackingContext"); - assertMethodPresent(PackedColorBitmask.class, - "initializeOffsets(zserio.runtime.array.PackingContext"); + assertMethodPresent(PackedColorBitmask.class, "initializeOffsets(zserio.runtime.array.PackingContext"); assertMethodPresent(PackedColorBitmask.class, "write(zserio.runtime.array.PackingContext"); } @@ -272,10 +268,9 @@ private UnpackedColorStruct[] createUnpackedColors() unpackedColorUnion3.setColorEnum(UnpackedColorEnum.BLUE); unpackedColorChoice3.setColorUnion(unpackedColorUnion3); return new UnpackedColorStruct[] { - new UnpackedColorStruct(unpackedColorChoice1.getSelector(), unpackedColorChoice1), - new UnpackedColorStruct(unpackedColorChoice2.getSelector(), unpackedColorChoice2), - new UnpackedColorStruct(unpackedColorChoice3.getSelector(), unpackedColorChoice3) - }; + new UnpackedColorStruct(unpackedColorChoice1.getSelector(), unpackedColorChoice1), + new UnpackedColorStruct(unpackedColorChoice2.getSelector(), unpackedColorChoice2), + new UnpackedColorStruct(unpackedColorChoice3.getSelector(), unpackedColorChoice3)}; } private MixedColorStruct[] createMixedColors() @@ -284,18 +279,15 @@ private MixedColorStruct[] createMixedColors() mixedColorChoice1.setColorName("purple"); final MixedColorChoice mixedColorChoice2 = new MixedColorChoice(false); final MixedColorUnion mixedColorUnion2 = new MixedColorUnion(); - mixedColorUnion2.setColorBitmask( - MixedColorBitmask.Values.BLUE.or(MixedColorBitmask.Values.GREEN)); + mixedColorUnion2.setColorBitmask(MixedColorBitmask.Values.BLUE.or(MixedColorBitmask.Values.GREEN)); mixedColorChoice2.setColorUnion(mixedColorUnion2); final MixedColorChoice mixedColorChoice3 = new MixedColorChoice(false); final MixedColorUnion mixedColorUnion3 = new MixedColorUnion(); mixedColorUnion3.setColorEnum(MixedColorEnum.RED); mixedColorChoice3.setColorUnion(mixedColorUnion3); - return new MixedColorStruct[] { - new MixedColorStruct(mixedColorChoice1.getSelector(), mixedColorChoice1), - new MixedColorStruct(mixedColorChoice2.getSelector(), mixedColorChoice2), - new MixedColorStruct(mixedColorChoice3.getSelector(), mixedColorChoice3) - }; + return new MixedColorStruct[] {new MixedColorStruct(mixedColorChoice1.getSelector(), mixedColorChoice1), + new MixedColorStruct(mixedColorChoice2.getSelector(), mixedColorChoice2), + new MixedColorStruct(mixedColorChoice3.getSelector(), mixedColorChoice3)}; } private PackedColorStruct[] createPackedColors() @@ -304,34 +296,26 @@ private PackedColorStruct[] createPackedColors() packedColorChoice1.setColorName("grey"); final PackedColorChoice packedColorChoice2 = new PackedColorChoice(false); final PackedColorUnion packedColorUnion2 = new PackedColorUnion(); - packedColorUnion2.setColorBitmask( - PackedColorBitmask.Values.BLUE.or(PackedColorBitmask.Values.RED)); + packedColorUnion2.setColorBitmask(PackedColorBitmask.Values.BLUE.or(PackedColorBitmask.Values.RED)); packedColorChoice2.setColorUnion(packedColorUnion2); final PackedColorChoice packedColorChoice3 = new PackedColorChoice(false); final PackedColorUnion packedColorUnion3 = new PackedColorUnion(); packedColorUnion3.setColorEnum(PackedColorEnum.GREEN); packedColorChoice3.setColorUnion(packedColorUnion3); return new PackedColorStruct[] { - new PackedColorStruct(packedColorChoice1.getSelector(), packedColorChoice1), - new PackedColorStruct(packedColorChoice2.getSelector(), packedColorChoice2), - new PackedColorStruct(packedColorChoice3.getSelector(), packedColorChoice3) - }; + new PackedColorStruct(packedColorChoice1.getSelector(), packedColorChoice1), + new PackedColorStruct(packedColorChoice2.getSelector(), packedColorChoice2), + new PackedColorStruct(packedColorChoice3.getSelector(), packedColorChoice3)}; } private UnpackedColorsHolder createUnpackedColorsHolder() { - return new UnpackedColorsHolder( - createUnpackedColors(), - createMixedColors() - ); + return new UnpackedColorsHolder(createUnpackedColors(), createMixedColors()); } private PackedColorsHolder createPackedColorsHolder() { - return new PackedColorsHolder( - createMixedColors(), - createPackedColors() - ); + return new PackedColorsHolder(createMixedColors(), createPackedColors()); } private static final String BLOB_NAME = "packing_interface_optimization.blob"; diff --git a/test/language/array_types/java/array_types/VariableArrayStructCastInt8Test.java b/test/language/array_types/java/array_types/VariableArrayStructCastInt8Test.java index b6df0b793..479e9af4d 100644 --- a/test/language/array_types/java/array_types/VariableArrayStructCastInt8Test.java +++ b/test/language/array_types/java/array_types/VariableArrayStructCastInt8Test.java @@ -1,19 +1,20 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; -import array_types.variable_array_struct_cast_int8.TestStructure; -import array_types.variable_array_struct_cast_int8.VariableArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import array_types.variable_array_struct_cast_int8.TestStructure; +import array_types.variable_array_struct_cast_int8.VariableArray; + public class VariableArrayStructCastInt8Test { @Test diff --git a/test/language/array_types/java/array_types/VariableArrayStructCastVarUIntTest.java b/test/language/array_types/java/array_types/VariableArrayStructCastVarUIntTest.java index 4fe92f951..e7e45f280 100644 --- a/test/language/array_types/java/array_types/VariableArrayStructCastVarUIntTest.java +++ b/test/language/array_types/java/array_types/VariableArrayStructCastVarUIntTest.java @@ -1,20 +1,21 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; -import array_types.variable_array_struct_cast_varuint.TestStructure; -import array_types.variable_array_struct_cast_varuint.VariableArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import array_types.variable_array_struct_cast_varuint.TestStructure; +import array_types.variable_array_struct_cast_varuint.VariableArray; + public class VariableArrayStructCastVarUIntTest { @Test diff --git a/test/language/array_types/java/array_types/VariableArraySubtypedStructTest.java b/test/language/array_types/java/array_types/VariableArraySubtypedStructTest.java index fee6a0af6..66054b3f7 100644 --- a/test/language/array_types/java/array_types/VariableArraySubtypedStructTest.java +++ b/test/language/array_types/java/array_types/VariableArraySubtypedStructTest.java @@ -1,19 +1,20 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; -import array_types.variable_array_subtyped_struct.TestStructure; -import array_types.variable_array_subtyped_struct.VariableArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import array_types.variable_array_subtyped_struct.TestStructure; +import array_types.variable_array_subtyped_struct.VariableArray; + public class VariableArraySubtypedStructTest { @Test diff --git a/test/language/array_types/java/array_types/VariableArrayTernaryOperatorTest.java b/test/language/array_types/java/array_types/VariableArrayTernaryOperatorTest.java index 8577866ec..cacb240a7 100644 --- a/test/language/array_types/java/array_types/VariableArrayTernaryOperatorTest.java +++ b/test/language/array_types/java/array_types/VariableArrayTernaryOperatorTest.java @@ -1,16 +1,17 @@ package array_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; -import array_types.variable_array_ternary_operator.VariableArray; -import array_types.variable_array_ternary_operator.VariableArrayElement; +import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; +import array_types.variable_array_ternary_operator.VariableArray; +import array_types.variable_array_ternary_operator.VariableArrayElement; + public class VariableArrayTernaryOperatorTest { @Test @@ -31,8 +32,8 @@ private VariableArray createVariableArray(boolean isFirstSizeUsed) { final VariableArray variableArray = new VariableArray(); variableArray.setIsFirstSizeUsed(isFirstSizeUsed); - final byte currentSize = (isFirstSizeUsed) ? variableArray.getFirstSize() : - variableArray.getSecondSize(); + final byte currentSize = + (isFirstSizeUsed) ? variableArray.getFirstSize() : variableArray.getSecondSize(); final int arraySize = (int)currentSize * (int)currentSize; final VariableArrayElement array[] = new VariableArrayElement[arraySize]; for (int i = 0; i < arraySize; ++i) diff --git a/test/language/bitmask_types/build.xml b/test/language/bitmask_types/build.xml index a38fbbe17..f612d26c8 100644 --- a/test/language/bitmask_types/build.xml +++ b/test/language/bitmask_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/bitmask_types/java/bitmask_types/bitfield_bitmask/BitfieldBitmaskTest.java b/test/language/bitmask_types/java/bitmask_types/bitfield_bitmask/BitfieldBitmaskTest.java index 82f3f41de..540457950 100644 --- a/test/language/bitmask_types/java/bitmask_types/bitfield_bitmask/BitfieldBitmaskTest.java +++ b/test/language/bitmask_types/java/bitmask_types/bitfield_bitmask/BitfieldBitmaskTest.java @@ -1,13 +1,14 @@ package bitmask_types.bitfield_bitmask; import static org.junit.jupiter.api.Assertions.*; + +import java.io.IOException; + import org.junit.jupiter.api.Test; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import java.io.IOException; - public class BitfieldBitmaskTest { @Test @@ -41,8 +42,8 @@ public void readConstructor() throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBits(Permission.Values.WRITE.getValue(), PERMISSION_BITSIZEOF); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.WRITE, readPermission); } diff --git a/test/language/bitmask_types/java/bitmask_types/bitfield_const_bitmask/BitfieldConstBitmaskTest.java b/test/language/bitmask_types/java/bitmask_types/bitfield_const_bitmask/BitfieldConstBitmaskTest.java index 3479dbb22..d106c7758 100644 --- a/test/language/bitmask_types/java/bitmask_types/bitfield_const_bitmask/BitfieldConstBitmaskTest.java +++ b/test/language/bitmask_types/java/bitmask_types/bitfield_const_bitmask/BitfieldConstBitmaskTest.java @@ -1,10 +1,11 @@ package bitmask_types.bitfield_const_bitmask; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -119,8 +120,8 @@ public void write() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); permission.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(permission, readPermission); } diff --git a/test/language/bitmask_types/java/bitmask_types/bitmask_defined_by_constant/BitmaskDefinedByConstantTest.java b/test/language/bitmask_types/java/bitmask_types/bitmask_defined_by_constant/BitmaskDefinedByConstantTest.java index f7c8f73b9..ab0ac4f66 100644 --- a/test/language/bitmask_types/java/bitmask_types/bitmask_defined_by_constant/BitmaskDefinedByConstantTest.java +++ b/test/language/bitmask_types/java/bitmask_types/bitmask_defined_by_constant/BitmaskDefinedByConstantTest.java @@ -1,10 +1,11 @@ package bitmask_types.bitmask_defined_by_constant; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -41,8 +42,8 @@ public void readConstructor() throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBits(Permission.Values.WRITE.getValue(), PERMISSION_BITSIZEOF); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.WRITE, readPermission); } diff --git a/test/language/bitmask_types/java/bitmask_types/bitmask_used_by_bitmask/BitmaskUsedByBitmaskTest.java b/test/language/bitmask_types/java/bitmask_types/bitmask_used_by_bitmask/BitmaskUsedByBitmaskTest.java index 912b5e62b..9213e7c03 100644 --- a/test/language/bitmask_types/java/bitmask_types/bitmask_used_by_bitmask/BitmaskUsedByBitmaskTest.java +++ b/test/language/bitmask_types/java/bitmask_types/bitmask_used_by_bitmask/BitmaskUsedByBitmaskTest.java @@ -1,10 +1,11 @@ package bitmask_types.bitmask_used_by_bitmask; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -35,8 +36,8 @@ public void readConstructor() throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBits(Permission.Values.WRITE.getValue(), PERMISSION_BITSIZEOF); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.WRITE, readPermission); } diff --git a/test/language/bitmask_types/java/bitmask_types/bitmask_without_none/BitmaskWithoutNoneTest.java b/test/language/bitmask_types/java/bitmask_types/bitmask_without_none/BitmaskWithoutNoneTest.java index 4a315cc20..669127f8d 100644 --- a/test/language/bitmask_types/java/bitmask_types/bitmask_without_none/BitmaskWithoutNoneTest.java +++ b/test/language/bitmask_types/java/bitmask_types/bitmask_without_none/BitmaskWithoutNoneTest.java @@ -1,10 +1,11 @@ package bitmask_types.bitmask_without_none; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -41,8 +42,8 @@ public void readConstructor() throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBits(Permission.Values.WRITE.getValue(), PERMISSION_BITSIZEOF); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.WRITE, readPermission); } diff --git a/test/language/bitmask_types/java/bitmask_types/uint64_bitmask/UInt64BitmaskTest.java b/test/language/bitmask_types/java/bitmask_types/uint64_bitmask/UInt64BitmaskTest.java index 6e02b2aea..31e758de2 100644 --- a/test/language/bitmask_types/java/bitmask_types/uint64_bitmask/UInt64BitmaskTest.java +++ b/test/language/bitmask_types/java/bitmask_types/uint64_bitmask/UInt64BitmaskTest.java @@ -1,11 +1,12 @@ package bitmask_types.uint64_bitmask; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -22,8 +23,8 @@ public void emptyConstructor() public void valueConstructor() { final Permission permission = new Permission(WRITE_PERMISSION_VALUE); - assertTrue(permission.and(Permission.Values.write_permission).equals( - Permission.Values.write_permission)); + assertTrue( + permission.and(Permission.Values.write_permission).equals(Permission.Values.write_permission)); } @Test @@ -44,8 +45,8 @@ public void readConstructor() throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBigInteger(Permission.Values.write_permission.getValue(), PERMISSION_BITSIZEOF); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.write_permission, readPermission); } @@ -183,8 +184,8 @@ public void xor() final Permission read = Permission.Values.READ_PERMISSION; final Permission write = Permission.Values.write_permission; - assertEquals(read.xor(write), - Permission.Values.READ_PERMISSION.xor(Permission.Values.write_permission)); + assertEquals( + read.xor(write), Permission.Values.READ_PERMISSION.xor(Permission.Values.write_permission)); assertEquals(READ_PERMISSION_VALUE.xor(WRITE_PERMISSION_VALUE), read.xor(write).getValue()); assertEquals(read, (read.xor(write)).and(read)); assertEquals(write, (read.xor(write)).and(write)); diff --git a/test/language/bitmask_types/java/bitmask_types/uint8_bitmask/UInt8BitmaskTest.java b/test/language/bitmask_types/java/bitmask_types/uint8_bitmask/UInt8BitmaskTest.java index 519266cff..7336f3997 100644 --- a/test/language/bitmask_types/java/bitmask_types/uint8_bitmask/UInt8BitmaskTest.java +++ b/test/language/bitmask_types/java/bitmask_types/uint8_bitmask/UInt8BitmaskTest.java @@ -1,10 +1,11 @@ package bitmask_types.uint8_bitmask; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -41,8 +42,8 @@ public void readConstructor() throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBits(Permission.Values.WRITE.getValue(), PERMISSION_BITSIZEOF); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.WRITE, readPermission); } diff --git a/test/language/bitmask_types/java/bitmask_types/varuint_bitmask/VarUIntBitmaskTest.java b/test/language/bitmask_types/java/bitmask_types/varuint_bitmask/VarUIntBitmaskTest.java index eda707ca4..a1f9c469f 100644 --- a/test/language/bitmask_types/java/bitmask_types/varuint_bitmask/VarUIntBitmaskTest.java +++ b/test/language/bitmask_types/java/bitmask_types/varuint_bitmask/VarUIntBitmaskTest.java @@ -1,16 +1,17 @@ package bitmask_types.varuint_bitmask; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + +import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.BitSizeOfCalculator; public class VarUIntBitmaskTest { @@ -46,8 +47,8 @@ public void readConstructor() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBigInteger(Permission.Values.WRITE.getValue(), BitSizeOfCalculator.getBitSizeOfVarUInt(Permission.Values.WRITE.getValue())); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Permission readPermission = new Permission(reader); assertEquals(Permission.Values.WRITE, readPermission); } diff --git a/test/language/builtin_types/build.xml b/test/language/builtin_types/build.xml index 36883181d..a40808d0f 100644 --- a/test/language/builtin_types/build.xml +++ b/test/language/builtin_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/builtin_types/java/builtin_types/AllBuiltInTypesTest.java b/test/language/builtin_types/java/builtin_types/AllBuiltInTypesTest.java index d8ba491fa..0a65be330 100644 --- a/test/language/builtin_types/java/builtin_types/AllBuiltInTypesTest.java +++ b/test/language/builtin_types/java/builtin_types/AllBuiltInTypesTest.java @@ -1,16 +1,17 @@ package builtin_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; - import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; + import builtin_types.all_builtin_types.AllBuiltInTypes; import builtin_types.all_builtin_types.ExternalStructure; diff --git a/test/language/builtin_types/java/builtin_types/BitFieldFunctionLengthTest.java b/test/language/builtin_types/java/builtin_types/BitFieldFunctionLengthTest.java index 374829878..a0408dc19 100644 --- a/test/language/builtin_types/java/builtin_types/BitFieldFunctionLengthTest.java +++ b/test/language/builtin_types/java/builtin_types/BitFieldFunctionLengthTest.java @@ -1,16 +1,17 @@ package builtin_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; - import java.math.BigInteger; -import builtin_types.bitfield_function_length.Container; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.SerializeUtil; +import builtin_types.bitfield_function_length.Container; + public class BitFieldFunctionLengthTest { @Test @@ -32,16 +33,14 @@ public void readWrite() throws IOException private Container createContainer() { - return new Container( - BigInteger.valueOf(0xDEAD), // id + return new Container(BigInteger.valueOf(0xDEAD), // id new BigInteger[] {BigInteger.valueOf(0xDEAD1), BigInteger.valueOf(0xDEAD2), - BigInteger.valueOf(0xDEAD3), BigInteger.valueOf(0xDEAD4), - BigInteger.valueOf(0xDEAD5), BigInteger.valueOf(0xDEAD6), - BigInteger.valueOf(0xDEAD7)}, // array[7] + BigInteger.valueOf(0xDEAD3), BigInteger.valueOf(0xDEAD4), BigInteger.valueOf(0xDEAD5), + BigInteger.valueOf(0xDEAD6), BigInteger.valueOf(0xDEAD7)}, // array[7] (byte)0x3F, // bitField3 (7 bits) (short)0x1FFF, // bitField4 (0xDEAD & 0x0F = 0xD = 13 bits) (int)0x1FFF // bitField5 (0xDEAD % 32 = 13 bits) - ); + ); } private static final File TEST_FILE = new File("bit_field_function_length.blob"); diff --git a/test/language/builtin_types/java/builtin_types/BitFieldUInt64LengthTest.java b/test/language/builtin_types/java/builtin_types/BitFieldUInt64LengthTest.java index 1dd6dc98a..0342319fe 100644 --- a/test/language/builtin_types/java/builtin_types/BitFieldUInt64LengthTest.java +++ b/test/language/builtin_types/java/builtin_types/BitFieldUInt64LengthTest.java @@ -1,16 +1,17 @@ package builtin_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; - import java.math.BigInteger; -import builtin_types.bitfield_uint64_length.Container; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.SerializeUtil; +import builtin_types.bitfield_uint64_length.Container; + public class BitFieldUInt64LengthTest { @Test diff --git a/test/language/choice_types/build.xml b/test/language/choice_types/build.xml index 2d2d683a8..05f74d9bc 100644 --- a/test/language/choice_types/build.xml +++ b/test/language/choice_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/choice_types/java/choice_types/BitmaskParamChoiceTest.java b/test/language/choice_types/java/choice_types/BitmaskParamChoiceTest.java index 6942df36c..72c33174a 100644 --- a/test/language/choice_types/java/choice_types/BitmaskParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/BitmaskParamChoiceTest.java @@ -1,18 +1,19 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.bitmask_param_choice.BitmaskParamChoice; -import choice_types.bitmask_param_choice.Selector; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.bitmask_param_choice.BitmaskParamChoice; +import choice_types.bitmask_param_choice.Selector; + public class BitmaskParamChoiceTest { @Test @@ -162,8 +163,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError bitmaskParamChoice.setBlack(byteValue); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); bitmaskParamChoice.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); BitmaskParamChoice readBitmaskParamChoice = new BitmaskParamChoice(reader, selector); assertEquals(byteValue, readBitmaskParamChoice.getBlack()); diff --git a/test/language/choice_types/java/choice_types/BoolParamChoiceTest.java b/test/language/choice_types/java/choice_types/BoolParamChoiceTest.java index 3f2effd5d..168a0b314 100644 --- a/test/language/choice_types/java/choice_types/BoolParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/BoolParamChoiceTest.java @@ -1,17 +1,18 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.bool_param_choice.BoolParamChoice; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.bool_param_choice.BoolParamChoice; + public class BoolParamChoiceTest { @Test @@ -28,8 +29,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final boolean selector = false; final byte value = (byte)234; final BitBuffer buffer = writeBoolParamChoiceToBitBuffer(selector, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final BoolParamChoice boolParamChoice = new BoolParamChoice(reader, selector); assertEquals(selector, boolParamChoice.getSelector()); assertEquals((short)value, boolParamChoice.getGrey()); @@ -143,8 +144,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError boolParamChoice.setBlack(byteValue); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); boolParamChoice.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); BoolParamChoice readBoolParamChoice = new BoolParamChoice(reader, selector); assertEquals(byteValue, readBoolParamChoice.getBlack()); diff --git a/test/language/choice_types/java/choice_types/ChoiceCompatibilityCheckTest.java b/test/language/choice_types/java/choice_types/ChoiceCompatibilityCheckTest.java index cb5614920..ce7299e85 100644 --- a/test/language/choice_types/java/choice_types/ChoiceCompatibilityCheckTest.java +++ b/test/language/choice_types/java/choice_types/ChoiceCompatibilityCheckTest.java @@ -1,26 +1,27 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; + +import zserio.runtime.io.ByteArrayBitStreamReader; +import zserio.runtime.io.ByteArrayBitStreamWriter; +import zserio.runtime.io.SerializeUtil; +import zserio.runtime.io.Writer; import choice_types.choice_compatibility_check.ChoiceCompatibilityCheckVersion1; import choice_types.choice_compatibility_check.ChoiceCompatibilityCheckVersion2; -import choice_types.choice_compatibility_check.HolderVersion1; -import choice_types.choice_compatibility_check.HolderVersion2; import choice_types.choice_compatibility_check.ChoiceVersion1; import choice_types.choice_compatibility_check.ChoiceVersion2; -import choice_types.choice_compatibility_check.EnumVersion1; -import choice_types.choice_compatibility_check.EnumVersion2; import choice_types.choice_compatibility_check.CoordXY; import choice_types.choice_compatibility_check.CoordXYZ; - -import zserio.runtime.io.ByteArrayBitStreamReader; -import zserio.runtime.io.ByteArrayBitStreamWriter; -import zserio.runtime.io.SerializeUtil; -import zserio.runtime.io.Writer; +import choice_types.choice_compatibility_check.EnumVersion1; +import choice_types.choice_compatibility_check.EnumVersion2; +import choice_types.choice_compatibility_check.HolderVersion1; +import choice_types.choice_compatibility_check.HolderVersion2; public class ChoiceCompatibilityCheckTest { @@ -28,8 +29,8 @@ public class ChoiceCompatibilityCheckTest public void writeVersion1ReadVersion1() throws IOException { final ChoiceCompatibilityCheckVersion1 choiceCompatibilityCheckVersion1 = create(createArrayVersion1()); - final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = writeReadVersion1( - choiceCompatibilityCheckVersion1); + final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = + writeReadVersion1(choiceCompatibilityCheckVersion1); assertEquals(choiceCompatibilityCheckVersion1, readChoiceCompatibilityCheckVersion1); } @@ -37,8 +38,8 @@ public void writeVersion1ReadVersion1() throws IOException public void writeVersion1ReadVersion2() throws IOException { final ChoiceCompatibilityCheckVersion1 choiceCompatibilityCheckVersion1 = create(createArrayVersion1()); - final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = writeReadVersion2( - choiceCompatibilityCheckVersion1); + final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = + writeReadVersion2(choiceCompatibilityCheckVersion1); final HolderVersion2[] expectedArrayVersion2 = createArrayVersion2WithVersion1Fields(); assertArrayEquals(expectedArrayVersion2, readChoiceCompatibilityCheckVersion2.getArray()); @@ -50,8 +51,8 @@ public void writeVersion2ReadVersion1() throws IOException { final ChoiceCompatibilityCheckVersion2 choiceCompatibilityCheckVersion2 = create(createArrayVersion2WithVersion1Fields()); - final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = writeReadVersion1( - choiceCompatibilityCheckVersion2); + final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = + writeReadVersion1(choiceCompatibilityCheckVersion2); final HolderVersion1[] expectedArrayVersion1 = createArrayVersion1(); assertArrayEquals(expectedArrayVersion1, readChoiceCompatibilityCheckVersion1.getArray()); @@ -62,8 +63,8 @@ public void writeVersion2ReadVersion1() throws IOException public void writeVersion2ReadVersion2() throws IOException { final ChoiceCompatibilityCheckVersion2 choiceCompatibilityCheckVersion2 = create(createArrayVersion2()); - final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = writeReadVersion2( - choiceCompatibilityCheckVersion2); + final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = + writeReadVersion2(choiceCompatibilityCheckVersion2); assertEquals(choiceCompatibilityCheckVersion2, readChoiceCompatibilityCheckVersion2); } @@ -71,8 +72,8 @@ public void writeVersion2ReadVersion2() throws IOException public void writeVersion1ReadVersion1File() throws IOException { final ChoiceCompatibilityCheckVersion1 choiceCompatibilityCheckVersion1 = create(createArrayVersion1()); - final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = writeReadVersion1File( - choiceCompatibilityCheckVersion1, "version1_version1"); + final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = + writeReadVersion1File(choiceCompatibilityCheckVersion1, "version1_version1"); assertEquals(choiceCompatibilityCheckVersion1, readChoiceCompatibilityCheckVersion1); } @@ -80,8 +81,8 @@ public void writeVersion1ReadVersion1File() throws IOException public void writeVersion1ReadVersion2File() throws IOException { final ChoiceCompatibilityCheckVersion1 choiceCompatibilityCheckVersion1 = create(createArrayVersion1()); - final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = writeReadVersion2File( - choiceCompatibilityCheckVersion1, "version1_version2"); + final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = + writeReadVersion2File(choiceCompatibilityCheckVersion1, "version1_version2"); final HolderVersion2[] expectedArrayVersion2 = createArrayVersion2WithVersion1Fields(); assertArrayEquals(expectedArrayVersion2, readChoiceCompatibilityCheckVersion2.getArray()); @@ -93,8 +94,8 @@ public void writeVersion2ReadVersion1File() throws IOException { final ChoiceCompatibilityCheckVersion2 choiceCompatibilityCheckVersion2 = create(createArrayVersion2WithVersion1Fields()); - final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = writeReadVersion1File( - choiceCompatibilityCheckVersion2, "version2_version1"); + final ChoiceCompatibilityCheckVersion1 readChoiceCompatibilityCheckVersion1 = + writeReadVersion1File(choiceCompatibilityCheckVersion2, "version2_version1"); final HolderVersion1[] expectedArrayVersion1 = createArrayVersion1(); assertArrayEquals(expectedArrayVersion1, readChoiceCompatibilityCheckVersion1.getArray()); @@ -105,8 +106,8 @@ public void writeVersion2ReadVersion1File() throws IOException public void writeVersion2ReadVersion2File() throws IOException { final ChoiceCompatibilityCheckVersion2 choiceCompatibilityCheckVersion2 = create(createArrayVersion2()); - final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = writeReadVersion2File( - choiceCompatibilityCheckVersion2, "version2_version2"); + final ChoiceCompatibilityCheckVersion2 readChoiceCompatibilityCheckVersion2 = + writeReadVersion2File(choiceCompatibilityCheckVersion2, "version2_version2"); assertEquals(choiceCompatibilityCheckVersion2, readChoiceCompatibilityCheckVersion2); } @@ -122,36 +123,26 @@ private ChoiceCompatibilityCheckVersion2 create(HolderVersion2 array[]) private HolderVersion1[] createArrayVersion1() { - return new HolderVersion1[] { - createHolderVersion1(EnumVersion1.COORD_XY, 0), - createHolderVersion1(EnumVersion1.TEXT, 1), - createHolderVersion1(EnumVersion1.COORD_XY, 2), - createHolderVersion1(EnumVersion1.TEXT, 3) - }; + return new HolderVersion1[] {createHolderVersion1(EnumVersion1.COORD_XY, 0), + createHolderVersion1(EnumVersion1.TEXT, 1), createHolderVersion1(EnumVersion1.COORD_XY, 2), + createHolderVersion1(EnumVersion1.TEXT, 3)}; } private HolderVersion2[] createArrayVersion2WithVersion1Fields() { - return new HolderVersion2[] { - createHolderVersion2(EnumVersion2.COORD_XY, 0), - createHolderVersion2(EnumVersion2.TEXT, 1), - createHolderVersion2(EnumVersion2.COORD_XY, 2), - createHolderVersion2(EnumVersion2.TEXT, 3) - }; + return new HolderVersion2[] {createHolderVersion2(EnumVersion2.COORD_XY, 0), + createHolderVersion2(EnumVersion2.TEXT, 1), createHolderVersion2(EnumVersion2.COORD_XY, 2), + createHolderVersion2(EnumVersion2.TEXT, 3)}; } private HolderVersion2[] createArrayVersion2() { final HolderVersion2[] arrayVersion2WithVersion1Fields = createArrayVersion2WithVersion1Fields(); - return new HolderVersion2[] { - arrayVersion2WithVersion1Fields[0], - arrayVersion2WithVersion1Fields[1], - arrayVersion2WithVersion1Fields[2], - arrayVersion2WithVersion1Fields[3], - createHolderVersion2(EnumVersion2.COORD_XYZ, 4), - createHolderVersion2(EnumVersion2.COORD_XYZ, 5), - createHolderVersion2(EnumVersion2.COORD_XYZ, 6) - }; + return new HolderVersion2[] {arrayVersion2WithVersion1Fields[0], arrayVersion2WithVersion1Fields[1], + arrayVersion2WithVersion1Fields[2], arrayVersion2WithVersion1Fields[3], + createHolderVersion2(EnumVersion2.COORD_XYZ, 4), + createHolderVersion2(EnumVersion2.COORD_XYZ, 5), + createHolderVersion2(EnumVersion2.COORD_XYZ, 6)}; } private HolderVersion1 createHolderVersion1(EnumVersion1 selector, int index) @@ -178,8 +169,8 @@ else if (selector == EnumVersion2.TEXT) return new HolderVersion2(selector, choice); } - private ChoiceCompatibilityCheckVersion1 writeReadVersion1( - Writer choiceCompatibilityCheck) throws IOException + private ChoiceCompatibilityCheckVersion1 writeReadVersion1(Writer choiceCompatibilityCheck) + throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); choiceCompatibilityCheck.write(writer); @@ -192,8 +183,8 @@ private ChoiceCompatibilityCheckVersion1 writeReadVersion1( return readChoice; } - private ChoiceCompatibilityCheckVersion2 writeReadVersion2( - Writer choiceCompatibilityCheck) throws IOException + private ChoiceCompatibilityCheckVersion2 writeReadVersion2(Writer choiceCompatibilityCheck) + throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); choiceCompatibilityCheck.write(writer); diff --git a/test/language/choice_types/java/choice_types/ChoiceWithArrayTest.java b/test/language/choice_types/java/choice_types/ChoiceWithArrayTest.java index eac230227..81b4b2185 100644 --- a/test/language/choice_types/java/choice_types/ChoiceWithArrayTest.java +++ b/test/language/choice_types/java/choice_types/ChoiceWithArrayTest.java @@ -1,14 +1,16 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; -import choice_types.choice_with_array.TestChoice; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.SerializeUtil; + import choice_types.choice_with_array.Data8; +import choice_types.choice_with_array.TestChoice; public class ChoiceWithArrayTest { @@ -35,8 +37,7 @@ public void writeReadFileArray8() throws IOException { final TestChoice testChoice = new TestChoice((byte)8); testChoice.setArray8( - new Data8[]{new Data8((byte)1), new Data8((byte)2), new Data8((byte)3), new Data8((byte)4)} - ); + new Data8[] {new Data8((byte)1), new Data8((byte)2), new Data8((byte)3), new Data8((byte)4)}); final File file = new File(BLOB_NAME_BASE + "array8.blob"); SerializeUtil.serializeToFile(testChoice, file); @@ -48,7 +49,7 @@ public void writeReadFileArray8() throws IOException public void writeReadFileArray16() throws IOException { final TestChoice testChoice = new TestChoice((byte)16); - testChoice.setArray16(new short[]{10, 20, 30, 40, 50}); + testChoice.setArray16(new short[] {10, 20, 30, 40, 50}); final File file = new File(BLOB_NAME_BASE + "array16.blob"); SerializeUtil.serializeToFile(testChoice, file); diff --git a/test/language/choice_types/java/choice_types/DefaultEmptyChoiceTest.java b/test/language/choice_types/java/choice_types/DefaultEmptyChoiceTest.java index 5f24d7f89..f8d09ff71 100644 --- a/test/language/choice_types/java/choice_types/DefaultEmptyChoiceTest.java +++ b/test/language/choice_types/java/choice_types/DefaultEmptyChoiceTest.java @@ -1,17 +1,18 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.default_empty_choice.DefaultEmptyChoice; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.default_empty_choice.DefaultEmptyChoice; + public class DefaultEmptyChoiceTest { @Test @@ -20,8 +21,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final byte tag = VARIANT_B_SELECTOR; final short value = 234; final BitBuffer buffer = writeDefaultEmptyChoiceToBitBuffer(tag, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final DefaultEmptyChoice defaultEmptyChoice = new DefaultEmptyChoice(reader, tag); assertEquals(tag, defaultEmptyChoice.getTag()); assertEquals((short)value, defaultEmptyChoice.getB()); @@ -48,8 +49,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError defaultEmptyChoiceA.setA(byteValueA); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); defaultEmptyChoiceA.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final DefaultEmptyChoice readDefaultEmptyChoiceA = new DefaultEmptyChoice(reader, VARIANT_A_SELECTOR); assertEquals(byteValueA, readDefaultEmptyChoiceA.getA()); diff --git a/test/language/choice_types/java/choice_types/EmptyChoiceTest.java b/test/language/choice_types/java/choice_types/EmptyChoiceTest.java index e6824a50d..54106ebcb 100644 --- a/test/language/choice_types/java/choice_types/EmptyChoiceTest.java +++ b/test/language/choice_types/java/choice_types/EmptyChoiceTest.java @@ -1,16 +1,17 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.empty_choice.EmptyChoice; +import org.junit.jupiter.api.Test; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import choice_types.empty_choice.EmptyChoice; + public class EmptyChoiceTest { @Test @@ -122,6 +123,5 @@ public void writeReadFile() throws IOException assertEquals(emptyChoice, readEmptyChoice); } - private static final String BLOB_NAME = "empty_choice.blob"; }; diff --git a/test/language/choice_types/java/choice_types/EmptyChoiceWithCaseTest.java b/test/language/choice_types/java/choice_types/EmptyChoiceWithCaseTest.java index 7ab68c799..a5b91ebde 100644 --- a/test/language/choice_types/java/choice_types/EmptyChoiceWithCaseTest.java +++ b/test/language/choice_types/java/choice_types/EmptyChoiceWithCaseTest.java @@ -1,15 +1,16 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.empty_choice_with_case.EmptyChoiceWithCase; +import org.junit.jupiter.api.Test; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.empty_choice_with_case.EmptyChoiceWithCase; + public class EmptyChoiceWithCaseTest { @Test diff --git a/test/language/choice_types/java/choice_types/EmptyChoiceWithDefaultTest.java b/test/language/choice_types/java/choice_types/EmptyChoiceWithDefaultTest.java index 47f56b32b..ee38b79bb 100644 --- a/test/language/choice_types/java/choice_types/EmptyChoiceWithDefaultTest.java +++ b/test/language/choice_types/java/choice_types/EmptyChoiceWithDefaultTest.java @@ -1,15 +1,16 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.empty_choice_with_default.EmptyChoiceWithDefault; +import org.junit.jupiter.api.Test; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.empty_choice_with_default.EmptyChoiceWithDefault; + public class EmptyChoiceWithDefaultTest { @Test diff --git a/test/language/choice_types/java/choice_types/EnumParamChoiceTest.java b/test/language/choice_types/java/choice_types/EnumParamChoiceTest.java index 2a4568180..7d5b9164e 100644 --- a/test/language/choice_types/java/choice_types/EnumParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/EnumParamChoiceTest.java @@ -1,18 +1,19 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.enum_param_choice.EnumParamChoice; -import choice_types.enum_param_choice.Selector; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.enum_param_choice.EnumParamChoice; +import choice_types.enum_param_choice.Selector; + public class EnumParamChoiceTest { @Test @@ -29,8 +30,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final Selector selector = Selector.GREY; final int value = 234; final BitBuffer buffer = writeEnumParamChoiceToBitBuffer(selector, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final EnumParamChoice enumParamChoice = new EnumParamChoice(reader, selector); assertEquals(selector, enumParamChoice.getSelector()); assertEquals((short)value, enumParamChoice.getGrey()); @@ -162,8 +163,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError enumParamChoice.setBlack(byteValue); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); enumParamChoice.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); EnumParamChoice readEnumParamChoice = new EnumParamChoice(reader, selector); assertEquals(byteValue, readEnumParamChoice.getBlack()); diff --git a/test/language/choice_types/java/choice_types/EnumWithRemovedItemParamChoiceTest.java b/test/language/choice_types/java/choice_types/EnumWithRemovedItemParamChoiceTest.java index db6c43d99..d64a29036 100644 --- a/test/language/choice_types/java/choice_types/EnumWithRemovedItemParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/EnumWithRemovedItemParamChoiceTest.java @@ -4,12 +4,12 @@ import org.junit.jupiter.api.Test; -import choice_types.enum_with_removed_item_param_choice.EnumWithRemovedItemParamChoice; -import choice_types.enum_with_removed_item_param_choice.Selector; - import zserio.runtime.io.BitBuffer; import zserio.runtime.io.SerializeUtil; +import choice_types.enum_with_removed_item_param_choice.EnumWithRemovedItemParamChoice; +import choice_types.enum_with_removed_item_param_choice.Selector; + public class EnumWithRemovedItemParamChoiceTest { @Test diff --git a/test/language/choice_types/java/choice_types/ExpressionSelectorChoiceTest.java b/test/language/choice_types/java/choice_types/ExpressionSelectorChoiceTest.java index ce79a8adf..9e70b9113 100644 --- a/test/language/choice_types/java/choice_types/ExpressionSelectorChoiceTest.java +++ b/test/language/choice_types/java/choice_types/ExpressionSelectorChoiceTest.java @@ -1,6 +1,7 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import choice_types.expression_selector_choice.ExpressionSelectorChoice; diff --git a/test/language/choice_types/java/choice_types/FullBitmaskParamChoiceTest.java b/test/language/choice_types/java/choice_types/FullBitmaskParamChoiceTest.java index df340ae12..a4dbc5568 100644 --- a/test/language/choice_types/java/choice_types/FullBitmaskParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/FullBitmaskParamChoiceTest.java @@ -1,18 +1,19 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.full_bitmask_param_choice.FullBitmaskParamChoice; -import choice_types.full_bitmask_param_choice.Selector; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.full_bitmask_param_choice.FullBitmaskParamChoice; +import choice_types.full_bitmask_param_choice.Selector; + public class FullBitmaskParamChoiceTest { @Test @@ -29,8 +30,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final Selector selector = Selector.Values.WHITE; final int value = 234; final BitBuffer buffer = writeFullBitmaskParamChoiceToBitBuffer(selector, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final FullBitmaskParamChoice fullBitmaskParamChoice = new FullBitmaskParamChoice(reader, selector); assertEquals(selector, fullBitmaskParamChoice.getSelector()); assertEquals((short)value, fullBitmaskParamChoice.getWhite()); @@ -91,7 +92,8 @@ public void getSetWhite() @Test public void getSetBlackAndWhite() { - FullBitmaskParamChoice fullBitmaskParamChoice = new FullBitmaskParamChoice(Selector.Values.BLACK_AND_WHITE); + FullBitmaskParamChoice fullBitmaskParamChoice = + new FullBitmaskParamChoice(Selector.Values.BLACK_AND_WHITE); final int value = 65535; fullBitmaskParamChoice.setBlackAndWhite(value); assertEquals(value, fullBitmaskParamChoice.getBlackAndWhite()); @@ -162,8 +164,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError fullBitmaskParamChoice.setBlack(byteValue); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); fullBitmaskParamChoice.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); FullBitmaskParamChoice readFullBitmaskParamChoice = new FullBitmaskParamChoice(reader, selector); assertEquals(byteValue, readFullBitmaskParamChoice.getBlack()); diff --git a/test/language/choice_types/java/choice_types/FullEnumParamChoiceTest.java b/test/language/choice_types/java/choice_types/FullEnumParamChoiceTest.java index 8070e5b59..38218e636 100644 --- a/test/language/choice_types/java/choice_types/FullEnumParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/FullEnumParamChoiceTest.java @@ -1,18 +1,19 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.full_enum_param_choice.FullEnumParamChoice; -import choice_types.full_enum_param_choice.Selector; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.full_enum_param_choice.FullEnumParamChoice; +import choice_types.full_enum_param_choice.Selector; + public class FullEnumParamChoiceTest { @Test @@ -29,8 +30,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final Selector selector = Selector.GREY; final int value = 234; final BitBuffer buffer = writeFullEnumParamChoiceToBitBuffer(selector, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final FullEnumParamChoice fullEnumParamChoice = new FullEnumParamChoice(reader, selector); assertEquals(selector, fullEnumParamChoice.getSelector()); assertEquals((short)value, fullEnumParamChoice.getGrey()); @@ -162,8 +163,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError fullEnumParamChoice.setBlack(byteValue); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); fullEnumParamChoice.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); FullEnumParamChoice readFullEnumParamChoice = new FullEnumParamChoice(reader, selector); assertEquals(byteValue, readFullEnumParamChoice.getBlack()); diff --git a/test/language/choice_types/java/choice_types/FunctionReturningLiteralChoiceTest.java b/test/language/choice_types/java/choice_types/FunctionReturningLiteralChoiceTest.java index b2f32da86..537daff03 100644 --- a/test/language/choice_types/java/choice_types/FunctionReturningLiteralChoiceTest.java +++ b/test/language/choice_types/java/choice_types/FunctionReturningLiteralChoiceTest.java @@ -1,6 +1,7 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import choice_types.function_returning_literal_selector_choice.Selector; diff --git a/test/language/choice_types/java/choice_types/FunctionSelectorChoiceTest.java b/test/language/choice_types/java/choice_types/FunctionSelectorChoiceTest.java index cea47db95..9069ba92e 100644 --- a/test/language/choice_types/java/choice_types/FunctionSelectorChoiceTest.java +++ b/test/language/choice_types/java/choice_types/FunctionSelectorChoiceTest.java @@ -1,6 +1,7 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import choice_types.function_selector_choice.Selector; diff --git a/test/language/choice_types/java/choice_types/UInt16ParamChoiceTest.java b/test/language/choice_types/java/choice_types/UInt16ParamChoiceTest.java index 985277b1e..a98e7b862 100644 --- a/test/language/choice_types/java/choice_types/UInt16ParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/UInt16ParamChoiceTest.java @@ -1,17 +1,18 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.uint16_param_choice.UInt16ParamChoice; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.uint16_param_choice.UInt16ParamChoice; + public class UInt16ParamChoiceTest { @Test @@ -28,8 +29,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final int selector = VARIANT_B_SELECTOR1; final int value = 234; final BitBuffer buffer = writeUInt16ParamChoiceToBitBuffer(selector, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final UInt16ParamChoice uint16ParamChoice = new UInt16ParamChoice(reader, selector); assertEquals(selector, uint16ParamChoice.getSelector()); assertEquals((short)value, uint16ParamChoice.getB()); @@ -175,8 +176,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError uint16ParamChoiceA.setA(byteValueA); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); uint16ParamChoiceA.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UInt16ParamChoice readUInt16ParamChoiceA = new UInt16ParamChoice(reader, VARIANT_A_SELECTOR); assertEquals(byteValueA, readUInt16ParamChoiceA.getA()); diff --git a/test/language/choice_types/java/choice_types/UInt32ParamChoiceTest.java b/test/language/choice_types/java/choice_types/UInt32ParamChoiceTest.java index de9c57c16..fe03a8207 100644 --- a/test/language/choice_types/java/choice_types/UInt32ParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/UInt32ParamChoiceTest.java @@ -1,17 +1,18 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import choice_types.uint32_param_choice.UInt32ParamChoice; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import choice_types.uint32_param_choice.UInt32ParamChoice; + public class UInt32ParamChoiceTest { @Test @@ -28,8 +29,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError final long selector = VARIANT_B_SELECTOR1; final int value = 234; final BitBuffer buffer = writeUInt32ParamChoiceToBitBuffer(selector, value); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final UInt32ParamChoice uint32ParamChoice = new UInt32ParamChoice(reader, selector); assertEquals(selector, uint32ParamChoice.getSelector()); assertEquals((short)value, uint32ParamChoice.getB()); @@ -175,8 +176,8 @@ public void bitStreamWriterWrite() throws IOException, ZserioError uint32ParamChoiceA.setA(byteValueA); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); uint32ParamChoiceA.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UInt32ParamChoice readUInt32ParamChoiceA = new UInt32ParamChoice(reader, VARIANT_A_SELECTOR); assertEquals(byteValueA, readUInt32ParamChoiceA.getA()); diff --git a/test/language/choice_types/java/choice_types/UInt64ParamChoiceTest.java b/test/language/choice_types/java/choice_types/UInt64ParamChoiceTest.java index efe742085..461a76a4c 100644 --- a/test/language/choice_types/java/choice_types/UInt64ParamChoiceTest.java +++ b/test/language/choice_types/java/choice_types/UInt64ParamChoiceTest.java @@ -1,13 +1,12 @@ package choice_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.math.BigInteger; -import choice_types.uint64_param_choice.UInt64ParamChoice; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import choice_types.uint64_param_choice.UInt64ParamChoice; + public class UInt64ParamChoiceTest { @Test @@ -29,8 +30,8 @@ public void bitStreamReaderConstructor() throws IOException, ZserioError { final short value = 234; final BitBuffer buffer = writeUInt64ParamChoiceToBitBuffer(VARIANT_B_SELECTOR, value); - final ByteArrayBitStreamReader stream = new ByteArrayBitStreamReader(buffer.getBuffer(), - buffer.getBitSize()); + final ByteArrayBitStreamReader stream = + new ByteArrayBitStreamReader(buffer.getBuffer(), buffer.getBitSize()); final UInt64ParamChoice uint64ParamChoice = new UInt64ParamChoice(stream, VARIANT_B_SELECTOR); stream.close(); assertEquals(VARIANT_B_SELECTOR, uint64ParamChoice.getSelector()); @@ -158,8 +159,8 @@ public void writeRead() throws IOException, ZserioError uint64ParamChoice.setA(byteValue); ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); uint64ParamChoice.write(writer); - ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(writer.toByteArray(), - writer.getBitPosition()); + ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); UInt64ParamChoice readUInt64ParamChoice = new UInt64ParamChoice(reader, VARIANT_A_SELECTOR); assertEquals(byteValue, readUInt64ParamChoice.getA()); diff --git a/test/language/constants/build.xml b/test/language/constants/build.xml index c57bc8a81..4d9b1c0ec 100644 --- a/test/language/constants/build.xml +++ b/test/language/constants/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/constants/java/constants/ConstantsTest.java b/test/language/constants/java/constants/ConstantsTest.java index 0599bfa51..a92f0dd62 100644 --- a/test/language/constants/java/constants/ConstantsTest.java +++ b/test/language/constants/java/constants/ConstantsTest.java @@ -1,10 +1,11 @@ package constants; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + public class ConstantsTest { @Test @@ -302,15 +303,14 @@ public void unicodeEscStringConstant() @Test public void hexEscStringConstant() { - assertEquals("Test string with hexadecimal escape \u0019", - HEX_ESC_STRING_CONSTANT.HEX_ESC_STRING_CONSTANT); + assertEquals( + "Test string with hexadecimal escape \u0019", HEX_ESC_STRING_CONSTANT.HEX_ESC_STRING_CONSTANT); } @Test public void octalEscStringConstant() { - assertEquals("Test string with octal escape \031", - OCTAL_ESC_STRING_CONSTANT.OCTAL_ESC_STRING_CONSTANT); + assertEquals("Test string with octal escape \031", OCTAL_ESC_STRING_CONSTANT.OCTAL_ESC_STRING_CONSTANT); } @Test @@ -373,4 +373,3 @@ public void subtypeToBitmaskConstant() assertEquals(Permission.Values.READ, SUBTYPE_READ_PERMISSION.SUBTYPE_READ_PERMISSION); } } - diff --git a/test/language/constraints/build.xml b/test/language/constraints/build.xml index 6da47d9c0..7875c3cfa 100644 --- a/test/language/constraints/build.xml +++ b/test/language/constraints/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/constraints/java/constraints/ArrayLengthofConstraintTest.java b/test/language/constraints/java/constraints/ArrayLengthofConstraintTest.java index 900b290c4..9f5d490c2 100644 --- a/test/language/constraints/java/constraints/ArrayLengthofConstraintTest.java +++ b/test/language/constraints/java/constraints/ArrayLengthofConstraintTest.java @@ -1,11 +1,10 @@ package constraints; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import constraints.array_lengthof_constraint.ArrayLengthofConstraint; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import constraints.array_lengthof_constraint.ArrayLengthofConstraint; + public class ArrayLengthofConstraintTest { @Test @@ -51,8 +52,8 @@ public void writeReadCorrectLength() throws IOException, ZserioError array[i] = i; arrayLengthofConstraint.setArray(array); final BitBuffer bitBuffer = SerializeUtil.serialize(arrayLengthofConstraint); - final ArrayLengthofConstraint readArrayLengthofConstraint = SerializeUtil.deserialize( - ArrayLengthofConstraint.class, bitBuffer); + final ArrayLengthofConstraint readArrayLengthofConstraint = + SerializeUtil.deserialize(ArrayLengthofConstraint.class, bitBuffer); assertEquals(CORRECT_LENGTH, readArrayLengthofConstraint.getArray().length); assertTrue(arrayLengthofConstraint.equals(readArrayLengthofConstraint)); } @@ -83,8 +84,7 @@ public void writeWrongLengthGreater() throws IOException, ZserioError writer.close(); } - private BitBuffer writeArrayLengthofConstraintToBitBuffer(int length) - throws IOException + private BitBuffer writeArrayLengthofConstraintToBitBuffer(int length) throws IOException { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { diff --git a/test/language/constraints/java/constraints/ChoiceConstraintsTest.java b/test/language/constraints/java/constraints/ChoiceConstraintsTest.java index a618b6483..3c9859181 100644 --- a/test/language/constraints/java/constraints/ChoiceConstraintsTest.java +++ b/test/language/constraints/java/constraints/ChoiceConstraintsTest.java @@ -1,11 +1,10 @@ package constraints; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import constraints.choice_constraints.ChoiceConstraints; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import constraints.choice_constraints.ChoiceConstraints; + public class ChoiceConstraintsTest { @Test @@ -58,8 +59,8 @@ public void writeReadCorrectChoiceConstraints() throws IOException, ZserioError choiceConstraints.setValue16(value16); final BitBuffer bitBuffer = SerializeUtil.serialize(choiceConstraints); - final ChoiceConstraints readChoiceConstraints = SerializeUtil.deserialize( - ChoiceConstraints.class, bitBuffer, selector); + final ChoiceConstraints readChoiceConstraints = + SerializeUtil.deserialize(ChoiceConstraints.class, bitBuffer, selector); assertEquals(selector, readChoiceConstraints.getSelector()); assertEquals(value16, readChoiceConstraints.getValue16()); assertTrue(choiceConstraints.equals(readChoiceConstraints)); diff --git a/test/language/constraints/java/constraints/StructureBitmaskConstraintsTest.java b/test/language/constraints/java/constraints/StructureBitmaskConstraintsTest.java index edf579b8b..24b29b24c 100644 --- a/test/language/constraints/java/constraints/StructureBitmaskConstraintsTest.java +++ b/test/language/constraints/java/constraints/StructureBitmaskConstraintsTest.java @@ -1,12 +1,10 @@ package constraints; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import constraints.structure_bitmask_constraints.Availability; -import constraints.structure_bitmask_constraints.StructureBitmaskConstraints; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -16,15 +14,18 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import constraints.structure_bitmask_constraints.Availability; +import constraints.structure_bitmask_constraints.StructureBitmaskConstraints; + public class StructureBitmaskConstraintsTest { @Test public void readCorrectConstraints() throws IOException, ZserioError { - final Availability availability = Availability.Values.COORD_X.or(Availability.Values.COORD_Y).or( - Availability.Values.COORD_Z); - final BitBuffer bitBuffer = writeStructureBitmaskConstraintsToBitBuffer( - availability, (short)1, (short)1, (short)1); + final Availability availability = + Availability.Values.COORD_X.or(Availability.Values.COORD_Y).or(Availability.Values.COORD_Z); + final BitBuffer bitBuffer = + writeStructureBitmaskConstraintsToBitBuffer(availability, (short)1, (short)1, (short)1); final BitStreamReader stream = new ByteArrayBitStreamReader(bitBuffer); final StructureBitmaskConstraints structureBitmaskConstraints = new StructureBitmaskConstraints(stream); stream.close(); @@ -37,8 +38,8 @@ public void readCorrectConstraints() throws IOException, ZserioError public void readWrongCoordZConstraint() throws IOException, ZserioError { final Availability availability = Availability.Values.COORD_X.or(Availability.Values.COORD_Y); - final BitBuffer bitBuffer = writeStructureBitmaskConstraintsToBitBuffer( - availability, (short)1, (short)1, (short)1); + final BitBuffer bitBuffer = + writeStructureBitmaskConstraintsToBitBuffer(availability, (short)1, (short)1, (short)1); final BitStreamReader stream = new ByteArrayBitStreamReader(bitBuffer); assertThrows(ZserioError.class, () -> new StructureBitmaskConstraints(stream)); stream.close(); @@ -48,8 +49,8 @@ public void readWrongCoordZConstraint() throws IOException, ZserioError public void readWrongCoordYConstraint() throws IOException, ZserioError { final Availability availability = Availability.Values.COORD_X.or(Availability.Values.COORD_Z); - final BitBuffer bitBuffer = writeStructureBitmaskConstraintsToBitBuffer( - availability, (short)1, (short)1, (short)1); + final BitBuffer bitBuffer = + writeStructureBitmaskConstraintsToBitBuffer(availability, (short)1, (short)1, (short)1); final BitStreamReader stream = new ByteArrayBitStreamReader(bitBuffer); assertThrows(ZserioError.class, () -> new StructureBitmaskConstraints(stream)); stream.close(); @@ -59,7 +60,8 @@ public void readWrongCoordYConstraint() throws IOException, ZserioError public void readWrongCoordXConstraint() throws IOException, ZserioError { final Availability availability = Availability.Values.COORD_Y.or(Availability.Values.COORD_Z); - final BitBuffer bitBuffer = writeStructureBitmaskConstraintsToBitBuffer(availability, (short)1, (short)1, (short)1); + final BitBuffer bitBuffer = + writeStructureBitmaskConstraintsToBitBuffer(availability, (short)1, (short)1, (short)1); final BitStreamReader stream = new ByteArrayBitStreamReader(bitBuffer); assertThrows(ZserioError.class, () -> new StructureBitmaskConstraints(stream)); stream.close(); @@ -68,13 +70,12 @@ public void readWrongCoordXConstraint() throws IOException, ZserioError @Test public void writeReadCorrectStructureBitmaskConstraints() throws IOException, ZserioError { - final StructureBitmaskConstraints structureBitmaskConstraints = - new StructureBitmaskConstraints(Availability.Values.COORD_X.or(Availability.Values.COORD_Y), - (short)1, (short)1, (short)0); + final StructureBitmaskConstraints structureBitmaskConstraints = new StructureBitmaskConstraints( + Availability.Values.COORD_X.or(Availability.Values.COORD_Y), (short)1, (short)1, (short)0); final BitBuffer bitBuffer = SerializeUtil.serialize(structureBitmaskConstraints); - final StructureBitmaskConstraints readStructureBitmaskConstraints = SerializeUtil.deserialize( - StructureBitmaskConstraints.class, bitBuffer); + final StructureBitmaskConstraints readStructureBitmaskConstraints = + SerializeUtil.deserialize(StructureBitmaskConstraints.class, bitBuffer); assertEquals(1, readStructureBitmaskConstraints.getCoordX()); assertEquals(1, readStructureBitmaskConstraints.getCoordY()); assertEquals(0, readStructureBitmaskConstraints.getCoordZ()); @@ -84,9 +85,8 @@ public void writeReadCorrectStructureBitmaskConstraints() throws IOException, Zs @Test public void writeWrongCoordZConstraint() throws IOException, ZserioError { - final StructureBitmaskConstraints structureBitmaskConstraints = - new StructureBitmaskConstraints(Availability.Values.COORD_X.or(Availability.Values.COORD_Y), - (short)1, (short)1, (short)1); + final StructureBitmaskConstraints structureBitmaskConstraints = new StructureBitmaskConstraints( + Availability.Values.COORD_X.or(Availability.Values.COORD_Y), (short)1, (short)1, (short)1); final BitStreamWriter writer = new ByteArrayBitStreamWriter(); assertThrows(ZserioError.class, () -> structureBitmaskConstraints.write(writer)); writer.close(); @@ -95,9 +95,8 @@ public void writeWrongCoordZConstraint() throws IOException, ZserioError @Test public void writeWrongCoordYConstraint() throws IOException, ZserioError { - final StructureBitmaskConstraints structureBitmaskConstraints = - new StructureBitmaskConstraints(Availability.Values.COORD_X.or(Availability.Values.COORD_Z), - (short)1, (short)1, (short)1); + final StructureBitmaskConstraints structureBitmaskConstraints = new StructureBitmaskConstraints( + Availability.Values.COORD_X.or(Availability.Values.COORD_Z), (short)1, (short)1, (short)1); final BitStreamWriter writer = new ByteArrayBitStreamWriter(); assertThrows(ZserioError.class, () -> structureBitmaskConstraints.write(writer)); writer.close(); @@ -106,16 +105,15 @@ public void writeWrongCoordYConstraint() throws IOException, ZserioError @Test public void writeWrongCoordXConstraint() throws IOException, ZserioError { - final StructureBitmaskConstraints structureBitmaskConstraints = - new StructureBitmaskConstraints(Availability.Values.COORD_Y.or(Availability.Values.COORD_Z), - (short)1, (short)1, (short)1); + final StructureBitmaskConstraints structureBitmaskConstraints = new StructureBitmaskConstraints( + Availability.Values.COORD_Y.or(Availability.Values.COORD_Z), (short)1, (short)1, (short)1); final BitStreamWriter writer = new ByteArrayBitStreamWriter(); assertThrows(ZserioError.class, () -> structureBitmaskConstraints.write(writer)); writer.close(); } - private BitBuffer writeStructureBitmaskConstraintsToBitBuffer(Availability mask, - short x, short y, short z) throws IOException + private BitBuffer writeStructureBitmaskConstraintsToBitBuffer(Availability mask, short x, short y, short z) + throws IOException { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { diff --git a/test/language/constraints/java/constraints/StructureConstraintsTest.java b/test/language/constraints/java/constraints/StructureConstraintsTest.java index 457958dfe..f0973b447 100644 --- a/test/language/constraints/java/constraints/StructureConstraintsTest.java +++ b/test/language/constraints/java/constraints/StructureConstraintsTest.java @@ -1,13 +1,10 @@ package constraints; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import constraints.structure_constraints.BasicColor; -import constraints.structure_constraints.StructureConstraints; -import constraints.structure_constraints.ExtendedColor; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -17,13 +14,17 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import constraints.structure_constraints.BasicColor; +import constraints.structure_constraints.ExtendedColor; +import constraints.structure_constraints.StructureConstraints; + public class StructureConstraintsTest { @Test public void readConstructorCorrectConstraints() throws IOException, ZserioError { - final BitBuffer bitBuffer = writeStructureConstraintsToBitBuffer( - BasicColor.BLACK, BasicColor.WHITE, ExtendedColor.PURPLE); + final BitBuffer bitBuffer = + writeStructureConstraintsToBitBuffer(BasicColor.BLACK, BasicColor.WHITE, ExtendedColor.PURPLE); final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); final StructureConstraints structureConstraints = new StructureConstraints(reader); assertEquals(BasicColor.BLACK, structureConstraints.getBlackColor()); @@ -34,8 +35,8 @@ public void readConstructorCorrectConstraints() throws IOException, ZserioError @Test public void readConstructorWrongBlackConstraint() throws IOException, ZserioError { - final BitBuffer bitBuffer = writeStructureConstraintsToBitBuffer( - BasicColor.RED, BasicColor.WHITE, ExtendedColor.PURPLE); + final BitBuffer bitBuffer = + writeStructureConstraintsToBitBuffer(BasicColor.RED, BasicColor.WHITE, ExtendedColor.PURPLE); final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); assertThrows(ZserioError.class, () -> new StructureConstraints(reader)); } @@ -43,8 +44,8 @@ public void readConstructorWrongBlackConstraint() throws IOException, ZserioErro @Test public void readConstructorWrongWhiteConstraint() throws IOException, ZserioError { - final BitBuffer bitBuffer = writeStructureConstraintsToBitBuffer( - BasicColor.BLACK, BasicColor.RED, ExtendedColor.PURPLE); + final BitBuffer bitBuffer = + writeStructureConstraintsToBitBuffer(BasicColor.BLACK, BasicColor.RED, ExtendedColor.PURPLE); final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); assertThrows(ZserioError.class, () -> new StructureConstraints(reader)); } @@ -52,8 +53,8 @@ public void readConstructorWrongWhiteConstraint() throws IOException, ZserioErro @Test public void readConstructorWrongPurpleConstraint() throws IOException, ZserioError { - final BitBuffer bitBuffer = writeStructureConstraintsToBitBuffer( - BasicColor.BLACK, BasicColor.WHITE, ExtendedColor.LIME); + final BitBuffer bitBuffer = + writeStructureConstraintsToBitBuffer(BasicColor.BLACK, BasicColor.WHITE, ExtendedColor.LIME); final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); assertThrows(ZserioError.class, () -> new StructureConstraints(reader)); } @@ -64,8 +65,8 @@ public void writeReadCorrectStructureConstraints() throws IOException, ZserioErr final StructureConstraints structureConstraints = new StructureConstraints(BasicColor.BLACK, BasicColor.WHITE, true, ExtendedColor.PURPLE); final BitBuffer bitBuffer = SerializeUtil.serialize(structureConstraints); - final StructureConstraints readStructureConstraints = SerializeUtil.deserialize( - StructureConstraints.class, bitBuffer); + final StructureConstraints readStructureConstraints = + SerializeUtil.deserialize(StructureConstraints.class, bitBuffer); assertEquals(BasicColor.BLACK, readStructureConstraints.getBlackColor()); assertEquals(BasicColor.WHITE, readStructureConstraints.getWhiteColor()); assertEquals(ExtendedColor.PURPLE, readStructureConstraints.getPurpleColor()); @@ -99,8 +100,8 @@ public void writeWrongWhiteConstraint() throws IOException, ZserioError assertThrows(ZserioError.class, () -> structureConstraints.write(writer)); } - private BitBuffer writeStructureConstraintsToBitBuffer(BasicColor blackColor, BasicColor whiteColor, - ExtendedColor purpleColor) throws IOException + private BitBuffer writeStructureConstraintsToBitBuffer( + BasicColor blackColor, BasicColor whiteColor, ExtendedColor purpleColor) throws IOException { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { diff --git a/test/language/constraints/java/constraints/UnionConstraintsTest.java b/test/language/constraints/java/constraints/UnionConstraintsTest.java index 848956721..7b6e9e9c1 100644 --- a/test/language/constraints/java/constraints/UnionConstraintsTest.java +++ b/test/language/constraints/java/constraints/UnionConstraintsTest.java @@ -1,11 +1,10 @@ package constraints; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import constraints.union_constraints.UnionConstraints; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import constraints.union_constraints.UnionConstraints; + public class UnionConstraintsTest { @Test @@ -53,8 +54,8 @@ public void writeReadCorrectUnionConstraints() throws IOException, ZserioError final UnionConstraints unionConstraints = new UnionConstraints(); unionConstraints.setValue16(value16); final BitBuffer bitBuffer = SerializeUtil.serialize(unionConstraints); - final UnionConstraints readUnionConstraints = SerializeUtil.deserialize( - UnionConstraints.class, bitBuffer); + final UnionConstraints readUnionConstraints = + SerializeUtil.deserialize(UnionConstraints.class, bitBuffer); assertEquals(UnionConstraints.CHOICE_value16, readUnionConstraints.choiceTag()); assertEquals(value16, readUnionConstraints.getValue16()); assertTrue(unionConstraints.equals(readUnionConstraints)); diff --git a/test/language/default_values/build.xml b/test/language/default_values/build.xml index 5bb98df2f..384e1eb33 100644 --- a/test/language/default_values/build.xml +++ b/test/language/default_values/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/default_values/java/default_values/StructureDefaultValuesTest.java b/test/language/default_values/java/default_values/StructureDefaultValuesTest.java index c49b019d6..d78a6b6bc 100644 --- a/test/language/default_values/java/default_values/StructureDefaultValuesTest.java +++ b/test/language/default_values/java/default_values/StructureDefaultValuesTest.java @@ -1,11 +1,12 @@ package default_values; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import default_values.structure_default_values.StructureDefaultValues; import default_values.structure_default_values.BasicColor; import default_values.structure_default_values.Permission; +import default_values.structure_default_values.StructureDefaultValues; public class StructureDefaultValuesTest { diff --git a/test/language/enumeration_types/build.xml b/test/language/enumeration_types/build.xml index 04862e217..3a7668687 100644 --- a/test/language/enumeration_types/build.xml +++ b/test/language/enumeration_types/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/language/enumeration_types/java/enumeration_types/bitfield_const_enum/BitfieldConstEnumTest.java b/test/language/enumeration_types/java/enumeration_types/bitfield_const_enum/BitfieldConstEnumTest.java index 2df641478..e10a2307c 100644 --- a/test/language/enumeration_types/java/enumeration_types/bitfield_const_enum/BitfieldConstEnumTest.java +++ b/test/language/enumeration_types/java/enumeration_types/bitfield_const_enum/BitfieldConstEnumTest.java @@ -1,10 +1,11 @@ package enumeration_types.bitfield_const_enum; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -57,8 +58,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); color.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final byte readColor = (byte)reader.readBits(BITFIELD_CONST_ENUM_BITSIZEOF); assertEquals(readColor, color.getValue()); } diff --git a/test/language/enumeration_types/java/enumeration_types/bitfield_enum/BitfieldEnumTest.java b/test/language/enumeration_types/java/enumeration_types/bitfield_enum/BitfieldEnumTest.java index 5a3c1651e..f6cfb5dcc 100644 --- a/test/language/enumeration_types/java/enumeration_types/bitfield_enum/BitfieldEnumTest.java +++ b/test/language/enumeration_types/java/enumeration_types/bitfield_enum/BitfieldEnumTest.java @@ -1,10 +1,11 @@ package enumeration_types.bitfield_enum; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -58,8 +59,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); color.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final byte readColor = (byte)reader.readBits(BITFIELD_ENUM_BITSIZEOF); assertEquals(readColor, color.getValue()); } diff --git a/test/language/enumeration_types/java/enumeration_types/deprecated_enum_item/DeprecatedEnumItemTest.java b/test/language/enumeration_types/java/enumeration_types/deprecated_enum_item/DeprecatedEnumItemTest.java index 77e269b69..6d0631b2b 100644 --- a/test/language/enumeration_types/java/enumeration_types/deprecated_enum_item/DeprecatedEnumItemTest.java +++ b/test/language/enumeration_types/java/enumeration_types/deprecated_enum_item/DeprecatedEnumItemTest.java @@ -1,12 +1,13 @@ package enumeration_types.deprecated_enum_item; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; import java.util.List; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -68,8 +69,8 @@ public void writeRead() throws IOException Traffic.NONE.write(writer); Traffic.HEAVY.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(Traffic.NONE, Traffic.readEnum(reader)); assertEquals(Traffic.HEAVY, Traffic.readEnum(reader)); } diff --git a/test/language/enumeration_types/java/enumeration_types/enum_defined_by_constant/EnumDefinedByConstantTest.java b/test/language/enumeration_types/java/enumeration_types/enum_defined_by_constant/EnumDefinedByConstantTest.java index 800ff0dd1..5e8b719f3 100644 --- a/test/language/enumeration_types/java/enumeration_types/enum_defined_by_constant/EnumDefinedByConstantTest.java +++ b/test/language/enumeration_types/java/enumeration_types/enum_defined_by_constant/EnumDefinedByConstantTest.java @@ -1,6 +1,7 @@ package enumeration_types.enum_defined_by_constant; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; public class EnumDefinedByConstantTest diff --git a/test/language/enumeration_types/java/enumeration_types/enum_used_by_enum/EnumUsedByEnumTest.java b/test/language/enumeration_types/java/enumeration_types/enum_used_by_enum/EnumUsedByEnumTest.java index 41a8ee127..c334bc8bb 100644 --- a/test/language/enumeration_types/java/enumeration_types/enum_used_by_enum/EnumUsedByEnumTest.java +++ b/test/language/enumeration_types/java/enumeration_types/enum_used_by_enum/EnumUsedByEnumTest.java @@ -1,6 +1,7 @@ package enumeration_types.enum_used_by_enum; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; public class EnumUsedByEnumTest @@ -37,13 +38,13 @@ public void color() assertEquals(VALUE_DARK_PINK, Color.DARK_PINK.getValue()); } - private static byte VALUE_NONE = 0x00; - private static byte VALUE_LIGHT_RED = 0x01; - private static byte VALUE_LIGHT_GREEN = 0x02; - private static byte VALUE_LIGHT_BLUE = 0x03; - private static byte VALUE_LIGHT_PINK = 0x04; - private static byte VALUE_DARK_RED = 0x11; - private static byte VALUE_DARK_GREEN = 0x12; - private static byte VALUE_DARK_BLUE = 0x13; - private static byte VALUE_DARK_PINK = 0x14; + private static byte VALUE_NONE = 0x00; + private static byte VALUE_LIGHT_RED = 0x01; + private static byte VALUE_LIGHT_GREEN = 0x02; + private static byte VALUE_LIGHT_BLUE = 0x03; + private static byte VALUE_LIGHT_PINK = 0x04; + private static byte VALUE_DARK_RED = 0x11; + private static byte VALUE_DARK_GREEN = 0x12; + private static byte VALUE_DARK_BLUE = 0x13; + private static byte VALUE_DARK_PINK = 0x14; } diff --git a/test/language/enumeration_types/java/enumeration_types/multiple_removed_enum_items/MultipleRemovedEnumItemsTest.java b/test/language/enumeration_types/java/enumeration_types/multiple_removed_enum_items/MultipleRemovedEnumItemsTest.java index 9280216bc..b4ce901a0 100644 --- a/test/language/enumeration_types/java/enumeration_types/multiple_removed_enum_items/MultipleRemovedEnumItemsTest.java +++ b/test/language/enumeration_types/java/enumeration_types/multiple_removed_enum_items/MultipleRemovedEnumItemsTest.java @@ -1,19 +1,20 @@ package enumeration_types.multiple_removed_enum_items; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; import java.util.List; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; +import zserio.runtime.ZserioError; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.typeinfo.ItemInfo; import zserio.runtime.typeinfo.TypeInfo; -import zserio.runtime.ZserioError; public class MultipleRemovedEnumItemsTest { @@ -79,8 +80,8 @@ public void read() throws IOException writer.writeBits(LIGHT_VALUE, 8); writer.writeBits(MID_VALUE, 8); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(Traffic.NONE, Traffic.readEnum(reader)); assertEquals(Traffic.ZSERIO_REMOVED_HEAVY, Traffic.readEnum(reader)); assertEquals(Traffic.ZSERIO_REMOVED_LIGHT, Traffic.readEnum(reader)); @@ -93,8 +94,8 @@ public void write() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); assertDoesNotThrow(() -> Traffic.NONE.write(writer)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(Traffic.NONE, Traffic.readEnum(reader)); assertThrows(ZserioError.class, () -> Traffic.ZSERIO_REMOVED_HEAVY.write(writer)); diff --git a/test/language/enumeration_types/java/enumeration_types/removed_enum_item/RemovedEnumItemTest.java b/test/language/enumeration_types/java/enumeration_types/removed_enum_item/RemovedEnumItemTest.java index 891270b3a..13c98041a 100644 --- a/test/language/enumeration_types/java/enumeration_types/removed_enum_item/RemovedEnumItemTest.java +++ b/test/language/enumeration_types/java/enumeration_types/removed_enum_item/RemovedEnumItemTest.java @@ -1,19 +1,20 @@ package enumeration_types.removed_enum_item; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; import java.util.List; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; +import zserio.runtime.ZserioError; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.typeinfo.ItemInfo; import zserio.runtime.typeinfo.TypeInfo; -import zserio.runtime.ZserioError; public class RemovedEnumItemTest { @@ -61,8 +62,8 @@ public void read() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writer.writeBits(HEAVY_VALUE, 8); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Traffic traffic = Traffic.readEnum(reader); assertEquals(Traffic.ZSERIO_REMOVED_HEAVY, traffic); } @@ -75,16 +76,15 @@ public void write() throws IOException assertDoesNotThrow(() -> Traffic.LIGHT.write(writer)); assertDoesNotThrow(() -> Traffic.MID.write(writer)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(Traffic.NONE, Traffic.readEnum(reader)); assertEquals(Traffic.LIGHT, Traffic.readEnum(reader)); assertEquals(Traffic.MID, Traffic.readEnum(reader)); - final ZserioError thrown = assertThrows(ZserioError.class, - () -> Traffic.ZSERIO_REMOVED_HEAVY.write(writer)); - assertEquals("Trying to write removed enumeration item 'ZSERIO_REMOVED_HEAVY'!", - thrown.getMessage()); + final ZserioError thrown = + assertThrows(ZserioError.class, () -> Traffic.ZSERIO_REMOVED_HEAVY.write(writer)); + assertEquals("Trying to write removed enumeration item 'ZSERIO_REMOVED_HEAVY'!", thrown.getMessage()); } @Test diff --git a/test/language/enumeration_types/java/enumeration_types/uint64_enum/UInt64EnumTest.java b/test/language/enumeration_types/java/enumeration_types/uint64_enum/UInt64EnumTest.java index 1b4d206ae..daec23e26 100644 --- a/test/language/enumeration_types/java/enumeration_types/uint64_enum/UInt64EnumTest.java +++ b/test/language/enumeration_types/java/enumeration_types/uint64_enum/UInt64EnumTest.java @@ -1,11 +1,12 @@ package enumeration_types.uint64_enum; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -58,8 +59,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); darkColor.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final BigInteger readColor = reader.readBigInteger(UINT64_ENUM_BITSIZEOF); assertEquals(readColor, darkColor.getValue()); } diff --git a/test/language/enumeration_types/java/enumeration_types/uint8_enum/UInt8EnumTest.java b/test/language/enumeration_types/java/enumeration_types/uint8_enum/UInt8EnumTest.java index f239b51db..d4f8a0371 100644 --- a/test/language/enumeration_types/java/enumeration_types/uint8_enum/UInt8EnumTest.java +++ b/test/language/enumeration_types/java/enumeration_types/uint8_enum/UInt8EnumTest.java @@ -1,10 +1,11 @@ package enumeration_types.uint8_enum; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -57,8 +58,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); darkColor.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final short readColor = (short)reader.readBits(UINT8_ENUM_BITSIZEOF); assertEquals(readColor, darkColor.getValue()); } diff --git a/test/language/enumeration_types/java/enumeration_types/varuint_enum/VarUIntEnumTest.java b/test/language/enumeration_types/java/enumeration_types/varuint_enum/VarUIntEnumTest.java index 117043c00..c3f61b706 100644 --- a/test/language/enumeration_types/java/enumeration_types/varuint_enum/VarUIntEnumTest.java +++ b/test/language/enumeration_types/java/enumeration_types/varuint_enum/VarUIntEnumTest.java @@ -1,11 +1,12 @@ package enumeration_types.varuint_enum; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.HashCodeUtil; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -67,8 +68,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); darkColor.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final BigInteger readColor = reader.readVarUInt(); assertEquals(readColor, darkColor.getValue()); } diff --git a/test/language/explicit_parameters/build.xml b/test/language/explicit_parameters/build.xml index d0954c996..66e049d93 100644 --- a/test/language/explicit_parameters/build.xml +++ b/test/language/explicit_parameters/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/explicit_parameters/java/explicit_parameters/explicit_bitmask_param/ExplicitBitmaskParamTest.java b/test/language/explicit_parameters/java/explicit_parameters/explicit_bitmask_param/ExplicitBitmaskParamTest.java index 55d8fdce1..1fd86c4e8 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/explicit_bitmask_param/ExplicitBitmaskParamTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/explicit_bitmask_param/ExplicitBitmaskParamTest.java @@ -1,10 +1,6 @@ package explicit_parameters.explicit_bitmask_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ExplicitBitmaskParamTest { @BeforeAll @@ -152,8 +152,8 @@ private static BitmaskParamTableRow createBitmaskParamTableRow(long id, String n return row; } - private static void checkBitmaskParamTableRows(List rows1, - List rows2) + private static void checkBitmaskParamTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/java/explicit_parameters/explicit_blob_param/ExplicitBlobParamTest.java b/test/language/explicit_parameters/java/explicit_parameters/explicit_blob_param/ExplicitBlobParamTest.java index 317866339..3f8c2c72a 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/explicit_blob_param/ExplicitBlobParamTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/explicit_blob_param/ExplicitBlobParamTest.java @@ -1,10 +1,6 @@ package explicit_parameters.explicit_blob_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ExplicitBlobParamTest { @BeforeAll diff --git a/test/language/explicit_parameters/java/explicit_parameters/explicit_enum_param/ExplicitEnumParamTest.java b/test/language/explicit_parameters/java/explicit_parameters/explicit_enum_param/ExplicitEnumParamTest.java index acd5d13e9..1eef4b9c5 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/explicit_enum_param/ExplicitEnumParamTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/explicit_enum_param/ExplicitEnumParamTest.java @@ -1,10 +1,6 @@ package explicit_parameters.explicit_enum_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ExplicitEnumParamTest { @BeforeAll diff --git a/test/language/explicit_parameters/java/explicit_parameters/explicit_same_as_field/ExplicitSameAsFieldTest.java b/test/language/explicit_parameters/java/explicit_parameters/explicit_same_as_field/ExplicitSameAsFieldTest.java index f4027b246..e1a795d91 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/explicit_same_as_field/ExplicitSameAsFieldTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/explicit_same_as_field/ExplicitSameAsFieldTest.java @@ -1,10 +1,6 @@ package explicit_parameters.explicit_same_as_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ExplicitSameAsFieldTest { @BeforeAll @@ -55,8 +55,7 @@ public void readWithoutCondition() throws SQLException, IOException, ZserioError fillSameAsFieldTableRows(writtenRows); sameAsFieldTable.write(writtenRows); - final SameAsFieldTableParameterProvider parameterProvider = - new SameAsFieldTableParameterProvider(); + final SameAsFieldTableParameterProvider parameterProvider = new SameAsFieldTableParameterProvider(); final List readRows = sameAsFieldTable.read(parameterProvider); checkSameAsFieldTableRows(writtenRows, readRows); } @@ -70,11 +69,9 @@ public void readWithCondition() throws SQLException, IOException, ZserioError fillSameAsFieldTableRows(writtenRows); sameAsFieldTable.write(writtenRows); - final SameAsFieldTableParameterProvider parameterProvider = - new SameAsFieldTableParameterProvider(); + final SameAsFieldTableParameterProvider parameterProvider = new SameAsFieldTableParameterProvider(); final String condition = "name='Name1'"; - final List readRows = - sameAsFieldTable.read(parameterProvider, condition); + final List readRows = sameAsFieldTable.read(parameterProvider, condition); assertEquals(1, readRows.size()); final int expectedRowNum = 1; @@ -92,23 +89,19 @@ public void update() throws SQLException, IOException, ZserioError sameAsFieldTable.write(writtenRows); final int updateRowId = 3; - final SameAsFieldTableRow updateRow = - createSameAsFieldTableRow(updateRowId, "UpdatedName"); + final SameAsFieldTableRow updateRow = createSameAsFieldTableRow(updateRowId, "UpdatedName"); final String updateCondition = "id=" + updateRowId; sameAsFieldTable.update(updateRow, updateCondition); - final SameAsFieldTableParameterProvider parameterProvider = - new SameAsFieldTableParameterProvider(); - final List readRows = - sameAsFieldTable.read(parameterProvider, updateCondition); + final SameAsFieldTableParameterProvider parameterProvider = new SameAsFieldTableParameterProvider(); + final List readRows = sameAsFieldTable.read(parameterProvider, updateCondition); assertEquals(1, readRows.size()); final SameAsFieldTableRow readRow = readRows.get(0); checkSameAsFieldTableRow(updateRow, readRow); } - private static class SameAsFieldTableParameterProvider - implements SameAsFieldTable.ParameterProvider + private static class SameAsFieldTableParameterProvider implements SameAsFieldTable.ParameterProvider { @Override public long getCount(ResultSet resultSet) @@ -148,16 +141,15 @@ private static SameAsFieldTableRow createSameAsFieldTableRow(long id, String nam return row; } - private static void checkSameAsFieldTableRows(List rows1, - List rows2) + private static void checkSameAsFieldTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) checkSameAsFieldTableRow(rows1.get(i), rows2.get(i)); } - private static void checkSameAsFieldTableRow(SameAsFieldTableRow row1, - SameAsFieldTableRow row2) + private static void checkSameAsFieldTableRow(SameAsFieldTableRow row1, SameAsFieldTableRow row2) { assertEquals(row1.getId(), row2.getId()); assertEquals(row1.getName(), row2.getName()); diff --git a/test/language/explicit_parameters/java/explicit_parameters/explicit_simple_param/ExplicitSimpleParamTest.java b/test/language/explicit_parameters/java/explicit_parameters/explicit_simple_param/ExplicitSimpleParamTest.java index 08d6c231a..c5fab6a0c 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/explicit_simple_param/ExplicitSimpleParamTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/explicit_simple_param/ExplicitSimpleParamTest.java @@ -1,10 +1,6 @@ package explicit_parameters.explicit_simple_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ExplicitSimpleParamTest { @BeforeAll @@ -152,8 +152,8 @@ private static SimpleParamTableRow createSimpleParamTableRow(long id, String nam return row; } - private static void checkSimpleParamTableRows(List rows1, - List rows2) + private static void checkSimpleParamTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/java/explicit_parameters/multiple_explicit_params/MultipleExplicitParamsTest.java b/test/language/explicit_parameters/java/explicit_parameters/multiple_explicit_params/MultipleExplicitParamsTest.java index eb3dc3379..ba7722b85 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/multiple_explicit_params/MultipleExplicitParamsTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/multiple_explicit_params/MultipleExplicitParamsTest.java @@ -1,10 +1,6 @@ package explicit_parameters.multiple_explicit_params; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class MultipleExplicitParamsTest { @BeforeAll @@ -179,8 +179,8 @@ private static MultipleParamsTableRow createMultipleParamsTableRow(long id, Stri return row; } - private static void checkMultipleParamsTableRows(List rows1, - List rows2) + private static void checkMultipleParamsTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) diff --git a/test/language/explicit_parameters/java/explicit_parameters/multiple_with_same_name/MultipleWithSameNameTest.java b/test/language/explicit_parameters/java/explicit_parameters/multiple_with_same_name/MultipleWithSameNameTest.java index 8b046633b..325e85db8 100644 --- a/test/language/explicit_parameters/java/explicit_parameters/multiple_with_same_name/MultipleWithSameNameTest.java +++ b/test/language/explicit_parameters/java/explicit_parameters/multiple_with_same_name/MultipleWithSameNameTest.java @@ -1,10 +1,6 @@ package explicit_parameters.multiple_with_same_name; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,13 +9,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import explicit_parameters.ExplicitParametersDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import explicit_parameters.ExplicitParametersDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class MultipleWithSameNameTest { @BeforeAll @@ -70,8 +70,8 @@ public void readWithCondition() throws SQLException, IOException, ZserioError fillMultipleWithSameNameTableRows(writtenRows); multipleWithSameNameTable.write(writtenRows); - final MultipleWithSameNameTableParameterProvider parameterProvider = new - MultipleWithSameNameTableParameterProvider(); + final MultipleWithSameNameTableParameterProvider parameterProvider = + new MultipleWithSameNameTableParameterProvider(); final String condition = "name='Name1'"; final List readRows = multipleWithSameNameTable.read(parameterProvider, condition); @@ -147,16 +147,16 @@ private static MultipleWithSameNameTableRow createMultipleWithSameNameTableRow(l return row; } - private static void checkMultipleParamsTableRows(List rows1, - List rows2) + private static void checkMultipleParamsTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) checkMultipleParamsTableRow(rows1.get(i), rows2.get(i)); } - private static void checkMultipleParamsTableRow(MultipleWithSameNameTableRow row1, - MultipleWithSameNameTableRow row2) + private static void checkMultipleParamsTableRow( + MultipleWithSameNameTableRow row1, MultipleWithSameNameTableRow row2) { assertEquals(row1.getId(), row2.getId()); assertEquals(row1.getName(), row2.getName()); diff --git a/test/language/expressions/build.xml b/test/language/expressions/build.xml index 4662dede9..f8361b169 100644 --- a/test/language/expressions/build.xml +++ b/test/language/expressions/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/expressions/java/expressions/ArrayTypeTest.java b/test/language/expressions/java/expressions/ArrayTypeTest.java index 7375b1f89..05ee6e771 100644 --- a/test/language/expressions/java/expressions/ArrayTypeTest.java +++ b/test/language/expressions/java/expressions/ArrayTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.array_type.ArrayTypeExpression; @@ -10,7 +11,7 @@ public class ArrayTypeTest @Test public void bitSizeOfWithOptional() { - final byte[] array = new byte[] { 0, 0 }; + final byte[] array = new byte[] {0, 0}; final ArrayTypeExpression arrayTypeExpression = new ArrayTypeExpression(array, true); assertEquals(ARRAY_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL, arrayTypeExpression.bitSizeOf()); @@ -20,7 +21,7 @@ public void bitSizeOfWithOptional() public void bitSizeOfWithoutOptional() { final ArrayTypeExpression arrayTypeExpression = new ArrayTypeExpression(); - final byte[] array = new byte[] { 1, 1 }; + final byte[] array = new byte[] {1, 1}; arrayTypeExpression.setArray(array); assertEquals(ARRAY_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, arrayTypeExpression.bitSizeOf()); diff --git a/test/language/expressions/java/expressions/BitmaskTypeTest.java b/test/language/expressions/java/expressions/BitmaskTypeTest.java index 8183c9db2..69651fe1f 100644 --- a/test/language/expressions/java/expressions/BitmaskTypeTest.java +++ b/test/language/expressions/java/expressions/BitmaskTypeTest.java @@ -1,10 +1,11 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import expressions.bitmask_type.Colors; import expressions.bitmask_type.BitmaskTypeExpression; +import expressions.bitmask_type.Colors; public class BitmaskTypeTest { diff --git a/test/language/expressions/java/expressions/CastUInt64ToUInt8Test.java b/test/language/expressions/java/expressions/CastUInt64ToUInt8Test.java index 15f354d81..032ea9bcd 100644 --- a/test/language/expressions/java/expressions/CastUInt64ToUInt8Test.java +++ b/test/language/expressions/java/expressions/CastUInt64ToUInt8Test.java @@ -1,10 +1,11 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import expressions.cast_uint64_to_uint8.CastUInt64ToUInt8Expression; public class CastUInt64ToUInt8Test diff --git a/test/language/expressions/java/expressions/CastUInt8ToUInt64Test.java b/test/language/expressions/java/expressions/CastUInt8ToUInt64Test.java index d42632636..00ecf5eeb 100644 --- a/test/language/expressions/java/expressions/CastUInt8ToUInt64Test.java +++ b/test/language/expressions/java/expressions/CastUInt8ToUInt64Test.java @@ -1,10 +1,11 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import expressions.cast_uint8_to_uint64.CastUInt8ToUInt64Expression; public class CastUInt8ToUInt64Test diff --git a/test/language/expressions/java/expressions/ConstTypeTest.java b/test/language/expressions/java/expressions/ConstTypeTest.java index 9cacf7505..37fe728b3 100644 --- a/test/language/expressions/java/expressions/ConstTypeTest.java +++ b/test/language/expressions/java/expressions/ConstTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.const_type.ConstTypeExpression; diff --git a/test/language/expressions/java/expressions/EnumerationTypeTest.java b/test/language/expressions/java/expressions/EnumerationTypeTest.java index 3cb78c788..2a0f1715b 100644 --- a/test/language/expressions/java/expressions/EnumerationTypeTest.java +++ b/test/language/expressions/java/expressions/EnumerationTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.enumeration_type.Color; @@ -23,8 +24,8 @@ public void bitSizeOfWithoutOptional() final EnumerationTypeExpression enumerationTypeExpression = new EnumerationTypeExpression(); enumerationTypeExpression.setColor(Color.BLUE); - assertEquals(ENUMERATION_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, - enumerationTypeExpression.bitSizeOf()); + assertEquals( + ENUMERATION_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, enumerationTypeExpression.bitSizeOf()); } private static final int ENUMERATION_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL = 9; diff --git a/test/language/expressions/java/expressions/FieldTypeTest.java b/test/language/expressions/java/expressions/FieldTypeTest.java index b9e16f6c2..20ff3289f 100644 --- a/test/language/expressions/java/expressions/FieldTypeTest.java +++ b/test/language/expressions/java/expressions/FieldTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.field_type.ContainedType; diff --git a/test/language/expressions/java/expressions/FieldTypeWithClashTest.java b/test/language/expressions/java/expressions/FieldTypeWithClashTest.java index 5c6fa2616..5eee89427 100644 --- a/test/language/expressions/java/expressions/FieldTypeWithClashTest.java +++ b/test/language/expressions/java/expressions/FieldTypeWithClashTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.field_type_with_clash.ContainedType; diff --git a/test/language/expressions/java/expressions/FloatTypeTest.java b/test/language/expressions/java/expressions/FloatTypeTest.java index 3298b4b5b..ddf2285aa 100644 --- a/test/language/expressions/java/expressions/FloatTypeTest.java +++ b/test/language/expressions/java/expressions/FloatTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.float_type.FloatTypeExpression; diff --git a/test/language/expressions/java/expressions/FullConstTypeTest.java b/test/language/expressions/java/expressions/FullConstTypeTest.java index 15ac1ba6d..f49850666 100644 --- a/test/language/expressions/java/expressions/FullConstTypeTest.java +++ b/test/language/expressions/java/expressions/FullConstTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.full_const_type.FullConstTypeExpression; @@ -10,8 +11,8 @@ public class FullConstTypeTest @Test public void bitSizeOfWithOptional() { - final FullConstTypeExpression fullConstTypeExpression = new FullConstTypeExpression(FULL_VALID_VALUE, - FULL_ADDITIONAL_VALUE); + final FullConstTypeExpression fullConstTypeExpression = + new FullConstTypeExpression(FULL_VALID_VALUE, FULL_ADDITIONAL_VALUE); assertEquals(FULL_CONST_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL, fullConstTypeExpression.bitSizeOf()); } diff --git a/test/language/expressions/java/expressions/FullEnumerationTypeTest.java b/test/language/expressions/java/expressions/FullEnumerationTypeTest.java index 58ce27b36..d15c725e4 100644 --- a/test/language/expressions/java/expressions/FullEnumerationTypeTest.java +++ b/test/language/expressions/java/expressions/FullEnumerationTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.full_enumeration_type.Color; diff --git a/test/language/expressions/java/expressions/FunctionTypeTest.java b/test/language/expressions/java/expressions/FunctionTypeTest.java index 4d8ff80e4..80d927ff0 100644 --- a/test/language/expressions/java/expressions/FunctionTypeTest.java +++ b/test/language/expressions/java/expressions/FunctionTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.function_type.Color; @@ -22,8 +23,7 @@ public void bitSizeOfWithoutOptional() final FunctionTypeExpression functionTypeExpression = new FunctionTypeExpression(); functionTypeExpression.setColor(Color.BLUE); - assertEquals(FUNCTION_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, - functionTypeExpression.bitSizeOf()); + assertEquals(FUNCTION_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, functionTypeExpression.bitSizeOf()); } private static final int FUNCTION_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL = 9; diff --git a/test/language/expressions/java/expressions/IndexOperatorTest.java b/test/language/expressions/java/expressions/IndexOperatorTest.java index 2aa798ff0..48507c6f8 100644 --- a/test/language/expressions/java/expressions/IndexOperatorTest.java +++ b/test/language/expressions/java/expressions/IndexOperatorTest.java @@ -1,13 +1,14 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import zserio.runtime.io.ByteArrayBitStreamWriter; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; +import zserio.runtime.io.ByteArrayBitStreamWriter; import expressions.index_operator.*; @@ -86,8 +87,8 @@ private static ElementList readWrite(ElementList list) throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); list.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final ElementList newList = new ElementList(reader); return newList; @@ -104,7 +105,7 @@ private static void checkElements(ElementList list, int length) } } - private static final int ELEMENTS[] = { 11, 33, 55, 77 }; + private static final int ELEMENTS[] = {11, 33, 55, 77}; private static final int LENGTH_SIZE = 16; private static final int FIELD8_SIZE = 8; private static final int FIELD16_SIZE = 16; diff --git a/test/language/expressions/java/expressions/IsSetOperatorTest.java b/test/language/expressions/java/expressions/IsSetOperatorTest.java index f169f5a25..920071866 100644 --- a/test/language/expressions/java/expressions/IsSetOperatorTest.java +++ b/test/language/expressions/java/expressions/IsSetOperatorTest.java @@ -1,11 +1,12 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import expressions.isset_operator.TestBitmask; -import expressions.isset_operator.Parameterized; import expressions.isset_operator.IsSetOperator; +import expressions.isset_operator.Parameterized; +import expressions.isset_operator.TestBitmask; public class IsSetOperatorTest { diff --git a/test/language/expressions/java/expressions/LengthOfOperatorTest.java b/test/language/expressions/java/expressions/LengthOfOperatorTest.java index cc6348c49..a9bf37388 100644 --- a/test/language/expressions/java/expressions/LengthOfOperatorTest.java +++ b/test/language/expressions/java/expressions/LengthOfOperatorTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.lengthof_operator.LengthOfFunctions; diff --git a/test/language/expressions/java/expressions/ModuloOperatorTest.java b/test/language/expressions/java/expressions/ModuloOperatorTest.java index 7b5d7b3a3..cf2dc1030 100644 --- a/test/language/expressions/java/expressions/ModuloOperatorTest.java +++ b/test/language/expressions/java/expressions/ModuloOperatorTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.modulo_operator.ModuloFunction; diff --git a/test/language/expressions/java/expressions/NegationOperatorTest.java b/test/language/expressions/java/expressions/NegationOperatorTest.java index b719db234..85d96228f 100644 --- a/test/language/expressions/java/expressions/NegationOperatorTest.java +++ b/test/language/expressions/java/expressions/NegationOperatorTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.negation_operator.NegationOperatorExpression; diff --git a/test/language/expressions/java/expressions/NumBitsOperatorTest.java b/test/language/expressions/java/expressions/NumBitsOperatorTest.java index 4166fcdb5..65463f0e8 100644 --- a/test/language/expressions/java/expressions/NumBitsOperatorTest.java +++ b/test/language/expressions/java/expressions/NumBitsOperatorTest.java @@ -1,11 +1,12 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.lang.Math; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import expressions.numbits_operator.NumBitsFunctions; public class NumBitsOperatorTest diff --git a/test/language/expressions/java/expressions/ParameterTypeTest.java b/test/language/expressions/java/expressions/ParameterTypeTest.java index 8b6d311b6..61e43f51b 100644 --- a/test/language/expressions/java/expressions/ParameterTypeTest.java +++ b/test/language/expressions/java/expressions/ParameterTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.parameter_type.Color; @@ -11,8 +12,8 @@ public class ParameterTypeTest @Test public void bitSizeOfWithOptional() { - final ParameterTypeExpression parameterTypeExpression = new ParameterTypeExpression(Color.RED, - PARAMETER_TYPE_EXPRESSION_VALUE, true); + final ParameterTypeExpression parameterTypeExpression = + new ParameterTypeExpression(Color.RED, PARAMETER_TYPE_EXPRESSION_VALUE, true); assertEquals(PARAMETER_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL, parameterTypeExpression.bitSizeOf()); } @@ -23,8 +24,7 @@ public void bitSizeOfWithoutOptional() final ParameterTypeExpression parameterTypeExpression = new ParameterTypeExpression(Color.BLUE); parameterTypeExpression.setValue(PARAMETER_TYPE_EXPRESSION_VALUE); - assertEquals(PARAMETER_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, - parameterTypeExpression.bitSizeOf()); + assertEquals(PARAMETER_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, parameterTypeExpression.bitSizeOf()); } private static final byte PARAMETER_TYPE_EXPRESSION_VALUE = (byte)0x3F; diff --git a/test/language/expressions/java/expressions/ParameterizedArrayTypeTest.java b/test/language/expressions/java/expressions/ParameterizedArrayTypeTest.java index 48f06d9b3..76f92bac7 100644 --- a/test/language/expressions/java/expressions/ParameterizedArrayTypeTest.java +++ b/test/language/expressions/java/expressions/ParameterizedArrayTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.parameterized_array_type.ParameterizedArrayElement; @@ -13,9 +14,7 @@ public class ParameterizedArrayTypeTest public void bitSizeOfWithOptional() { final ParameterizedArrayElement[] array = new ParameterizedArrayElement[] { - new ParameterizedArrayElement(false, 0, null), - new ParameterizedArrayElement(false, 0, null) - }; + new ParameterizedArrayElement(false, 0, null), new ParameterizedArrayElement(false, 0, null)}; final ParameterizedArrayHolder parameterizedArrayHolder = new ParameterizedArrayHolder(false, array); final ParameterizedArrayTypeExpression parameterizedArrayTypeExpression = new ParameterizedArrayTypeExpression(parameterizedArrayHolder, true); @@ -28,9 +27,7 @@ public void bitSizeOfWithOptional() public void bitSizeOfWithoutOptional() { final ParameterizedArrayElement[] array = new ParameterizedArrayElement[] { - new ParameterizedArrayElement(false, 1, null), - new ParameterizedArrayElement(false, 1, null) - }; + new ParameterizedArrayElement(false, 1, null), new ParameterizedArrayElement(false, 1, null)}; final ParameterizedArrayHolder parameterizedArrayHolder = new ParameterizedArrayHolder(false, array); final ParameterizedArrayTypeExpression parameterizedArrayTypeExpression = new ParameterizedArrayTypeExpression(parameterizedArrayHolder, false); diff --git a/test/language/expressions/java/expressions/ParenthesisTest.java b/test/language/expressions/java/expressions/ParenthesisTest.java index d9df13d6d..afcd70e45 100644 --- a/test/language/expressions/java/expressions/ParenthesisTest.java +++ b/test/language/expressions/java/expressions/ParenthesisTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.parenthesis.ParenthesisExpression; @@ -10,8 +11,8 @@ public class ParenthesisTest @Test public void result() { - final ParenthesisExpression parenthesisExpression = new ParenthesisExpression(FIRST_VALUE, - SECOND_VALUE); + final ParenthesisExpression parenthesisExpression = + new ParenthesisExpression(FIRST_VALUE, SECOND_VALUE); assertEquals(FIRST_VALUE * (SECOND_VALUE + 1), parenthesisExpression.funcResult()); } diff --git a/test/language/expressions/java/expressions/QuestionMarkTest.java b/test/language/expressions/java/expressions/QuestionMarkTest.java index 5a12008b8..873d6a095 100644 --- a/test/language/expressions/java/expressions/QuestionMarkTest.java +++ b/test/language/expressions/java/expressions/QuestionMarkTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.question_mark.QuestionMarkExpression; @@ -10,8 +11,8 @@ public class QuestionMarkTest @Test public void firstValue() { - final QuestionMarkExpression questionMarkExpression = new QuestionMarkExpression(FIRST_VALUE, - SECOND_VALUE, true); + final QuestionMarkExpression questionMarkExpression = + new QuestionMarkExpression(FIRST_VALUE, SECOND_VALUE, true); assertEquals(FIRST_VALUE, questionMarkExpression.funcValidValue()); } @@ -19,8 +20,8 @@ public void firstValue() @Test public void secondValue() { - final QuestionMarkExpression questionMarkExpression = new QuestionMarkExpression(FIRST_VALUE, - SECOND_VALUE, false); + final QuestionMarkExpression questionMarkExpression = + new QuestionMarkExpression(FIRST_VALUE, SECOND_VALUE, false); assertEquals(SECOND_VALUE, questionMarkExpression.funcValidValue()); } diff --git a/test/language/expressions/java/expressions/StringTypeTest.java b/test/language/expressions/java/expressions/StringTypeTest.java index a17fd2858..82c24976d 100644 --- a/test/language/expressions/java/expressions/StringTypeTest.java +++ b/test/language/expressions/java/expressions/StringTypeTest.java @@ -1,11 +1,12 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import expressions.string_type.StringTypeExpression; -import expressions.string_type.STRING_CONSTANT; import expressions.string_type.CHOOSER; +import expressions.string_type.STRING_CONSTANT; +import expressions.string_type.StringTypeExpression; public class StringTypeTest { @@ -20,8 +21,9 @@ public void returnValue() public void returnDefaultValue() { final StringTypeExpression stringTypeExpression = createStringTypeExpression(true); - assertEquals(CHOOSER.CHOOSER ? STRING_CONSTANT.STRING_CONSTANT : - FALSE + SPACE + STRING_CONSTANT.STRING_CONSTANT, stringTypeExpression.funcReturnDefaultValue()); + assertEquals(CHOOSER.CHOOSER ? STRING_CONSTANT.STRING_CONSTANT + : FALSE + SPACE + STRING_CONSTANT.STRING_CONSTANT, + stringTypeExpression.funcReturnDefaultValue()); } @Test diff --git a/test/language/expressions/java/expressions/UInt64TypeTest.java b/test/language/expressions/java/expressions/UInt64TypeTest.java index b8b623367..1e7a5ed7a 100644 --- a/test/language/expressions/java/expressions/UInt64TypeTest.java +++ b/test/language/expressions/java/expressions/UInt64TypeTest.java @@ -1,10 +1,11 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import expressions.uint64_type.UInt64TypeExpression; public class UInt64TypeTest @@ -12,8 +13,8 @@ public class UInt64TypeTest @Test public void bitSizeOfWithOptional() { - final UInt64TypeExpression uint64TypeExpression = new UInt64TypeExpression(UINT32_VALUE, - UINT64_VALUE_WITH_OPTIONAL, BOOLEAN_VALUE, ADDITIONAL_VALUE); + final UInt64TypeExpression uint64TypeExpression = new UInt64TypeExpression( + UINT32_VALUE, UINT64_VALUE_WITH_OPTIONAL, BOOLEAN_VALUE, ADDITIONAL_VALUE); assertEquals(UINT64_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL, uint64TypeExpression.bitSizeOf()); } @@ -21,8 +22,8 @@ public void bitSizeOfWithOptional() @Test public void bitSizeOfWithoutOptional() { - final UInt64TypeExpression uint64TypeExpression = new UInt64TypeExpression(UINT32_VALUE, - UINT64_VALUE_WITHOUT_OPTIONAL, BOOLEAN_VALUE, null); + final UInt64TypeExpression uint64TypeExpression = + new UInt64TypeExpression(UINT32_VALUE, UINT64_VALUE_WITHOUT_OPTIONAL, BOOLEAN_VALUE, null); assertEquals(UINT64_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, uint64TypeExpression.bitSizeOf()); } diff --git a/test/language/expressions/java/expressions/UsedBeforeTypeTest.java b/test/language/expressions/java/expressions/UsedBeforeTypeTest.java index 67fbb1c6b..4feae767b 100644 --- a/test/language/expressions/java/expressions/UsedBeforeTypeTest.java +++ b/test/language/expressions/java/expressions/UsedBeforeTypeTest.java @@ -1,6 +1,7 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import expressions.used_before_type.Color; @@ -22,8 +23,8 @@ public void bitSizeOfWithoutOptional() final UsedBeforeTypeExpression usedBeforeTypeExpression = new UsedBeforeTypeExpression(); usedBeforeTypeExpression.setColor(Color.BLUE); - assertEquals(USED_BEFORE_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, - usedBeforeTypeExpression.bitSizeOf()); + assertEquals( + USED_BEFORE_TYPE_EXPRESSION_BIT_SIZE_WITHOUT_OPTIONAL, usedBeforeTypeExpression.bitSizeOf()); } private static final int USED_BEFORE_TYPE_EXPRESSION_BIT_SIZE_WITH_OPTIONAL = 8; diff --git a/test/language/expressions/java/expressions/ValueOfOperatorTest.java b/test/language/expressions/java/expressions/ValueOfOperatorTest.java index 34cb7c92f..f6a08dfbe 100644 --- a/test/language/expressions/java/expressions/ValueOfOperatorTest.java +++ b/test/language/expressions/java/expressions/ValueOfOperatorTest.java @@ -1,10 +1,11 @@ package expressions; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import expressions.valueof_operator.ValueOfFunctions; import expressions.valueof_operator.Color; +import expressions.valueof_operator.ValueOfFunctions; public class ValueOfOperatorTest { diff --git a/test/language/extended_members/build.xml b/test/language/extended_members/build.xml index 963593942..56619c684 100644 --- a/test/language/extended_members/build.xml +++ b/test/language/extended_members/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/extended_members/java/extended_members/extended_choice_field/ExtendedChoiceFieldTest.java b/test/language/extended_members/java/extended_members/extended_choice_field/ExtendedChoiceFieldTest.java index 6e2a465db..9b76bb1d3 100644 --- a/test/language/extended_members/java/extended_members/extended_choice_field/ExtendedChoiceFieldTest.java +++ b/test/language/extended_members/java/extended_members/extended_choice_field/ExtendedChoiceFieldTest.java @@ -1,11 +1,12 @@ package extended_members.extended_choice_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -234,7 +235,7 @@ public void writeExtendedValuesReadOriginal() throws IOException assertEquals(ORIGINAL_BIT_SIZE, reader.getBitPosition()); } - private static final long VALUES[] = new long[]{ 0, 1, 2, 3, 4 }; + private static final long VALUES[] = new long[] {0, 1, 2, 3, 4}; private static final long ORIGINAL_BIT_SIZE = 4 * 8; private static final long EXTENDED_BIT_SIZE_EMPTY = ORIGINAL_BIT_SIZE; diff --git a/test/language/extended_members/java/extended_members/extended_compound_field/ExtendedCompoundFieldTest.java b/test/language/extended_members/java/extended_members/extended_compound_field/ExtendedCompoundFieldTest.java index 0e427b1a3..c5c490f19 100644 --- a/test/language/extended_members/java/extended_members/extended_compound_field/ExtendedCompoundFieldTest.java +++ b/test/language/extended_members/java/extended_members/extended_compound_field/ExtendedCompoundFieldTest.java @@ -1,11 +1,12 @@ package extended_members.extended_compound_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.io.BitBuffer; @@ -152,12 +153,11 @@ public void writeExtendedReadOriginal() throws IOException assertEquals(ORIGINAL_BIT_SIZE, reader.getBitPosition()); } - private static final long COMPOUND_ARRAY[] = new long[]{ 0, 1, 2, 3, 4 }; + private static final long COMPOUND_ARRAY[] = new long[] {0, 1, 2, 3, 4}; private static final long ORIGINAL_BIT_SIZE = 4 * 8; - private static final long EXTENDED_BIT_SIZE_DEFAULT = ORIGINAL_BIT_SIZE + - BitSizeOfCalculator.getBitSizeOfVarSize(0); + private static final long EXTENDED_BIT_SIZE_DEFAULT = + ORIGINAL_BIT_SIZE + BitSizeOfCalculator.getBitSizeOfVarSize(0); private static final long EXTENDED_BIT_SIZE_WITH_ARRAY = ORIGINAL_BIT_SIZE + - BitSizeOfCalculator.getBitSizeOfVarSize(COMPOUND_ARRAY.length) + - COMPOUND_ARRAY.length * 4L * 8L; + BitSizeOfCalculator.getBitSizeOfVarSize(COMPOUND_ARRAY.length) + COMPOUND_ARRAY.length * 4L * 8L; } diff --git a/test/language/extended_members/java/extended_members/extended_empty_structure/ExtendedEmptyStructureTest.java b/test/language/extended_members/java/extended_members/extended_empty_structure/ExtendedEmptyStructureTest.java index 7547d30da..9c6766041 100644 --- a/test/language/extended_members/java/extended_members/extended_empty_structure/ExtendedEmptyStructureTest.java +++ b/test/language/extended_members/java/extended_members/extended_empty_structure/ExtendedEmptyStructureTest.java @@ -1,11 +1,12 @@ package extended_members.extended_empty_structure; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; diff --git a/test/language/extended_members/java/extended_members/extended_field_in_template/ExtendedFieldInTemplateTest.java b/test/language/extended_members/java/extended_members/extended_field_in_template/ExtendedFieldInTemplateTest.java index de2b37ea8..a2f9c5ddd 100644 --- a/test/language/extended_members/java/extended_members/extended_field_in_template/ExtendedFieldInTemplateTest.java +++ b/test/language/extended_members/java/extended_members/extended_field_in_template/ExtendedFieldInTemplateTest.java @@ -1,11 +1,12 @@ package extended_members.extended_field_in_template; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; diff --git a/test/language/extended_members/java/extended_members/extended_indexed_offsets/ExtendedIndexedOffsetsTest.java b/test/language/extended_members/java/extended_members/extended_indexed_offsets/ExtendedIndexedOffsetsTest.java index d7e495f3f..089e7683c 100644 --- a/test/language/extended_members/java/extended_members/extended_indexed_offsets/ExtendedIndexedOffsetsTest.java +++ b/test/language/extended_members/java/extended_members/extended_indexed_offsets/ExtendedIndexedOffsetsTest.java @@ -1,11 +1,12 @@ package extended_members.extended_indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.io.BitBuffer; @@ -152,14 +153,13 @@ public void writeExtendedReadOriginal() throws IOException assertEquals(ORIGINAL_BIT_SIZE, reader.getBitPosition()); } - private static final long[] OFFSETS = new long[] { 0, 0, 0, 0, 0 }; - private static final String[] ARRAY = new String[] { "extended", "indexed", "offsets", "test", "!" }; + private static final long[] OFFSETS = new long[] {0, 0, 0, 0, 0}; + private static final String[] ARRAY = new String[] {"extended", "indexed", "offsets", "test", "!"}; private static final long ARRAY_BIT_SIZE = Arrays.stream(ARRAY).mapToLong(str -> BitSizeOfCalculator.getBitSizeOfString(str)).sum(); private static final long ORIGINAL_BIT_SIZE = BitSizeOfCalculator.getBitSizeOfVarSize(OFFSETS.length) + OFFSETS.length * 4 * 8; - private static final long EXTENDED_BIT_SIZE = ORIGINAL_BIT_SIZE + - BitSizeOfCalculator.getBitSizeOfVarSize(ARRAY.length) + ARRAY_BIT_SIZE; - + private static final long EXTENDED_BIT_SIZE = + ORIGINAL_BIT_SIZE + BitSizeOfCalculator.getBitSizeOfVarSize(ARRAY.length) + ARRAY_BIT_SIZE; } diff --git a/test/language/extended_members/java/extended_members/extended_optional_parameterized_field/ExtendedOptionalParameterizedFieldTest.java b/test/language/extended_members/java/extended_members/extended_optional_parameterized_field/ExtendedOptionalParameterizedFieldTest.java index b30ef1941..24184b28c 100644 --- a/test/language/extended_members/java/extended_members/extended_optional_parameterized_field/ExtendedOptionalParameterizedFieldTest.java +++ b/test/language/extended_members/java/extended_members/extended_optional_parameterized_field/ExtendedOptionalParameterizedFieldTest.java @@ -1,11 +1,12 @@ package extended_members.extended_optional_parameterized_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.io.BitBuffer; @@ -211,13 +212,13 @@ public void writeExtendedWithOptionalReadOriginal() throws IOException assertEquals(ORIGINAL_BIT_SIZE, reader.getBitPosition()); } - private static final String ARRAY[] = new String[] { "this", "is", "test" }; + private static final String ARRAY[] = new String[] {"this", "is", "test"}; private static final long ARRAY_BIT_SIZE = Arrays.stream(ARRAY).mapToLong(str -> BitSizeOfCalculator.getBitSizeOfString(str)).sum(); private static final long ORIGINAL_BIT_SIZE = 11; private static final long EXTENDED_BIT_SIZE_WITHOUT_OPTIONAL = - zserio.runtime.BitPositionUtil.alignTo(8, ORIGINAL_BIT_SIZE) + 1; + zserio.runtime.BitPositionUtil.alignTo(8, ORIGINAL_BIT_SIZE) + 1; private static final long EXTENDED_BIT_SIZE_WITH_OPTIONAL = - zserio.runtime.BitPositionUtil.alignTo(8, ORIGINAL_BIT_SIZE) + 1 + ARRAY_BIT_SIZE; + zserio.runtime.BitPositionUtil.alignTo(8, ORIGINAL_BIT_SIZE) + 1 + ARRAY_BIT_SIZE; } diff --git a/test/language/extended_members/java/extended_members/extended_simple_field/ExtendedSimpleFieldTest.java b/test/language/extended_members/java/extended_members/extended_simple_field/ExtendedSimpleFieldTest.java index edb5e3892..1529a8a88 100644 --- a/test/language/extended_members/java/extended_members/extended_simple_field/ExtendedSimpleFieldTest.java +++ b/test/language/extended_members/java/extended_members/extended_simple_field/ExtendedSimpleFieldTest.java @@ -1,11 +1,12 @@ package extended_members.extended_simple_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; diff --git a/test/language/extended_members/java/extended_members/extended_unaligned_field/ExtendedUnalignedFieldTest.java b/test/language/extended_members/java/extended_members/extended_unaligned_field/ExtendedUnalignedFieldTest.java index c6f405e18..0ad2b8f18 100644 --- a/test/language/extended_members/java/extended_members/extended_unaligned_field/ExtendedUnalignedFieldTest.java +++ b/test/language/extended_members/java/extended_members/extended_unaligned_field/ExtendedUnalignedFieldTest.java @@ -1,11 +1,12 @@ package extended_members.extended_unaligned_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; diff --git a/test/language/extended_members/java/extended_members/multiple_extended_fields/MultipleExtendedFieldsTest.java b/test/language/extended_members/java/extended_members/multiple_extended_fields/MultipleExtendedFieldsTest.java index 3540940ba..eb2700b64 100644 --- a/test/language/extended_members/java/extended_members/multiple_extended_fields/MultipleExtendedFieldsTest.java +++ b/test/language/extended_members/java/extended_members/multiple_extended_fields/MultipleExtendedFieldsTest.java @@ -1,11 +1,12 @@ package extended_members.multiple_extended_fields; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.BitPositionUtil; import zserio.runtime.BitSizeOfCalculator; @@ -143,12 +144,14 @@ public void writeOriginalReadExtended2() assertEquals(original, readOriginal); // any setter makes all values present! - final Extended2 readExtended2Setter1 = SerializeUtil.deserialize(Extended2.class, bitBuffer);; + final Extended2 readExtended2Setter1 = SerializeUtil.deserialize(Extended2.class, bitBuffer); + ; readExtended2Setter1.setExtendedValue1((byte)2); assertTrue(readExtended2Setter1.isExtendedValue1Present()); assertTrue(readExtended2Setter1.isExtendedValue2Present()); - final Extended2 readExtended2Setter2 = SerializeUtil.deserialize(Extended2.class, bitBuffer);; + final Extended2 readExtended2Setter2 = SerializeUtil.deserialize(Extended2.class, bitBuffer); + ; readExtended2Setter2.setExtendedValue2(DEFAULT_EXTENDED_VALUE2); assertTrue(readExtended2Setter2.isExtendedValue1Present()); assertTrue(readExtended2Setter2.isExtendedValue2Present()); @@ -258,7 +261,6 @@ public void writeExtended2ReadExtended1() throws IOException assertEquals(EXTENDED1_BIT_SIZE, reader.getBitPosition()); } - private static final String DEFAULT_EXTENDED_VALUE2 = "test"; private static final long ORIGINAL_BIT_SIZE = 4 * 8; diff --git a/test/language/extended_members/java/extended_members/multiple_extended_fields_various_types/MultipleExtendedFieldsVariousTypesTest.java b/test/language/extended_members/java/extended_members/multiple_extended_fields_various_types/MultipleExtendedFieldsVariousTypesTest.java index 17d18e454..5c44fcc4f 100644 --- a/test/language/extended_members/java/extended_members/multiple_extended_fields_various_types/MultipleExtendedFieldsVariousTypesTest.java +++ b/test/language/extended_members/java/extended_members/multiple_extended_fields_various_types/MultipleExtendedFieldsVariousTypesTest.java @@ -1,11 +1,12 @@ package extended_members.multiple_extended_fields_various_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import java.util.Arrays; import java.math.BigInteger; +import java.util.Arrays; + +import org.junit.jupiter.api.Test; import zserio.runtime.BitPositionUtil; import zserio.runtime.BitSizeOfCalculator; @@ -266,8 +267,8 @@ private static Extended2 createExtended2() { final Union extendedValue7 = new Union(EXTENDED_VALUE5); extendedValue7.setValueU32(UINT32_MAX); - return new Extended2(VALUE, EXTENDED_VALUE1, EXTENDED_VALUE2, EXTENDED_VALUE3, - null, EXTENDED_VALUE5, EXTENDED_VALUE6, extendedValue7, null, EXTENDED_VALUE9); + return new Extended2(VALUE, EXTENDED_VALUE1, EXTENDED_VALUE2, EXTENDED_VALUE3, null, EXTENDED_VALUE5, + EXTENDED_VALUE6, extendedValue7, null, EXTENDED_VALUE9); } private static long calcExtended1BitSize() @@ -290,8 +291,9 @@ private static long calcExtended2BitSize() bitSize = BitPositionUtil.alignTo(8, bitSize); bitSize += BitSizeOfCalculator.getBitSizeOfVarSize(EXTENDED_VALUE5); bitSize = BitPositionUtil.alignTo(8, bitSize); - bitSize += Arrays.stream(EXTENDED_VALUE6).mapToLong( - str -> BitSizeOfCalculator.getBitSizeOfString(str)).sum(); + bitSize += Arrays.stream(EXTENDED_VALUE6) + .mapToLong(str -> BitSizeOfCalculator.getBitSizeOfString(str)) + .sum(); bitSize = BitPositionUtil.alignTo(8, bitSize); bitSize += 8 + 4 * 8; // extendedValue7 (choiceTag + valueU32) bitSize = BitPositionUtil.alignTo(8, bitSize); @@ -305,10 +307,10 @@ private static long calcExtended2BitSize() private static final byte VALUE = -13; private static final long EXTENDED_VALUE1 = 42; - private static final BitBuffer EXTENDED_VALUE2 = new BitBuffer(new byte[] { (byte)0xCA, (byte)0xFE }, 16); - private static final byte[] EXTENDED_VALUE3 = new byte[] { (byte)0xDE, (byte)0xAD }; + private static final BitBuffer EXTENDED_VALUE2 = new BitBuffer(new byte[] {(byte)0xCA, (byte)0xFE}, 16); + private static final byte[] EXTENDED_VALUE3 = new byte[] {(byte)0xDE, (byte)0xAD}; private static final int EXTENDED_VALUE5 = 3; - private static final String[] EXTENDED_VALUE6 = new String[] { "this", "is", "test" }; + private static final String[] EXTENDED_VALUE6 = new String[] {"this", "is", "test"}; private static final BigInteger EXTENDED_VALUE9 = BigInteger.valueOf(7); // bit == bit<3> private static final long ORIGINAL_BIT_SIZE = 7; diff --git a/test/language/functions/build.xml b/test/language/functions/build.xml index d43f28927..c4445cabf 100644 --- a/test/language/functions/build.xml +++ b/test/language/functions/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/functions/java/functions/choice_array/ChoiceArrayTest.java b/test/language/functions/java/functions/choice_array/ChoiceArrayTest.java index 3b77033e2..8073e6217 100644 --- a/test/language/functions/java/functions/choice_array/ChoiceArrayTest.java +++ b/test/language/functions/java/functions/choice_array/ChoiceArrayTest.java @@ -1,11 +1,12 @@ package functions.choice_array; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -122,8 +123,8 @@ private void checkChoiceArrayFunction(int pos) throws IOException final byte[] expectedByteArray = writeOuterArrayToByteArray(pos); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final Inner readInner = new Inner(reader); assertEquals(inner, readInner); } @@ -131,11 +132,8 @@ private void checkChoiceArrayFunction(int pos) throws IOException private static final short ELEMENT_A_FOR_EXTRA_VALUE = 20; private static final int EXTRA_VALUE = 4711; - private static final Item[] ITEMS = new Item[] { - new Item((short)12, (short)13), - new Item(ELEMENT_A_FOR_EXTRA_VALUE, (short)18), - new Item((short)17, (short)14) - }; + private static final Item[] ITEMS = new Item[] {new Item((short)12, (short)13), + new Item(ELEMENT_A_FOR_EXTRA_VALUE, (short)18), new Item((short)17, (short)14)}; private static final int NUM_ITEM_ELEMENTS = ITEMS.length; private static final Item EXPLICIT_ITEM = new Item((short)27, (short)29); diff --git a/test/language/functions/java/functions/structure_array/StructureArrayTest.java b/test/language/functions/java/functions/structure_array/StructureArrayTest.java index 2a46f07ed..f07814c2a 100644 --- a/test/language/functions/java/functions/structure_array/StructureArrayTest.java +++ b/test/language/functions/java/functions/structure_array/StructureArrayTest.java @@ -1,11 +1,12 @@ package functions.structure_array; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -71,16 +72,13 @@ private void checkStructureArray(int pos) throws IOException final byte[] expectedByteArray = writeStructureArrayToByteArray(pos); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final StructureArray readStructureArray = new StructureArray(reader); assertEquals(structureArray, readStructureArray); } private static final Item[] ITEMS = new Item[] { - new Item((short)1, (short)2), - new Item((short)3, (short)4), - new Item((short)5, (short)6) - }; + new Item((short)1, (short)2), new Item((short)3, (short)4), new Item((short)5, (short)6)}; private static final int NUM_ITEM_ELEMENTS = ITEMS.length; } diff --git a/test/language/functions/java/functions/structure_array_param/StructureArrayParamTest.java b/test/language/functions/java/functions/structure_array_param/StructureArrayParamTest.java index 4771321ee..54cd2038a 100644 --- a/test/language/functions/java/functions/structure_array_param/StructureArrayParamTest.java +++ b/test/language/functions/java/functions/structure_array_param/StructureArrayParamTest.java @@ -1,12 +1,13 @@ package functions.structure_array_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -26,8 +27,8 @@ public void checkParentStructure() throws IOException final byte[] expectedByteArray = writeParentStructureToByteArray(); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final ParentStructure readParentStructure = new ParentStructure(reader); assertEquals(parentStructure, readParentStructure); } @@ -71,13 +72,11 @@ private ParentStructure createParentStructure() private static final ChildStructure[] CHILDREN = new ChildStructure[] { new ChildStructure(CHILD_BIT_SIZE, BigInteger.valueOf(0xAABB)), - new ChildStructure(CHILD_BIT_SIZE, BigInteger.valueOf(0xCCDD)) - }; + new ChildStructure(CHILD_BIT_SIZE, BigInteger.valueOf(0xCCDD))}; private static final ChildStructure[] ANOTHER_CHILDREN = new ChildStructure[] { new ChildStructure(ANOTHER_CHILD_BIT_SIZE, BigInteger.valueOf(0xAABB)), - new ChildStructure(ANOTHER_CHILD_BIT_SIZE, BigInteger.valueOf(0xCCDD)) - }; + new ChildStructure(ANOTHER_CHILD_BIT_SIZE, BigInteger.valueOf(0xCCDD))}; private static final short NUM_CHILDREN = (short)CHILDREN.length; private static final short NUM_ANOTHER_CHILDREN = (short)ANOTHER_CHILDREN.length; diff --git a/test/language/functions/java/functions/structure_bytes/StructureBytesTest.java b/test/language/functions/java/functions/structure_bytes/StructureBytesTest.java index 67dc6743e..892c56c44 100644 --- a/test/language/functions/java/functions/structure_bytes/StructureBytesTest.java +++ b/test/language/functions/java/functions/structure_bytes/StructureBytesTest.java @@ -1,6 +1,7 @@ package functions.structure_bytes; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; public class StructureBytesTest @@ -23,6 +24,6 @@ public void getChildField() assertArrayEquals(CHILD_FIELD, testStructure.funcGetChildField()); } - private static final byte[] FIELD = new byte[]{(byte)0xAB, (byte)0xE0}; - private static final byte[] CHILD_FIELD = new byte[]{(byte)0xCA, (byte)0xFE}; + private static final byte[] FIELD = new byte[] {(byte)0xAB, (byte)0xE0}; + private static final byte[] CHILD_FIELD = new byte[] {(byte)0xCA, (byte)0xFE}; } diff --git a/test/language/functions/java/functions/structure_extern/StructureExternTest.java b/test/language/functions/java/functions/structure_extern/StructureExternTest.java index 52d4fb8e9..057633c85 100644 --- a/test/language/functions/java/functions/structure_extern/StructureExternTest.java +++ b/test/language/functions/java/functions/structure_extern/StructureExternTest.java @@ -1,6 +1,7 @@ package functions.structure_extern; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; @@ -25,6 +26,6 @@ public void getChildField() assertEquals(CHILD_FIELD, testStructure.funcGetChildField()); } - private static final BitBuffer FIELD = new BitBuffer(new byte[]{(byte)0xAB, (byte)0xE0}, 11); - private static final BitBuffer CHILD_FIELD = new BitBuffer(new byte[]{(byte)0xCA, (byte)0xFE}, 15); + private static final BitBuffer FIELD = new BitBuffer(new byte[] {(byte)0xAB, (byte)0xE0}, 11); + private static final BitBuffer CHILD_FIELD = new BitBuffer(new byte[] {(byte)0xCA, (byte)0xFE}, 15); } diff --git a/test/language/functions/java/functions/structure_optional/StructureOptionalTest.java b/test/language/functions/java/functions/structure_optional/StructureOptionalTest.java index 6218162eb..50446b7a6 100644 --- a/test/language/functions/java/functions/structure_optional/StructureOptionalTest.java +++ b/test/language/functions/java/functions/structure_optional/StructureOptionalTest.java @@ -1,11 +1,12 @@ package functions.structure_optional; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -60,8 +61,8 @@ private ValueConsumerCreator createValueConsumerCreator(byte defaultValue, byte private void checkValueConsumerCreator(byte defaultValue, byte externalValue) throws IOException { - final ValueConsumerCreator valueConsumerCreator = createValueConsumerCreator(defaultValue, - externalValue); + final ValueConsumerCreator valueConsumerCreator = + createValueConsumerCreator(defaultValue, externalValue); assertEquals(calculateValue(defaultValue, externalValue), valueConsumerCreator.getValueCalculator().funcValue()); @@ -72,8 +73,8 @@ private void checkValueConsumerCreator(byte defaultValue, byte externalValue) th final byte[] expectedByteArray = writeValueConsumerCreatorToByteArray(defaultValue, externalValue); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final ValueConsumerCreator readValueConsumerCreator = new ValueConsumerCreator(reader); assertEquals(valueConsumerCreator, readValueConsumerCreator); } diff --git a/test/language/functions/java/functions/structure_param/StructureParamTest.java b/test/language/functions/java/functions/structure_param/StructureParamTest.java index 4cc816afe..0f0ae7a90 100644 --- a/test/language/functions/java/functions/structure_param/StructureParamTest.java +++ b/test/language/functions/java/functions/structure_param/StructureParamTest.java @@ -1,11 +1,12 @@ package functions.structure_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,8 +25,8 @@ public void checkMetresConverterCaller() throws IOException final byte[] expectedByteArray = writeMetresConverterCallerToByteArray(); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final MetresConverterCaller readMetresConverterCaller = new MetresConverterCaller(reader); assertEquals(metresConverterCaller, readMetresConverterCaller); } diff --git a/test/language/functions/java/functions/structure_parent_child_value/StructureParentChildValueTest.java b/test/language/functions/java/functions/structure_parent_child_value/StructureParentChildValueTest.java index 72cbff4b7..6a41e172d 100644 --- a/test/language/functions/java/functions/structure_parent_child_value/StructureParentChildValueTest.java +++ b/test/language/functions/java/functions/structure_parent_child_value/StructureParentChildValueTest.java @@ -1,11 +1,12 @@ package functions.structure_parent_child_value; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,8 +25,8 @@ public void checkParentValue() throws IOException final byte[] expectedByteArray = writeParentValueToByteArray(); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final ParentValue readParentValue = new ParentValue(reader); assertEquals(parentValue, readParentValue); } diff --git a/test/language/functions/java/functions/structure_string/StructureStringTest.java b/test/language/functions/java/functions/structure_string/StructureStringTest.java index 88f5d74dd..38ee1ac31 100644 --- a/test/language/functions/java/functions/structure_string/StructureStringTest.java +++ b/test/language/functions/java/functions/structure_string/StructureStringTest.java @@ -1,6 +1,7 @@ package functions.structure_string; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; public class StructureStringTest diff --git a/test/language/functions/java/functions/structure_value/StructureValueTest.java b/test/language/functions/java/functions/structure_value/StructureValueTest.java index c95748108..220e4e433 100644 --- a/test/language/functions/java/functions/structure_value/StructureValueTest.java +++ b/test/language/functions/java/functions/structure_value/StructureValueTest.java @@ -1,11 +1,12 @@ package functions.structure_value; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -90,7 +91,6 @@ else if (value <= 0xFFFF) return customVarInt; } - private void checkCustomVarInt(int value) throws IOException { final CustomVarInt customVarInt = createCustomVarInt(value); @@ -104,13 +104,13 @@ private void checkCustomVarInt(int value) throws IOException final byte[] expecteByteArray = writeCustomVarIntToByteArray(value); assertTrue(Arrays.equals(expecteByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final CustomVarInt readcustomVarInt = new CustomVarInt(reader); assertEquals(customVarInt, readcustomVarInt); } - private static final int MAX_ONE_BYTE_VALUE = 253; - private static final short TWO_BYTES_INDICATOR = 255; - private static final short FOUR_BYTES_INDICATOR = 254; + private static final int MAX_ONE_BYTE_VALUE = 253; + private static final short TWO_BYTES_INDICATOR = 255; + private static final short FOUR_BYTES_INDICATOR = 254; } diff --git a/test/language/functions/java/functions/union_array/UnionArrayTest.java b/test/language/functions/java/functions/union_array/UnionArrayTest.java index fbf26b800..1c16af78e 100644 --- a/test/language/functions/java/functions/union_array/UnionArrayTest.java +++ b/test/language/functions/java/functions/union_array/UnionArrayTest.java @@ -1,11 +1,12 @@ package functions.union_array; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.util.Arrays; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -103,18 +104,15 @@ private void checkInner(int pos) throws IOException final byte[] expectedByteArray = writeInnerToByteArray(pos); assertTrue(Arrays.equals(expectedByteArray, writtenByteArray)); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writtenByteArray, writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writtenByteArray, writer.getBitPosition()); final Inner readInner = new Inner(reader); assertEquals(inner, readInner); } private static final Item[] ITEMS = new Item[] { - new Item((short)12, (short)13), - new Item((short)42, (short)18), - new Item((short)17, (short)14) - }; + new Item((short)12, (short)13), new Item((short)42, (short)18), new Item((short)17, (short)14)}; private static final int NUM_ITEM_ELEMENTS = ITEMS.length; private static final Item EXPLICIT_ITEM = new Item((short)27, (short)29); diff --git a/test/language/identifiers/build.xml b/test/language/identifiers/build.xml index 80e86a661..740afdfb9 100644 --- a/test/language/identifiers/build.xml +++ b/test/language/identifiers/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/identifiers/java/identifiers/BitmaskNameClashingWithJavaTest.java b/test/language/identifiers/java/identifiers/BitmaskNameClashingWithJavaTest.java index e59628557..41b5f2a0d 100644 --- a/test/language/identifiers/java/identifiers/BitmaskNameClashingWithJavaTest.java +++ b/test/language/identifiers/java/identifiers/BitmaskNameClashingWithJavaTest.java @@ -1,6 +1,7 @@ package identifiers; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import identifiers.bitmask_name_clashing_with_java.BitmaskNameClashingWithJava; diff --git a/test/language/identifiers/java/identifiers/StructureNameClashingWithJavaTest.java b/test/language/identifiers/java/identifiers/StructureNameClashingWithJavaTest.java index 66f400c85..ae37008f3 100644 --- a/test/language/identifiers/java/identifiers/StructureNameClashingWithJavaTest.java +++ b/test/language/identifiers/java/identifiers/StructureNameClashingWithJavaTest.java @@ -1,25 +1,25 @@ package identifiers; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import identifiers.structure_name_clashing_with_java.StructureNameClashingWithJava; +import identifiers.structure_name_clashing_with_java.BigInteger; import identifiers.structure_name_clashing_with_java.Byte; -import identifiers.structure_name_clashing_with_java.Short; +import identifiers.structure_name_clashing_with_java.Double; +import identifiers.structure_name_clashing_with_java.Float; import identifiers.structure_name_clashing_with_java.Integer; import identifiers.structure_name_clashing_with_java.Long; -import identifiers.structure_name_clashing_with_java.BigInteger; -import identifiers.structure_name_clashing_with_java.Float; -import identifiers.structure_name_clashing_with_java.Double; +import identifiers.structure_name_clashing_with_java.Short; import identifiers.structure_name_clashing_with_java.String; +import identifiers.structure_name_clashing_with_java.StructureNameClashingWithJava; public class StructureNameClashingWithJavaTest { @Test public void emptyConstructor() { - final StructureNameClashingWithJava structureNameClashingWithJava = - new StructureNameClashingWithJava(); + final StructureNameClashingWithJava structureNameClashingWithJava = new StructureNameClashingWithJava(); assertEquals(null, structureNameClashingWithJava.getByteField()); assertEquals(null, structureNameClashingWithJava.getShortField()); assertEquals(null, structureNameClashingWithJava.getIntegerField()); @@ -33,22 +33,15 @@ public void emptyConstructor() @Test public void bitSizeOf() { - final StructureNameClashingWithJava structureNameClashingWithJava = - new StructureNameClashingWithJava( - new Byte(java.lang.Byte.valueOf((byte)0)), - new Short(java.lang.Short.valueOf((short)0)), - new Integer(java.lang.Integer.valueOf(0)), - new Long(java.lang.Long.valueOf((long)0)), - new BigInteger(java.math.BigInteger.ZERO), - new Float(java.lang.Float.valueOf(0.0f)), - new Double(java.lang.Double.valueOf(0.0)), - new String("") - ); + final StructureNameClashingWithJava structureNameClashingWithJava = new StructureNameClashingWithJava( + new Byte(java.lang.Byte.valueOf((byte)0)), new Short(java.lang.Short.valueOf((short)0)), + new Integer(java.lang.Integer.valueOf(0)), new Long(java.lang.Long.valueOf((long)0)), + new BigInteger(java.math.BigInteger.ZERO), new Float(java.lang.Float.valueOf(0.0f)), + new Double(java.lang.Double.valueOf(0.0)), new String("")); assertEquals(BIT_SIZE, structureNameClashingWithJava.bitSizeOf()); } - private static final int BIT_SIZE = - 8 * 1 + // all auto optionals + private static final int BIT_SIZE = 8 * 1 + // all auto optionals 8 + // Byte 16 + // Short 32 + // Integer diff --git a/test/language/indexed_offsets/build.xml b/test/language/indexed_offsets/build.xml index 8028fc1ea..4003794f9 100644 --- a/test/language/indexed_offsets/build.xml +++ b/test/language/indexed_offsets/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/indexed_offsets/java/indexed_offsets/AutoIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/AutoIndexedOffsetArrayTest.java index 706182433..326d9d420 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/AutoIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/AutoIndexedOffsetArrayTest.java @@ -1,12 +1,11 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import indexed_offsets.auto_indexed_offset_array.AutoIndexedOffsetArray; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.auto_indexed_offset_array.AutoIndexedOffsetArray; + public class AutoIndexedOffsetArrayTest { @Test @@ -105,8 +106,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(autoIndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final AutoIndexedOffsetArray readAutoIndexedOffsetArray = new AutoIndexedOffsetArray(reader); checkOffsets(autoIndexedOffsetArray, offsetShift); @@ -203,19 +204,19 @@ private AutoIndexedOffsetArray createAutoIndexedOffsetArray(boolean createWrongO return autoIndexedOffsetArray; } - private static final short NUM_ELEMENTS = (short)5; + private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; + private static final long WRONG_OFFSET = (long)0; - private static final int AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; - private static final long ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + + private static final int AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; + private static final long ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE + AUTO_ARRAY_LENGTH_BYTE_SIZE; - private static final int ELEMENT_SIZE = 5; - private static final int ALIGNED_ELEMENT_SIZE = Byte.SIZE; - private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; + private static final int ELEMENT_SIZE = 5; + private static final int ALIGNED_ELEMENT_SIZE = Byte.SIZE; + private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; - private static final byte SPACER_VALUE = 1; + private static final byte SPACER_VALUE = 1; - private static final int AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = (int)ELEMENT0_OFFSET * Byte.SIZE + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + private static final int AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = + (int)ELEMENT0_OFFSET * Byte.SIZE + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/Bit5IndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/Bit5IndexedOffsetArrayTest.java index 7b73e7f2b..1fd6eda06 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/Bit5IndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/Bit5IndexedOffsetArrayTest.java @@ -1,11 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.bit5_indexed_offset_array.Bit5IndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.bit5_indexed_offset_array.Bit5IndexedOffsetArray; + public class Bit5IndexedOffsetArrayTest { @Test @@ -104,8 +105,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(bit5IndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final Bit5IndexedOffsetArray readBit5IndexedOffsetArray = new Bit5IndexedOffsetArray(reader); checkOffsets(readBit5IndexedOffsetArray, offsetShift); @@ -202,15 +203,15 @@ private Bit5IndexedOffsetArray createBit5IndexedOffsetArray(boolean createWrongO private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; + private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; - private static final int ELEMENT_SIZE = 5; - private static final int ALIGNED_ELEMENT_SIZE = Byte.SIZE; - private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; + private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; + private static final int ELEMENT_SIZE = 5; + private static final int ALIGNED_ELEMENT_SIZE = Byte.SIZE; + private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; - private static final byte SPACER_VALUE = 1; + private static final byte SPACER_VALUE = 1; - private static final int BIT5_INDEXED_OFFSET_ARRAY_BIT_SIZE = NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + private static final int BIT5_INDEXED_OFFSET_ARRAY_BIT_SIZE = + NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/BoolIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/BoolIndexedOffsetArrayTest.java index d15c7cb46..d33aa07cc 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/BoolIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/BoolIndexedOffsetArrayTest.java @@ -1,11 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.bool_indexed_offset_array.BoolIndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.bool_indexed_offset_array.BoolIndexedOffsetArray; + public class BoolIndexedOffsetArrayTest { @Test @@ -85,8 +86,8 @@ public void write() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(boolIndexedOffsetArray); checkBoolIndexedOffsetArray(boolIndexedOffsetArray); - final BoolIndexedOffsetArray readBoolIndexedOffsetArray = SerializeUtil.deserialize( - BoolIndexedOffsetArray.class, bitBuffer); + final BoolIndexedOffsetArray readBoolIndexedOffsetArray = + SerializeUtil.deserialize(BoolIndexedOffsetArray.class, bitBuffer); checkBoolIndexedOffsetArray(readBoolIndexedOffsetArray); assertTrue(boolIndexedOffsetArray.equals(readBoolIndexedOffsetArray)); } @@ -104,8 +105,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(boolIndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final BoolIndexedOffsetArray readBoolIndexedOffsetArray = new BoolIndexedOffsetArray(reader); checkOffsets(readBoolIndexedOffsetArray, offsetShift); @@ -202,15 +203,15 @@ private BoolIndexedOffsetArray createBoolIndexedOffsetArray(boolean createWrongO private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; + private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; - private static final int ELEMENT_SIZE = 1; - private static final int ALIGNED_ELEMENT_SIZE = Byte.SIZE; - private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; + private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; + private static final int ELEMENT_SIZE = 1; + private static final int ALIGNED_ELEMENT_SIZE = Byte.SIZE; + private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; - private static final byte SPACER_VALUE = 1; + private static final byte SPACER_VALUE = 1; - private static final int BOOL_INDEXED_OFFSET_ARRAY_BIT_SIZE = NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + private static final int BOOL_INDEXED_OFFSET_ARRAY_BIT_SIZE = + NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/CompoundIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/CompoundIndexedOffsetArrayTest.java index c2d288303..9e221ccbf 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/CompoundIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/CompoundIndexedOffsetArrayTest.java @@ -1,12 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.compound_indexed_offset_array.Compound; -import indexed_offsets.compound_indexed_offset_array.CompoundIndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -16,6 +14,9 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.compound_indexed_offset_array.Compound; +import indexed_offsets.compound_indexed_offset_array.CompoundIndexedOffsetArray; + public class CompoundIndexedOffsetArrayTest { @Test @@ -92,8 +93,8 @@ public void writeRead() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(compoundIndexedOffsetArray); checkCompoundIndexedOffsetArray(compoundIndexedOffsetArray); - final CompoundIndexedOffsetArray readCompoundIndexedOffsetArray = SerializeUtil.deserialize( - CompoundIndexedOffsetArray.class, bitBuffer); + final CompoundIndexedOffsetArray readCompoundIndexedOffsetArray = + SerializeUtil.deserialize(CompoundIndexedOffsetArray.class, bitBuffer); checkCompoundIndexedOffsetArray(readCompoundIndexedOffsetArray); assertTrue(compoundIndexedOffsetArray.equals(readCompoundIndexedOffsetArray)); } @@ -112,8 +113,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(compoundIndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final CompoundIndexedOffsetArray readCompoundIndexedOffsetArray = new CompoundIndexedOffsetArray(reader); @@ -220,15 +221,15 @@ private CompoundIndexedOffsetArray createCompoundIndexedOffsetArray(boolean crea private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; + private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; - private static final int ELEMENT_SIZE = 35; - private static final int ALIGNED_ELEMENT_SIZE = 5 * Byte.SIZE; - private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; + private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; + private static final int ELEMENT_SIZE = 35; + private static final int ALIGNED_ELEMENT_SIZE = 5 * Byte.SIZE; + private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; - private static final byte SPACER_VALUE = 1; + private static final byte SPACER_VALUE = 1; - private static final int COMPOUND_INDEXED_OFFSET_ARRAY_BIT_SIZE = + private static final int COMPOUND_INDEXED_OFFSET_ARRAY_BIT_SIZE = NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/EmptyIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/EmptyIndexedOffsetArrayTest.java index 04a9140d5..fda0998cd 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/EmptyIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/EmptyIndexedOffsetArrayTest.java @@ -1,11 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.empty_indexed_offset_array.EmptyIndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -14,6 +13,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.empty_indexed_offset_array.EmptyIndexedOffsetArray; + public class EmptyIndexedOffsetArrayTest { @Test @@ -45,8 +46,8 @@ public void initializeOffsets() { final EmptyIndexedOffsetArray emptyIndexedOffsetArray = createEmptyIndexedOffsetArray(); final int bitPosition = 0; - assertEquals(EMPTY_INDEXED_OFFSET_ARRAY_BIT_SIZE, - emptyIndexedOffsetArray.initializeOffsets(bitPosition)); + assertEquals( + EMPTY_INDEXED_OFFSET_ARRAY_BIT_SIZE, emptyIndexedOffsetArray.initializeOffsets(bitPosition)); checkEmptyIndexedOffsetArray(emptyIndexedOffsetArray); } @@ -67,8 +68,8 @@ public void writeRead() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(emptyIndexedOffsetArray); checkEmptyIndexedOffsetArray(emptyIndexedOffsetArray); - final EmptyIndexedOffsetArray readEmptyIndexedOffsetArray = SerializeUtil.deserialize( - EmptyIndexedOffsetArray.class, bitBuffer); + final EmptyIndexedOffsetArray readEmptyIndexedOffsetArray = + SerializeUtil.deserialize(EmptyIndexedOffsetArray.class, bitBuffer); checkEmptyIndexedOffsetArray(readEmptyIndexedOffsetArray); assertTrue(emptyIndexedOffsetArray.equals(readEmptyIndexedOffsetArray)); } @@ -113,8 +114,8 @@ private EmptyIndexedOffsetArray createEmptyIndexedOffsetArray() private static final short NUM_ELEMENTS = (short)0; - private static final byte SPACER_VALUE = 1; - private static final byte FIELD_VALUE = 63; + private static final byte SPACER_VALUE = 1; + private static final byte FIELD_VALUE = 63; - private static final int EMPTY_INDEXED_OFFSET_ARRAY_BIT_SIZE = 1 + 6; + private static final int EMPTY_INDEXED_OFFSET_ARRAY_BIT_SIZE = 1 + 6; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/Int14IndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/Int14IndexedOffsetArrayTest.java index d30b3d839..e8de9d2a6 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/Int14IndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/Int14IndexedOffsetArrayTest.java @@ -1,11 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.int14_indexed_offset_array.Int14IndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.int14_indexed_offset_array.Int14IndexedOffsetArray; + public class Int14IndexedOffsetArrayTest { @Test @@ -63,7 +64,8 @@ public void initializeOffsets() final Int14IndexedOffsetArray int14IndexedOffsetArray = createInt14IndexedOffsetArray(createWrongOffsets); final int bitPosition = 0; - assertEquals(INT14_INDEXED_OFFSET_ARRAY_BIT_SIZE, int14IndexedOffsetArray.initializeOffsets(bitPosition)); + assertEquals( + INT14_INDEXED_OFFSET_ARRAY_BIT_SIZE, int14IndexedOffsetArray.initializeOffsets(bitPosition)); checkInt14IndexedOffsetArray(int14IndexedOffsetArray); } @@ -90,8 +92,8 @@ public void writeRead() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(int14IndexedOffsetArray); checkInt14IndexedOffsetArray(int14IndexedOffsetArray); - final Int14IndexedOffsetArray readInt14IndexedOffsetArray = SerializeUtil.deserialize( - Int14IndexedOffsetArray.class, bitBuffer); + final Int14IndexedOffsetArray readInt14IndexedOffsetArray = + SerializeUtil.deserialize(Int14IndexedOffsetArray.class, bitBuffer); checkInt14IndexedOffsetArray(readInt14IndexedOffsetArray); assertTrue(int14IndexedOffsetArray.equals(readInt14IndexedOffsetArray)); } @@ -110,8 +112,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(int14IndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final Int14IndexedOffsetArray readInt14IndexedOffsetArray = new Int14IndexedOffsetArray(reader); checkOffsets(int14IndexedOffsetArray, offsetShift); @@ -209,15 +211,15 @@ private Int14IndexedOffsetArray createInt14IndexedOffsetArray(boolean createWron private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; + private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; - private static final int ELEMENT_SIZE = 14; - private static final int ALIGNED_ELEMENT_SIZE = 2 * Byte.SIZE; - private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; + private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; + private static final int ELEMENT_SIZE = 14; + private static final int ALIGNED_ELEMENT_SIZE = 2 * Byte.SIZE; + private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / Byte.SIZE; - private static final byte SPACER_VALUE = 1; + private static final byte SPACER_VALUE = 1; - private static final int INT14_INDEXED_OFFSET_ARRAY_BIT_SIZE = NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + - (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; + private static final int INT14_INDEXED_OFFSET_ARRAY_BIT_SIZE = + NUM_ELEMENTS * Integer.SIZE + Byte.SIZE + (NUM_ELEMENTS - 1) * ALIGNED_ELEMENT_SIZE + ELEMENT_SIZE; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/OptionalIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/OptionalIndexedOffsetArrayTest.java index f8da68c25..762421b1d 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/OptionalIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/OptionalIndexedOffsetArrayTest.java @@ -1,11 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.optional_indexed_offset_array.OptionalIndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.ZserioError; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.optional_indexed_offset_array.OptionalIndexedOffsetArray; + public class OptionalIndexedOffsetArrayTest { @Test @@ -94,8 +95,8 @@ public void writeReadWithOptional() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(optionalIndexedOffsetArray); checkOptionalIndexedOffsetArray(optionalIndexedOffsetArray, hasOptional); - final OptionalIndexedOffsetArray readOptionalIndexedOffsetArray = SerializeUtil.deserialize( - OptionalIndexedOffsetArray.class, bitBuffer); + final OptionalIndexedOffsetArray readOptionalIndexedOffsetArray = + SerializeUtil.deserialize(OptionalIndexedOffsetArray.class, bitBuffer); checkOptionalIndexedOffsetArray(readOptionalIndexedOffsetArray, hasOptional); assertTrue(optionalIndexedOffsetArray.equals(readOptionalIndexedOffsetArray)); } @@ -109,14 +110,14 @@ public void writeReadWithoutOptional() throws IOException, ZserioError createOptionalIndexedOffsetArray(hasOptional, createWrongOffsets); final BitBuffer bitBuffer = SerializeUtil.serialize(optionalIndexedOffsetArray); - final OptionalIndexedOffsetArray readOptionalIndexedOffsetArray = SerializeUtil.deserialize( - OptionalIndexedOffsetArray.class, bitBuffer); + final OptionalIndexedOffsetArray readOptionalIndexedOffsetArray = + SerializeUtil.deserialize(OptionalIndexedOffsetArray.class, bitBuffer); checkOptionalIndexedOffsetArray(readOptionalIndexedOffsetArray, hasOptional); assertTrue(optionalIndexedOffsetArray.equals(readOptionalIndexedOffsetArray)); } - private BitBuffer writeOptionalIndexedOffsetArrayToBitBuffer(boolean hasOptional, - boolean writeWrongOffsets) throws IOException + private BitBuffer writeOptionalIndexedOffsetArrayToBitBuffer(boolean hasOptional, boolean writeWrongOffsets) + throws IOException { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { @@ -157,8 +158,8 @@ private void checkOffsets(OptionalIndexedOffsetArray optionalIndexedOffsetArray, } } - private void checkOptionalIndexedOffsetArray(OptionalIndexedOffsetArray optionalIndexedOffsetArray, - boolean hasOptional) + private void checkOptionalIndexedOffsetArray( + OptionalIndexedOffsetArray optionalIndexedOffsetArray, boolean hasOptional) { final short offsetShift = 0; checkOffsets(optionalIndexedOffsetArray, offsetShift); @@ -176,8 +177,8 @@ private void checkOptionalIndexedOffsetArray(OptionalIndexedOffsetArray optional assertEquals(FIELD_VALUE, optionalIndexedOffsetArray.getField()); } - private OptionalIndexedOffsetArray createOptionalIndexedOffsetArray(boolean hasOptional, - boolean createWrongOffsets) + private OptionalIndexedOffsetArray createOptionalIndexedOffsetArray( + boolean hasOptional, boolean createWrongOffsets) { final OptionalIndexedOffsetArray optionalIndexedOffsetArray = new OptionalIndexedOffsetArray(); @@ -223,10 +224,10 @@ private long getOptionalIndexedOffsetArrayBitSize(boolean hasOptional) private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; + private static final long WRONG_OFFSET = (long)0; + private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; - private static final byte FIELD_VALUE = 63; + private static final byte FIELD_VALUE = 63; private static final String DATA[] = {"Green", "Red", "Pink", "Blue", "Black"}; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/OptionalNestedIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/OptionalNestedIndexedOffsetArrayTest.java index 2476dafc0..b56a9b27c 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/OptionalNestedIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/OptionalNestedIndexedOffsetArrayTest.java @@ -1,12 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.optional_nested_indexed_offset_array.OptionalNestedIndexedOffsetArray; -import indexed_offsets.optional_nested_indexed_offset_array.Header; +import org.junit.jupiter.api.Test; import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.ZserioError; @@ -16,6 +14,9 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.optional_nested_indexed_offset_array.Header; +import indexed_offsets.optional_nested_indexed_offset_array.OptionalNestedIndexedOffsetArray; + public class OptionalNestedIndexedOffsetArrayTest { @Test @@ -99,8 +100,8 @@ public void writeReadWithOptional() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(optionalNestedIndexedOffsetArray); checkOptionalNestedIndexedOffsetArray(optionalNestedIndexedOffsetArray, length); - final OptionalNestedIndexedOffsetArray readOptionalNestedIndexedOffsetArray = SerializeUtil.deserialize( - OptionalNestedIndexedOffsetArray.class, bitBuffer); + final OptionalNestedIndexedOffsetArray readOptionalNestedIndexedOffsetArray = + SerializeUtil.deserialize(OptionalNestedIndexedOffsetArray.class, bitBuffer); checkOptionalNestedIndexedOffsetArray(readOptionalNestedIndexedOffsetArray, length); assertTrue(optionalNestedIndexedOffsetArray.equals(readOptionalNestedIndexedOffsetArray)); } @@ -114,8 +115,8 @@ public void writeReadWithoutOptional() throws IOException, ZserioError createOptionalNestedIndexedOffsetArray(length, createWrongOffsets); final BitBuffer bitBuffer = SerializeUtil.serialize(optionalNestedIndexedOffsetArray); - final OptionalNestedIndexedOffsetArray readOptionalNestedIndexedOffsetArray = SerializeUtil.deserialize( - OptionalNestedIndexedOffsetArray.class, bitBuffer); + final OptionalNestedIndexedOffsetArray readOptionalNestedIndexedOffsetArray = + SerializeUtil.deserialize(OptionalNestedIndexedOffsetArray.class, bitBuffer); checkOptionalNestedIndexedOffsetArray(readOptionalNestedIndexedOffsetArray, length); assertTrue(optionalNestedIndexedOffsetArray.equals(readOptionalNestedIndexedOffsetArray)); } @@ -150,8 +151,8 @@ private BitBuffer writeOptionalNestedIndexedOffsetArrayToBitBuffer(int length, b } } - private void checkOffsets(OptionalNestedIndexedOffsetArray optionalNestedIndexedOffsetArray, - short offsetShift) + private void checkOffsets( + OptionalNestedIndexedOffsetArray optionalNestedIndexedOffsetArray, short offsetShift) { final int length = optionalNestedIndexedOffsetArray.getHeader().getLength(); final long[] offsets = optionalNestedIndexedOffsetArray.getHeader().getOffsets(); @@ -183,8 +184,8 @@ private void checkOptionalNestedIndexedOffsetArray( assertEquals(FIELD_VALUE, optionalNestedIndexedOffsetArray.getField()); } - private OptionalNestedIndexedOffsetArray createOptionalNestedIndexedOffsetArray(int length, - boolean createWrongOffsets) + private OptionalNestedIndexedOffsetArray createOptionalNestedIndexedOffsetArray( + int length, boolean createWrongOffsets) { final OptionalNestedIndexedOffsetArray optionalNestedIndexedOffsetArray = new OptionalNestedIndexedOffsetArray(); @@ -236,10 +237,10 @@ private long getOptionalNestedIndexedOffsetArrayBitSize(int length) private static final int NUM_ELEMENTS = (int)5; - private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(Short.SIZE + NUM_ELEMENTS * Integer.SIZE) / Byte.SIZE; + private static final long WRONG_OFFSET = (long)0; + private static final long ELEMENT0_OFFSET = (long)(Short.SIZE + NUM_ELEMENTS * Integer.SIZE) / Byte.SIZE; - private static final byte FIELD_VALUE = 63; + private static final byte FIELD_VALUE = 63; private static final String DATA[] = {"Green", "Red", "Pink", "Blue", "Black"}; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/PackedAutoIndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/PackedAutoIndexedOffsetArrayTest.java index 3ec4757ce..fb34296a1 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/PackedAutoIndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/PackedAutoIndexedOffsetArrayTest.java @@ -1,12 +1,11 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import indexed_offsets.packed_auto_indexed_offset_array.AutoIndexedOffsetArray; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.packed_auto_indexed_offset_array.AutoIndexedOffsetArray; + public class PackedAutoIndexedOffsetArrayTest { @Test @@ -85,8 +86,8 @@ public void writeReadFile() throws IOException, ZserioError SerializeUtil.serializeToFile(autoIndexedOffsetArray, BLOB_NAME); checkAutoIndexedOffsetArray(autoIndexedOffsetArray); - final AutoIndexedOffsetArray readAutoIndexedOffsetArray = SerializeUtil.deserializeFromFile( - AutoIndexedOffsetArray.class, BLOB_NAME); + final AutoIndexedOffsetArray readAutoIndexedOffsetArray = + SerializeUtil.deserializeFromFile(AutoIndexedOffsetArray.class, BLOB_NAME); checkAutoIndexedOffsetArray(readAutoIndexedOffsetArray); assertTrue(autoIndexedOffsetArray.equals(readAutoIndexedOffsetArray)); } @@ -104,8 +105,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(autoIndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final AutoIndexedOffsetArray readAutoIndexedOffsetArray = new AutoIndexedOffsetArray(reader); checkOffsets(readAutoIndexedOffsetArray, offsetShift); @@ -207,26 +208,25 @@ private AutoIndexedOffsetArray createAutoIndexedOffsetArray(boolean createWrongO private static final String BLOB_NAME = "packed_auto_indexed_offset_array.blob"; - private static final short NUM_ELEMENTS = (short)5; + private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = 0; + private static final long WRONG_OFFSET = 0; - private static final int AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; - private static final long ELEMENT0_OFFSET = - AUTO_ARRAY_LENGTH_BYTE_SIZE + (long)(NUM_ELEMENTS * 4) + + private static final int AUTO_ARRAY_LENGTH_BYTE_SIZE = 1; + private static final long ELEMENT0_OFFSET = AUTO_ARRAY_LENGTH_BYTE_SIZE + (long)(NUM_ELEMENTS * 4) + (3 + AUTO_ARRAY_LENGTH_BYTE_SIZE * 8 + 5 /* alignment */) / 8; - private static final int ELEMENT_SIZE = 5; - private static final int ALIGNED_FIRST_ELEMENT_SIZE = 1 + 6 + ELEMENT_SIZE + 4 /* alignment */; - private static final int ALIGNED_FIRST_ELEMENT_BYTE_SIZE = ALIGNED_FIRST_ELEMENT_SIZE / 8; - private static final int ALIGNED_ELEMENT_SIZE = 8; - private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; + private static final int ELEMENT_SIZE = 5; + private static final int ALIGNED_FIRST_ELEMENT_SIZE = 1 + 6 + ELEMENT_SIZE + 4 /* alignment */; + private static final int ALIGNED_FIRST_ELEMENT_BYTE_SIZE = ALIGNED_FIRST_ELEMENT_SIZE / 8; + private static final int ALIGNED_ELEMENT_SIZE = 8; + private static final int ALIGNED_ELEMENT_BYTE_SIZE = ALIGNED_ELEMENT_SIZE / 8; - private static final byte SPACER_VALUE = 7; + private static final byte SPACER_VALUE = 7; - private static final short PACKED_ARRAY_DELTA = 1; - private static final short PACKED_ARRAY_MAX_BIT_NUMBER = 1; + private static final short PACKED_ARRAY_DELTA = 1; + private static final short PACKED_ARRAY_MAX_BIT_NUMBER = 1; - private static final int AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = (int)ELEMENT0_OFFSET * 8 + - ALIGNED_FIRST_ELEMENT_SIZE + - (NUM_ELEMENTS - 2) * ALIGNED_ELEMENT_SIZE + PACKED_ARRAY_MAX_BIT_NUMBER + 1; + private static final int AUTO_INDEXED_OFFSET_ARRAY_BIT_SIZE = (int)ELEMENT0_OFFSET * 8 + + ALIGNED_FIRST_ELEMENT_SIZE + (NUM_ELEMENTS - 2) * ALIGNED_ELEMENT_SIZE + + PACKED_ARRAY_MAX_BIT_NUMBER + 1; } diff --git a/test/language/indexed_offsets/java/indexed_offsets/PackedIndexedOffsetArrayHolderTest.java b/test/language/indexed_offsets/java/indexed_offsets/PackedIndexedOffsetArrayHolderTest.java index 6547c2bef..0a97805e8 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/PackedIndexedOffsetArrayHolderTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/PackedIndexedOffsetArrayHolderTest.java @@ -1,21 +1,22 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; - -import indexed_offsets.packed_indexed_offset_array_holder.AutoIndexedOffsetArray; -import indexed_offsets.packed_indexed_offset_array_holder.OffsetArray; -import indexed_offsets.packed_indexed_offset_array_holder.OffsetHolder; import java.io.File; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.packed_indexed_offset_array_holder.AutoIndexedOffsetArray; +import indexed_offsets.packed_indexed_offset_array_holder.OffsetArray; +import indexed_offsets.packed_indexed_offset_array_holder.OffsetHolder; + public class PackedIndexedOffsetArrayHolderTest { @Test @@ -79,9 +80,11 @@ private void checkBitSizeOf(int numElements) throws IOException, ZserioError final int packedBitsizeOf = autoIndexedOffsetArray.bitSizeOf(); final double minCompressionRatio = 0.82; - assertTrue(unpackedBitsizeOf * minCompressionRatio > packedBitsizeOf, () -> - "Unpacked array has " + unpackedBitsizeOf + " bits, packed array has " + packedBitsizeOf + - " bits, " + "compression ratio is " + packedBitsizeOf * 100.0 / unpackedBitsizeOf + "%!"); + assertTrue(unpackedBitsizeOf * minCompressionRatio > packedBitsizeOf, + () + -> "Unpacked array has " + unpackedBitsizeOf + " bits, packed array has " + + packedBitsizeOf + " bits, " + + "compression ratio is " + packedBitsizeOf * 100.0 / unpackedBitsizeOf + "%!"); } private void checkWriteRead(int numElements) throws IOException, ZserioError @@ -94,8 +97,8 @@ private void checkWriteRead(int numElements) throws IOException, ZserioError assertEquals(autoIndexedOffsetArray.bitSizeOf(), writtenBitPosition); assertEquals(autoIndexedOffsetArray.initializeOffsets(), writtenBitPosition); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final AutoIndexedOffsetArray readAutoIndexedOffsetArray = new AutoIndexedOffsetArray(reader); assertEquals(autoIndexedOffsetArray, readAutoIndexedOffsetArray); } @@ -106,8 +109,8 @@ private void checkWriteReadFile(int numElements) throws IOException, ZserioError final File file = new File(BLOB_NAME_BASE + numElements + ".blob"); SerializeUtil.serializeToFile(autoIndexedOffsetArray, file); - final AutoIndexedOffsetArray readAutoIndexedOffsetArray = SerializeUtil.deserializeFromFile( - AutoIndexedOffsetArray.class, file); + final AutoIndexedOffsetArray readAutoIndexedOffsetArray = + SerializeUtil.deserializeFromFile(AutoIndexedOffsetArray.class, file); assertEquals(autoIndexedOffsetArray, readAutoIndexedOffsetArray); } diff --git a/test/language/indexed_offsets/java/indexed_offsets/VarInt32IndexedOffsetArrayTest.java b/test/language/indexed_offsets/java/indexed_offsets/VarInt32IndexedOffsetArrayTest.java index 78ed97187..497da9b40 100644 --- a/test/language/indexed_offsets/java/indexed_offsets/VarInt32IndexedOffsetArrayTest.java +++ b/test/language/indexed_offsets/java/indexed_offsets/VarInt32IndexedOffsetArrayTest.java @@ -1,11 +1,10 @@ package indexed_offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import indexed_offsets.varint32_indexed_offset_array.VarInt32IndexedOffsetArray; +import org.junit.jupiter.api.Test; import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.ZserioError; @@ -16,6 +15,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import indexed_offsets.varint32_indexed_offset_array.VarInt32IndexedOffsetArray; + public class VarInt32IndexedOffsetArrayTest { @Test @@ -92,8 +93,8 @@ public void writeRead() throws IOException, ZserioError final BitBuffer bitBuffer = SerializeUtil.serialize(varint32IndexedOffsetArray); checkVarInt32IndexedOffsetArray(varint32IndexedOffsetArray); - final VarInt32IndexedOffsetArray readVarint32IndexedOffsetArray = SerializeUtil.deserialize( - VarInt32IndexedOffsetArray.class, bitBuffer); + final VarInt32IndexedOffsetArray readVarint32IndexedOffsetArray = + SerializeUtil.deserialize(VarInt32IndexedOffsetArray.class, bitBuffer); checkVarInt32IndexedOffsetArray(readVarint32IndexedOffsetArray); assertTrue(varint32IndexedOffsetArray.equals(readVarint32IndexedOffsetArray)); } @@ -112,8 +113,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(varint32IndexedOffsetArray, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final VarInt32IndexedOffsetArray readVarint32IndexedOffsetArray = new VarInt32IndexedOffsetArray(reader); @@ -216,9 +217,9 @@ private long getVarInt32IndexedOffsetArrayBitSize() } private static final short NUM_ELEMENTS = (short)5; - private static final long WRONG_OFFSET = (long)0; + private static final long WRONG_OFFSET = (long)0; - private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; + private static final long ELEMENT0_OFFSET = (long)(NUM_ELEMENTS * Integer.SIZE + Byte.SIZE) / Byte.SIZE; - private static final byte SPACER_VALUE = 1; + private static final byte SPACER_VALUE = 1; } diff --git a/test/language/literals/build.xml b/test/language/literals/build.xml index 7b810398a..09e6e6aee 100644 --- a/test/language/literals/build.xml +++ b/test/language/literals/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/literals/java/literals/LiteralsTest.java b/test/language/literals/java/literals/LiteralsTest.java index b7162e541..a953fd74d 100644 --- a/test/language/literals/java/literals/LiteralsTest.java +++ b/test/language/literals/java/literals/LiteralsTest.java @@ -1,6 +1,7 @@ package literals; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; public class LiteralsTest diff --git a/test/language/member_access/build.xml b/test/language/member_access/build.xml index 0274f4877..ec015192c 100644 --- a/test/language/member_access/build.xml +++ b/test/language/member_access/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/member_access/java/member_access/AccessWithinTypeTest.java b/test/language/member_access/java/member_access/AccessWithinTypeTest.java index 465290f30..74cac3a8a 100644 --- a/test/language/member_access/java/member_access/AccessWithinTypeTest.java +++ b/test/language/member_access/java/member_access/AccessWithinTypeTest.java @@ -1,12 +1,10 @@ package member_access; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import member_access.access_within_type.Header; -import member_access.access_within_type.Message; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -16,6 +14,9 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import member_access.access_within_type.Header; +import member_access.access_within_type.Message; + public class AccessWithinTypeTest { @Test @@ -103,6 +104,6 @@ private Message createMessage(int numSentences, boolean wrongArrayLength) return new Message(header, sentences); } - private static final int VERSION_VALUE = 0xAB; + private static final int VERSION_VALUE = 0xAB; private static final String SENTENCE_PREFIX = "This is sentence #"; } diff --git a/test/language/offsets/build.xml b/test/language/offsets/build.xml index 6a33d0864..220401cd3 100644 --- a/test/language/offsets/build.xml +++ b/test/language/offsets/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/offsets/java/offsets/AutoArrayOffsetTest.java b/test/language/offsets/java/offsets/AutoArrayOffsetTest.java index 6b34f5f81..406811c66 100644 --- a/test/language/offsets/java/offsets/AutoArrayOffsetTest.java +++ b/test/language/offsets/java/offsets/AutoArrayOffsetTest.java @@ -1,11 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.auto_array_offset.AutoArrayHolder; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import offsets.auto_array_offset.AutoArrayHolder; + public class AutoArrayOffsetTest { @Test @@ -97,8 +98,8 @@ public void writeReadWithPosition() throws IOException, ZserioError autoArrayHolder.write(writer); checkAutoArrayHolder(autoArrayHolder, bitPosition); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final AutoArrayHolder readAutoArrayHolder = new AutoArrayHolder(reader); checkAutoArrayHolder(readAutoArrayHolder, bitPosition); @@ -136,8 +137,8 @@ private void checkAutoArrayHolder(AutoArrayHolder autoArrayHolder) private void checkAutoArrayHolder(AutoArrayHolder autoArrayHolder, int bitPosition) { - final long expectedAutoArrayOffset = (bitPosition == 0) ? AUTO_ARRAY_OFFSET : - AUTO_ARRAY_OFFSET + (bitPosition / 8); + final long expectedAutoArrayOffset = + (bitPosition == 0) ? AUTO_ARRAY_OFFSET : AUTO_ARRAY_OFFSET + (bitPosition / 8); assertEquals(expectedAutoArrayOffset, autoArrayHolder.getAutoArrayOffset()); assertEquals(FORCED_ALIGNMENT_VALUE, autoArrayHolder.getForceAlignment()); @@ -158,11 +159,11 @@ private AutoArrayHolder createAutoArrayHolder(boolean createWrongOffset) return new AutoArrayHolder(autoArrayOffset, FORCED_ALIGNMENT_VALUE, autoArray); } - private static final int AUTO_ARRAY_LENGTH = 5; - private static final byte FORCED_ALIGNMENT_VALUE = 0; + private static final int AUTO_ARRAY_LENGTH = 5; + private static final byte FORCED_ALIGNMENT_VALUE = 0; - private static final long WRONG_AUTO_ARRAY_OFFSET = 0; - private static final long AUTO_ARRAY_OFFSET = 5; + private static final long WRONG_AUTO_ARRAY_OFFSET = 0; + private static final long AUTO_ARRAY_OFFSET = 5; - private static final int AUTO_ARRAY_HOLDER_BIT_SIZE = 32 + 1 + 7 + 8 + AUTO_ARRAY_LENGTH * 7; + private static final int AUTO_ARRAY_HOLDER_BIT_SIZE = 32 + 1 + 7 + 8 + AUTO_ARRAY_LENGTH * 7; } diff --git a/test/language/offsets/java/offsets/BitOffsetTest.java b/test/language/offsets/java/offsets/BitOffsetTest.java index f0d1752b9..cf2fe43a5 100644 --- a/test/language/offsets/java/offsets/BitOffsetTest.java +++ b/test/language/offsets/java/offsets/BitOffsetTest.java @@ -1,11 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.bit_offset.BitOffset; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import offsets.bit_offset.BitOffset; + public class BitOffsetTest { @Test @@ -22,7 +23,7 @@ public void read() throws IOException, ZserioError { final boolean writeWrongOffsets = false; final BitBuffer bitBuffer = writeBitOffsetToBitBuffer(writeWrongOffsets); - final BitStreamReader reader= new ByteArrayBitStreamReader(bitBuffer); + final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); final BitOffset bitOffset = new BitOffset(); bitOffset.read(reader); checkBitOffset(bitOffset); @@ -102,8 +103,8 @@ public void writeReadWithPosition() throws IOException, ZserioError final short offsetShift = 1; checkOffsets(bitOffset, offsetShift); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final BitOffset readBitOffset = new BitOffset(reader); checkOffsets(readBitOffset, offsetShift); @@ -243,29 +244,29 @@ private BitOffset createBitOffset(boolean createWrongOffsets) private static final int BIT_OFFSET_BIT_SIZE = 192; private static final short WRONG_FIELD1_OFFSET = (short)0; - private static final int WRONG_FIELD2_OFFSET = (int)0; - private static final long WRONG_FIELD3_OFFSET = (long)0; + private static final int WRONG_FIELD2_OFFSET = (int)0; + private static final long WRONG_FIELD3_OFFSET = (long)0; private static final short WRONG_FIELD4_OFFSET = (short)0; private static final short WRONG_FIELD5_OFFSET = (short)0; - private static final int WRONG_FIELD6_OFFSET = (int)0; - private static final int WRONG_FIELD7_OFFSET = (int)0; + private static final int WRONG_FIELD6_OFFSET = (int)0; + private static final int WRONG_FIELD7_OFFSET = (int)0; private static final short WRONG_FIELD8_OFFSET = (short)0; private static final short FIELD1_OFFSET = (short)16; - private static final int FIELD2_OFFSET = (int)17; - private static final long FIELD3_OFFSET = (long)18; + private static final int FIELD2_OFFSET = (int)17; + private static final long FIELD3_OFFSET = (long)18; private static final short FIELD4_OFFSET = (short)19; private static final short FIELD5_OFFSET = (short)20; - private static final int FIELD6_OFFSET = (int)21; - private static final int FIELD7_OFFSET = (int)22; + private static final int FIELD6_OFFSET = (int)21; + private static final int FIELD7_OFFSET = (int)22; private static final short FIELD8_OFFSET = (short)23; - private static final byte FIELD1_VALUE = (byte)1; - private static final byte FIELD2_VALUE = (byte)2; - private static final byte FIELD3_VALUE = (byte)5; - private static final byte FIELD4_VALUE = (byte)13; - private static final byte FIELD5_VALUE = (byte)26; - private static final byte FIELD6_VALUE = (byte)56; - private static final byte FIELD7_VALUE = (byte)88; + private static final byte FIELD1_VALUE = (byte)1; + private static final byte FIELD2_VALUE = (byte)2; + private static final byte FIELD3_VALUE = (byte)5; + private static final byte FIELD4_VALUE = (byte)13; + private static final byte FIELD5_VALUE = (byte)26; + private static final byte FIELD6_VALUE = (byte)56; + private static final byte FIELD7_VALUE = (byte)88; private static final short FIELD8_VALUE = (short)222; } diff --git a/test/language/offsets/java/offsets/NestedOffsetTest.java b/test/language/offsets/java/offsets/NestedOffsetTest.java index ca2084513..e754888dc 100644 --- a/test/language/offsets/java/offsets/NestedOffsetTest.java +++ b/test/language/offsets/java/offsets/NestedOffsetTest.java @@ -1,15 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.nested_offset.NestedOffset; -import offsets.nested_offset.NestedOffsetArrayStructure; -import offsets.nested_offset.NestedOffsetChoice; -import offsets.nested_offset.NestedOffsetStructure; -import offsets.nested_offset.NestedOffsetUnion; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -19,6 +14,12 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import offsets.nested_offset.NestedOffset; +import offsets.nested_offset.NestedOffsetArrayStructure; +import offsets.nested_offset.NestedOffsetChoice; +import offsets.nested_offset.NestedOffsetStructure; +import offsets.nested_offset.NestedOffsetUnion; + public class NestedOffsetTest { @Test @@ -73,7 +74,7 @@ public void initializeOffsetsWithPosition() final boolean createWrongOffsets = true; final NestedOffset nestedOffset = createNestedOffset(createWrongOffsets); final int bitPosition = 2; - assertEquals(NEST_OFFSET_BIT_SIZE , nestedOffset.initializeOffsets(bitPosition)); + assertEquals(NEST_OFFSET_BIT_SIZE, nestedOffset.initializeOffsets(bitPosition)); checkNestedOffset(nestedOffset); } @@ -102,8 +103,8 @@ public void writeReadWithPosition() throws IOException, ZserioError nestedOffset.write(writer); checkNestedOffset(nestedOffset); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final NestedOffset readNestedOffset = new NestedOffset(reader); checkNestedOffset(readNestedOffset); @@ -189,8 +190,8 @@ private NestedOffset createNestedOffset(boolean createWrongOffsets) nestedOffsetChoice.setNestedOffsetUnion(nestedOffsetUnion); final long terminatorOffset = (createWrongOffsets) ? WRONG_TERMINATOR_OFFSET : TERMINATOR_OFFSET; - final NestedOffset nestedOffset = new NestedOffset(terminatorOffset, BOOL_VALUE, nestedOffsetChoice, - TERMINATOR_VALUE); + final NestedOffset nestedOffset = + new NestedOffset(terminatorOffset, BOOL_VALUE, nestedOffsetChoice, TERMINATOR_VALUE); return nestedOffset; } diff --git a/test/language/offsets/java/offsets/OptionalMemberOffsetTest.java b/test/language/offsets/java/offsets/OptionalMemberOffsetTest.java index cdb263f9f..6df880e19 100644 --- a/test/language/offsets/java/offsets/OptionalMemberOffsetTest.java +++ b/test/language/offsets/java/offsets/OptionalMemberOffsetTest.java @@ -1,11 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.optional_member_offset.OptionalMemberOffset; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -14,6 +13,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import offsets.optional_member_offset.OptionalMemberOffset; + public class OptionalMemberOffsetTest { @Test @@ -22,13 +23,13 @@ public void readWithOptional() throws IOException, ZserioError final boolean hasOptional = true; final int optionalField = 0x1212; final int field = 0x2121; - final BitBuffer bitBuffer = writeOptionalMemberOffsetToBitBuffer( - hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); - final BitStreamReader reader= new ByteArrayBitStreamReader(bitBuffer); + final BitBuffer bitBuffer = + writeOptionalMemberOffsetToBitBuffer(hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); + final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(); optionalMemberOffset.read(reader); - checkOptionalMemberOffset(optionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, - field); + checkOptionalMemberOffset( + optionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); } @Test @@ -37,8 +38,8 @@ public void readWithoutOptional() throws IOException, ZserioError final boolean hasOptional = false; final long optionalFieldOffset = 0xABCD; final int field = 0x2121; - final BitBuffer bitBuffer = writeOptionalMemberOffsetToBitBuffer( - hasOptional, optionalFieldOffset, null, field); + final BitBuffer bitBuffer = + writeOptionalMemberOffsetToBitBuffer(hasOptional, optionalFieldOffset, null, field); final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(); optionalMemberOffset.read(reader); @@ -48,8 +49,8 @@ public void readWithoutOptional() throws IOException, ZserioError @Test public void bitSizeOfWithOptional() { - final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(true, OPTIONAL_FIELD_OFFSET, - 0x1010, 0x2020); + final OptionalMemberOffset optionalMemberOffset = + new OptionalMemberOffset(true, OPTIONAL_FIELD_OFFSET, 0x1010, 0x2020); assertEquals(WITH_OPTIONAL_MEMBER_OFFSET_BIT_SIZE, optionalMemberOffset.bitSizeOf()); } @@ -66,12 +67,12 @@ public void initializeOffsetsWithOptional() final boolean hasOptional = true; final int optionalField = 0x1010; final int field = 0x2020; - final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(hasOptional, - WRONG_OPTIONAL_FIELD_OFFSET, optionalField, field); + final OptionalMemberOffset optionalMemberOffset = + new OptionalMemberOffset(hasOptional, WRONG_OPTIONAL_FIELD_OFFSET, optionalField, field); final int bitPosition = 2; assertEquals(WITH_OPTIONAL_MEMBER_OFFSET_BIT_SIZE, optionalMemberOffset.initializeOffsets(bitPosition)); - checkOptionalMemberOffset(optionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, - field); + checkOptionalMemberOffset( + optionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); } @Test @@ -80,8 +81,8 @@ public void initializeOffsetsWithoutOptional() final boolean hasOptional = false; final long optionalFieldOffset = 0xABCD; final int field = 0x2020; - final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(hasOptional, - optionalFieldOffset, null, field); + final OptionalMemberOffset optionalMemberOffset = + new OptionalMemberOffset(hasOptional, optionalFieldOffset, null, field); final int bitPosition = 2; assertEquals(WITHOUT_OPTIONAL_MEMBER_OFFSET_BIT_SIZE + bitPosition, optionalMemberOffset.initializeOffsets(bitPosition)); @@ -94,15 +95,15 @@ public void writeReadWithOptional() throws IOException, ZserioError final boolean hasOptional = true; final int optionalField = 0x1A1A; final int field = 0xA1A1; - final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(hasOptional, - OPTIONAL_FIELD_OFFSET, optionalField, field); + final OptionalMemberOffset optionalMemberOffset = + new OptionalMemberOffset(hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); final BitBuffer bitBuffer = SerializeUtil.serialize(optionalMemberOffset); - checkOptionalMemberOffset(optionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, - field); - final OptionalMemberOffset readOptionalMemberOffset = SerializeUtil.deserialize( - OptionalMemberOffset.class, bitBuffer); - checkOptionalMemberOffset(readOptionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, - field); + checkOptionalMemberOffset( + optionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); + final OptionalMemberOffset readOptionalMemberOffset = + SerializeUtil.deserialize(OptionalMemberOffset.class, bitBuffer); + checkOptionalMemberOffset( + readOptionalMemberOffset, hasOptional, OPTIONAL_FIELD_OFFSET, optionalField, field); assertTrue(optionalMemberOffset.equals(readOptionalMemberOffset)); } @@ -112,20 +113,20 @@ public void writeWithoutOptional() throws IOException, ZserioError final boolean hasOptional = false; final long optionalFieldOffset = 0xABCE; final int field = 0x7ACF; - final OptionalMemberOffset optionalMemberOffset = new OptionalMemberOffset(hasOptional, - optionalFieldOffset, null, field); + final OptionalMemberOffset optionalMemberOffset = + new OptionalMemberOffset(hasOptional, optionalFieldOffset, null, field); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); optionalMemberOffset.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OptionalMemberOffset readOptionalMemberOffset = new OptionalMemberOffset(reader); checkOptionalMemberOffset(readOptionalMemberOffset, hasOptional, optionalFieldOffset, null, field); assertTrue(optionalMemberOffset.equals(readOptionalMemberOffset)); } - private BitBuffer writeOptionalMemberOffsetToBitBuffer(boolean hasOptional, long optionalFieldOffset, - Integer optionalField, int field) throws IOException + private BitBuffer writeOptionalMemberOffsetToBitBuffer( + boolean hasOptional, long optionalFieldOffset, Integer optionalField, int field) throws IOException { try (final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter()) { diff --git a/test/language/offsets/java/offsets/PackedAutoArrayOffsetTest.java b/test/language/offsets/java/offsets/PackedAutoArrayOffsetTest.java index 78db735af..3179925d0 100644 --- a/test/language/offsets/java/offsets/PackedAutoArrayOffsetTest.java +++ b/test/language/offsets/java/offsets/PackedAutoArrayOffsetTest.java @@ -1,11 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.packed_auto_array_offset.AutoArrayHolder; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import offsets.packed_auto_array_offset.AutoArrayHolder; + public class PackedAutoArrayOffsetTest { @Test @@ -22,7 +23,7 @@ public void read() throws IOException, ZserioError { final boolean writeWrongOffset = false; final BitBuffer bitBuffer = writeAutoArrayHolderToBitBuffer(writeWrongOffset); - final BitStreamReader reader= new ByteArrayBitStreamReader(bitBuffer); + final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer); final AutoArrayHolder autoArrayHolder = new AutoArrayHolder(); autoArrayHolder.read(reader); checkAutoArrayHolder(autoArrayHolder); @@ -85,8 +86,8 @@ public void writeReadFile() throws IOException, ZserioError final AutoArrayHolder autoArrayHolder = createAutoArrayHolder(createWrongOffset); SerializeUtil.serializeToFile(autoArrayHolder, BLOB_NAME); checkAutoArrayHolder(autoArrayHolder); - final AutoArrayHolder readAutoArrayHolder = SerializeUtil.deserializeFromFile(AutoArrayHolder.class, - BLOB_NAME); + final AutoArrayHolder readAutoArrayHolder = + SerializeUtil.deserializeFromFile(AutoArrayHolder.class, BLOB_NAME); checkAutoArrayHolder(readAutoArrayHolder); assertEquals(autoArrayHolder, readAutoArrayHolder); } @@ -103,8 +104,8 @@ public void writeReadWithPosition() throws IOException, ZserioError autoArrayHolder.write(writer); checkAutoArrayHolder(autoArrayHolder, bitPosition); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final AutoArrayHolder readAutoArrayHolder = new AutoArrayHolder(reader); checkAutoArrayHolder(readAutoArrayHolder, bitPosition); @@ -147,8 +148,8 @@ private void checkAutoArrayHolder(AutoArrayHolder autoArrayHolder) private void checkAutoArrayHolder(AutoArrayHolder autoArrayHolder, int bitPosition) { - final long expectedAutoArrayOffset = (bitPosition == 0) ? AUTO_ARRAY_OFFSET : - AUTO_ARRAY_OFFSET + (bitPosition / 8); + final long expectedAutoArrayOffset = + (bitPosition == 0) ? AUTO_ARRAY_OFFSET : AUTO_ARRAY_OFFSET + (bitPosition / 8); assertEquals(expectedAutoArrayOffset, autoArrayHolder.getAutoArrayOffset()); assertEquals(FORCED_ALIGNMENT_VALUE, autoArrayHolder.getForceAlignment()); @@ -185,12 +186,12 @@ private int calcAutoArrayHolderBitSize() private static final String BLOB_NAME = "packed_auto_array_offset.blob"; - private static final int AUTO_ARRAY_LENGTH = 5; - private static final byte FORCED_ALIGNMENT_VALUE = 0; + private static final int AUTO_ARRAY_LENGTH = 5; + private static final byte FORCED_ALIGNMENT_VALUE = 0; - private static final long WRONG_AUTO_ARRAY_OFFSET = 0; - private static final long AUTO_ARRAY_OFFSET = 5; + private static final long WRONG_AUTO_ARRAY_OFFSET = 0; + private static final long AUTO_ARRAY_OFFSET = 5; - private static final short PACKED_ARRAY_DELTA = 1; - private static final short PACKED_ARRAY_MAX_BIT_NUMBER = 1; + private static final short PACKED_ARRAY_DELTA = 1; + private static final short PACKED_ARRAY_MAX_BIT_NUMBER = 1; } diff --git a/test/language/offsets/java/offsets/ParameterOffsetTest.java b/test/language/offsets/java/offsets/ParameterOffsetTest.java index 845f65fa4..d76244729 100644 --- a/test/language/offsets/java/offsets/ParameterOffsetTest.java +++ b/test/language/offsets/java/offsets/ParameterOffsetTest.java @@ -1,13 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.parameter_offset.OffsetHolder; -import offsets.parameter_offset.Room; -import offsets.parameter_offset.School; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -17,6 +14,10 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import offsets.parameter_offset.OffsetHolder; +import offsets.parameter_offset.Room; +import offsets.parameter_offset.School; + public class ParameterOffsetTest { @Test @@ -100,8 +101,8 @@ public void writeReadWithPosition() throws IOException, ZserioError school.write(writer); checkSchool(school, bitPosition); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); assertEquals(0, reader.readBits(bitPosition)); final School readSchool = new School(reader); checkSchool(school, bitPosition); @@ -139,8 +140,7 @@ private void checkSchool(School school, int bitPosition) { assertEquals(SCHOOL_ID, school.getSchoolId()); - final long expectedRoomOffset = (bitPosition == 0) ? ROOM_OFFSET : - ROOM_OFFSET + (bitPosition / 8) + 1; + final long expectedRoomOffset = (bitPosition == 0) ? ROOM_OFFSET : ROOM_OFFSET + (bitPosition / 8) + 1; assertEquals(expectedRoomOffset, school.getOffsetHolder().getRoomOffset()); assertEquals(ROOM_ID, school.getRoom().getRoomId()); @@ -155,11 +155,11 @@ private School createSchool(boolean createWrongOffset) return new School(SCHOOL_ID, offsetHolder, room); } - private static final int SCHOOL_ID = 0x01; - private static final int ROOM_ID = 0x11; + private static final int SCHOOL_ID = 0x01; + private static final int ROOM_ID = 0x11; - private static final long WRONG_ROOM_OFFSET = 0; - private static final long ROOM_OFFSET = 6; + private static final long WRONG_ROOM_OFFSET = 0; + private static final long ROOM_OFFSET = 6; - private static final int SCHOOL_BIT_SIZE = (int)((ROOM_OFFSET + 2) * 8); + private static final int SCHOOL_BIT_SIZE = (int)((ROOM_OFFSET + 2) * 8); } diff --git a/test/language/offsets/java/offsets/TernaryOperatorOffsetTest.java b/test/language/offsets/java/offsets/TernaryOperatorOffsetTest.java index ed2b5c45c..a95f529b6 100644 --- a/test/language/offsets/java/offsets/TernaryOperatorOffsetTest.java +++ b/test/language/offsets/java/offsets/TernaryOperatorOffsetTest.java @@ -1,11 +1,10 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import offsets.ternary_operator_offset.TernaryOffset; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -14,6 +13,8 @@ import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import offsets.ternary_operator_offset.TernaryOffset; + public class TernaryOperatorOffsetTest { @Test @@ -98,8 +99,8 @@ private void checkTernaryOffset(TernaryOffset ternaryOffset, boolean isFirstOffs private TernaryOffset createTernaryOffset(boolean isFirstOffsetUsed, boolean createWrongOffset) { - final TernaryOffset ternaryOffset = new TernaryOffset(isFirstOffsetUsed, new long[] { - WRONG_FIELD_OFFSET, WRONG_FIELD_OFFSET}, FIELD_VALUE); + final TernaryOffset ternaryOffset = new TernaryOffset( + isFirstOffsetUsed, new long[] {WRONG_FIELD_OFFSET, WRONG_FIELD_OFFSET}, FIELD_VALUE); if (!createWrongOffset) ternaryOffset.initializeOffsets(); @@ -114,8 +115,8 @@ private void testOffset(boolean isFirstOffsetUsed) throws IOException, ZserioErr final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); ternaryOffset.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final TernaryOffset readTernaryOffset = new TernaryOffset(reader); checkTernaryOffset(readTernaryOffset, isFirstOffsetUsed); } @@ -140,6 +141,6 @@ private void testOffsetReadWrong(boolean isFirstOffsetUsed) throws IOException, } private static final long WRONG_FIELD_OFFSET = 0; - private static final long FIELD_OFFSET = (1 + 32 + 32 + /* align */ + 7) / 8; + private static final long FIELD_OFFSET = (1 + 32 + 32 + /* align */ +7) / 8; private static final int FIELD_VALUE = 0xABCD; } diff --git a/test/language/offsets/java/offsets/UInt64OffsetTest.java b/test/language/offsets/java/offsets/UInt64OffsetTest.java index 4e4fd1ea0..96ad6472f 100644 --- a/test/language/offsets/java/offsets/UInt64OffsetTest.java +++ b/test/language/offsets/java/offsets/UInt64OffsetTest.java @@ -1,12 +1,11 @@ package offsets; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; -import offsets.uint64_offset.UInt64Offset; +import org.junit.jupiter.api.Test; import zserio.runtime.BitPositionUtil; import zserio.runtime.BitSizeOfCalculator; @@ -15,6 +14,8 @@ import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import offsets.uint64_offset.UInt64Offset; + public class UInt64OffsetTest { @Test diff --git a/test/language/optional_members/build.xml b/test/language/optional_members/build.xml index 2aec0fb9c..a30c3dd9a 100644 --- a/test/language/optional_members/build.xml +++ b/test/language/optional_members/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/optional_members/java/optional_members/AutoOptionalTest.java b/test/language/optional_members/java/optional_members/AutoOptionalTest.java index da64c5237..9fd6aa02c 100644 --- a/test/language/optional_members/java/optional_members/AutoOptionalTest.java +++ b/test/language/optional_members/java/optional_members/AutoOptionalTest.java @@ -1,15 +1,17 @@ package optional_members; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import optional_members.auto_optional.Container; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.SerializeUtil; +import optional_members.auto_optional.Container; + public class AutoOptionalTest { @Test @@ -97,8 +99,8 @@ public void initializeOffsets() final Container container = new Container(); container.setNonOptionalInt(NON_OPTIONAL_INT_VALUE); final int bitPosition = 1; - assertEquals(bitPosition + CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL, - container.initializeOffsets(bitPosition)); + assertEquals( + bitPosition + CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL, container.initializeOffsets(bitPosition)); container.setAutoOptionalInt(AUTO_OPTIONAL_INT_VALUE); assertEquals(bitPosition + CONTAINER_BIT_SIZE_WITH_OPTIONAL, container.initializeOffsets(bitPosition)); @@ -111,8 +113,8 @@ public void writeRead() throws IOException container.setNonOptionalInt(NON_OPTIONAL_INT_VALUE); final BitBuffer nonOptionalBitBuffer = SerializeUtil.serialize(container); checkContainerInBitBuffer(nonOptionalBitBuffer, NON_OPTIONAL_INT_VALUE, null); - final Container readNonOptionalContainer = SerializeUtil.deserialize( - Container.class, nonOptionalBitBuffer); + final Container readNonOptionalContainer = + SerializeUtil.deserialize(Container.class, nonOptionalBitBuffer); assertEquals(NON_OPTIONAL_INT_VALUE, readNonOptionalContainer.getNonOptionalInt()); assertFalse(readNonOptionalContainer.isAutoOptionalIntSet()); assertFalse(readNonOptionalContainer.isAutoOptionalIntUsed()); @@ -120,31 +122,31 @@ public void writeRead() throws IOException container.setAutoOptionalInt(AUTO_OPTIONAL_INT_VALUE); final BitBuffer autoOptionalBitBuffer = SerializeUtil.serialize(container); checkContainerInBitBuffer(autoOptionalBitBuffer, NON_OPTIONAL_INT_VALUE, AUTO_OPTIONAL_INT_VALUE); - final Container readAutoOptionalContainer = SerializeUtil.deserialize( - Container.class, autoOptionalBitBuffer); + final Container readAutoOptionalContainer = + SerializeUtil.deserialize(Container.class, autoOptionalBitBuffer); assertEquals(NON_OPTIONAL_INT_VALUE, readAutoOptionalContainer.getNonOptionalInt()); assertTrue(readAutoOptionalContainer.isAutoOptionalIntSet()); assertTrue(readAutoOptionalContainer.isAutoOptionalIntUsed()); - assertEquals(AUTO_OPTIONAL_INT_VALUE, (int) readAutoOptionalContainer.getAutoOptionalInt()); + assertEquals(AUTO_OPTIONAL_INT_VALUE, (int)readAutoOptionalContainer.getAutoOptionalInt()); } - private static void checkContainerInBitBuffer(BitBuffer bitBuffer, int nonOptionalIntValue, - Integer autoOptionalIntValue) throws IOException + private static void checkContainerInBitBuffer( + BitBuffer bitBuffer, int nonOptionalIntValue, Integer autoOptionalIntValue) throws IOException { try (final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer)) { if (autoOptionalIntValue == null) { assertEquals(CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL, reader.getBufferBitSize()); - assertEquals(nonOptionalIntValue, (int) reader.readBits(32)); + assertEquals(nonOptionalIntValue, (int)reader.readBits(32)); assertEquals(0, reader.readBits(1)); } else { assertEquals(CONTAINER_BIT_SIZE_WITH_OPTIONAL, reader.getBufferBitSize()); - assertEquals(nonOptionalIntValue, (int) reader.readBits(32)); + assertEquals(nonOptionalIntValue, (int)reader.readBits(32)); assertEquals(1, reader.readBits(1)); - assertEquals((int) autoOptionalIntValue, (int) reader.readBits(32)); + assertEquals((int)autoOptionalIntValue, (int)reader.readBits(32)); } } } diff --git a/test/language/optional_members/java/optional_members/OptionalArrayRecursionTest.java b/test/language/optional_members/java/optional_members/OptionalArrayRecursionTest.java index 39ab9bf9f..dd97fff65 100644 --- a/test/language/optional_members/java/optional_members/OptionalArrayRecursionTest.java +++ b/test/language/optional_members/java/optional_members/OptionalArrayRecursionTest.java @@ -1,25 +1,27 @@ package optional_members; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; -import optional_members.optional_array_recursion.Employee; -import optional_members.optional_array_recursion.Title; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.SerializeUtil; +import optional_members.optional_array_recursion.Employee; +import optional_members.optional_array_recursion.Title; + public class OptionalArrayRecursionTest { @Test public void bitSizeOf() { - final Employee employee = createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, - Title.DEVELOPER); + final Employee employee = + createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); assertEquals(DEVELOPER1_BIT_SIZE, employee.bitSizeOf()); final Employee teamLead = createTeamLead(); @@ -29,8 +31,8 @@ public void bitSizeOf() @Test public void isTeamMembersSetAndUsed() { - final Employee employee = createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, - Title.DEVELOPER); + final Employee employee = + createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); assertFalse(employee.isTeamMembersSet()); assertFalse(employee.isTeamMembersUsed()); @@ -97,8 +99,8 @@ public void hashCodeMethod() @Test public void initializeOffsets() { - final Employee employee = createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, - Title.DEVELOPER); + final Employee employee = + createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); final int bitPosition = 1; assertEquals(bitPosition + DEVELOPER1_BIT_SIZE, employee.initializeOffsets(bitPosition)); @@ -109,8 +111,8 @@ public void initializeOffsets() @Test public void writeReadFileEmployee() throws IOException { - final Employee employee = createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, - Title.DEVELOPER); + final Employee employee = + createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); final File employeeFile = new File(BLOB_NAME_BASE + "employee.blob"); SerializeUtil.serializeToFile(employee, employeeFile); @@ -124,12 +126,12 @@ public void writeReadFileEmployee() throws IOException @Test public void writeReadEmployee() throws IOException { - final Employee employee = createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, - Title.DEVELOPER); + final Employee employee = + createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); final BitBuffer bitBuffer = SerializeUtil.serialize(employee); - checkEmployeeInBitBuffer(bitBuffer, - EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); + checkEmployeeInBitBuffer( + bitBuffer, EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); Employee readEmployee = SerializeUtil.deserialize(Employee.class, bitBuffer); assertEquals(EMPLOYEE_DEVELOPER1_NAME, readEmployee.getName()); @@ -179,12 +181,11 @@ private static Employee createEmployee(String name, int salary, Title title) private static Employee createTeamLead() { - final Employee teamLead = createEmployee(EMPLOYEE_TEAM_LEAD_NAME, EMPLOYEE_TEAM_LEAD_SALARY, - Title.TEAM_LEAD); + final Employee teamLead = + createEmployee(EMPLOYEE_TEAM_LEAD_NAME, EMPLOYEE_TEAM_LEAD_SALARY, Title.TEAM_LEAD); final Employee[] teamMembers = new Employee[] { createEmployee(EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER), - createEmployee(EMPLOYEE_DEVELOPER2_NAME, EMPLOYEE_DEVELOPER2_SALARY, Title.DEVELOPER) - }; + createEmployee(EMPLOYEE_DEVELOPER2_NAME, EMPLOYEE_DEVELOPER2_SALARY, Title.DEVELOPER)}; teamLead.setTeamMembers(teamMembers); return teamLead; @@ -211,13 +212,12 @@ private static void checkTeamLeadInBitBuffer(BitBuffer bitBuffer) throws IOExcep { try (final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer)) { - checkEmployeeInStream(reader, - EMPLOYEE_TEAM_LEAD_NAME, EMPLOYEE_TEAM_LEAD_SALARY, Title.TEAM_LEAD); + checkEmployeeInStream(reader, EMPLOYEE_TEAM_LEAD_NAME, EMPLOYEE_TEAM_LEAD_SALARY, Title.TEAM_LEAD); assertEquals(NUM_DEVELOPERS, reader.readVarUInt64()); - checkEmployeeInStream(reader, - EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); - checkEmployeeInStream(reader, - EMPLOYEE_DEVELOPER2_NAME, EMPLOYEE_DEVELOPER2_SALARY, Title.DEVELOPER); + checkEmployeeInStream( + reader, EMPLOYEE_DEVELOPER1_NAME, EMPLOYEE_DEVELOPER1_SALARY, Title.DEVELOPER); + checkEmployeeInStream( + reader, EMPLOYEE_DEVELOPER2_NAME, EMPLOYEE_DEVELOPER2_SALARY, Title.DEVELOPER); } } diff --git a/test/language/optional_members/java/optional_members/OptionalArrayTest.java b/test/language/optional_members/java/optional_members/OptionalArrayTest.java index d3bfa7406..bfac3942c 100644 --- a/test/language/optional_members/java/optional_members/OptionalArrayTest.java +++ b/test/language/optional_members/java/optional_members/OptionalArrayTest.java @@ -1,10 +1,11 @@ package optional_members; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import optional_members.optional_array.TestStruct; import optional_members.optional_array.Data8; +import optional_members.optional_array.TestStruct; public class OptionalArrayTest { diff --git a/test/language/optional_members/java/optional_members/OptionalExpressionTest.java b/test/language/optional_members/java/optional_members/OptionalExpressionTest.java index 9c3d58865..018dcaf18 100644 --- a/test/language/optional_members/java/optional_members/OptionalExpressionTest.java +++ b/test/language/optional_members/java/optional_members/OptionalExpressionTest.java @@ -1,17 +1,19 @@ package optional_members; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import optional_members.optional_expression.BasicColor; -import optional_members.optional_expression.BlackColor; -import optional_members.optional_expression.Container; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.SerializeUtil; +import optional_members.optional_expression.BasicColor; +import optional_members.optional_expression.BlackColor; +import optional_members.optional_expression.Container; + public class OptionalExpressionTest { @Test @@ -149,8 +151,8 @@ public void initializeOffsets() final Container container = new Container(); container.setBasicColor(BasicColor.WHITE); final int bitPosition = 1; - assertEquals(bitPosition + CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL, - container.initializeOffsets(bitPosition)); + assertEquals( + bitPosition + CONTAINER_BIT_SIZE_WITHOUT_OPTIONAL, container.initializeOffsets(bitPosition)); container.setBasicColor(BasicColor.BLACK); container.setNumBlackTones(NUM_BLACK_TONES); @@ -200,8 +202,8 @@ private static BlackColor createBlackColor(short numBlackTones) return blackColor; } - private static void checkContainerInBitBuffer(BitBuffer bitBuffer, BasicColor basicColor, - short numBlackTones) throws IOException + private static void checkContainerInBitBuffer( + BitBuffer bitBuffer, BasicColor basicColor, short numBlackTones) throws IOException { try (final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer)) { diff --git a/test/language/optional_members/java/optional_members/OptionalExpressionWithRemovedEnumItemTest.java b/test/language/optional_members/java/optional_members/OptionalExpressionWithRemovedEnumItemTest.java index ad28a6c67..7f54e9fa1 100644 --- a/test/language/optional_members/java/optional_members/OptionalExpressionWithRemovedEnumItemTest.java +++ b/test/language/optional_members/java/optional_members/OptionalExpressionWithRemovedEnumItemTest.java @@ -1,12 +1,14 @@ package optional_members; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import optional_members.optional_expression_with_removed_enum_item.Compound; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.SerializeUtil; +import optional_members.optional_expression_with_removed_enum_item.Compound; + public class OptionalExpressionWithRemovedEnumItemTest { @Test diff --git a/test/language/optional_members/java/optional_members/OptionalRecursionTest.java b/test/language/optional_members/java/optional_members/OptionalRecursionTest.java index c80ed84a1..b24e85ec0 100644 --- a/test/language/optional_members/java/optional_members/OptionalRecursionTest.java +++ b/test/language/optional_members/java/optional_members/OptionalRecursionTest.java @@ -1,16 +1,18 @@ package optional_members; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import optional_members.optional_recursion.Block; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.SerializeUtil; +import optional_members.optional_recursion.Block; + public class OptionalRecursionTest { @Test @@ -120,8 +122,8 @@ public void fileWriteBlock1() throws IOException final BitStreamReader reader = new ByteArrayBitStreamReader(block1BitBuffer); checkBlockInStream(reader, BLOCK1_DATA); - final Block readBlock1 = SerializeUtil.deserialize( - Block.class, block1BitBuffer, (short)BLOCK1_DATA.length); + final Block readBlock1 = + SerializeUtil.deserialize(Block.class, block1BitBuffer, (short)BLOCK1_DATA.length); assertEquals(block1, readBlock1); } @@ -133,8 +135,8 @@ public void fileWriteBlock12() throws IOException final BitStreamReader reader = new ByteArrayBitStreamReader(block12BitBuffer); checkBlockInStream(reader, BLOCK1_DATA, BLOCK2_DATA); - final Block readBlock12 = SerializeUtil.deserialize( - Block.class, block12BitBuffer, (short)BLOCK1_DATA.length); + final Block readBlock12 = + SerializeUtil.deserialize(Block.class, block12BitBuffer, (short)BLOCK1_DATA.length); assertEquals(block12, readBlock12); } diff --git a/test/language/packages/build.xml b/test/language/packages/build.xml index ace48685d..fae45c32f 100644 --- a/test/language/packages/build.xml +++ b/test/language/packages/build.xml @@ -27,7 +27,11 @@ - + + + + + diff --git a/test/language/packages/java/DefaultPackageTest.java b/test/language/packages/java/DefaultPackageTest.java index 335612cff..9910657e7 100644 --- a/test/language/packages/java/DefaultPackageTest.java +++ b/test/language/packages/java/DefaultPackageTest.java @@ -1,8 +1,9 @@ import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + public class DefaultPackageTest { @Test diff --git a/test/language/packages/java/index/IndexTest.java b/test/language/packages/java/index/IndexTest.java index 15bd8535a..548d7e6f4 100644 --- a/test/language/packages/java/index/IndexTest.java +++ b/test/language/packages/java/index/IndexTest.java @@ -1,10 +1,11 @@ package index; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.ByteArrayBitStreamReader; +import zserio.runtime.io.ByteArrayBitStreamWriter; public class IndexTest { @@ -26,8 +27,8 @@ public void readWrite() throws Exception test.initializeOffsets(writer.getBitPosition()); test.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final index.Test readTest = new index.Test(reader); assertEquals(ARRAY_SIZE, readTest.getArray().length); diff --git a/test/language/packages/java/package_name_conflict/PackageNameConflictTest.java b/test/language/packages/java/package_name_conflict/PackageNameConflictTest.java index 112e72801..0c79534a7 100644 --- a/test/language/packages/java/package_name_conflict/PackageNameConflictTest.java +++ b/test/language/packages/java/package_name_conflict/PackageNameConflictTest.java @@ -1,10 +1,11 @@ package package_name_conflict; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.ByteArrayBitStreamReader; +import zserio.runtime.io.ByteArrayBitStreamWriter; public class PackageNameConflictTest { @@ -17,8 +18,8 @@ public void packageNameConflictLocal() throws Exception final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); packageNameConflictLocal.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final PackageNameConflictLocal readPackageNameConflictLocal = new PackageNameConflictLocal(reader); assertEquals(13, packageNameConflictLocal.getBlob().getValue()); @@ -30,14 +31,14 @@ public void packageNameConflictLocal() throws Exception public void packageNameConflictImported() throws Exception { // just test that PackageNameConflictImported uses correct Blob - final PackageNameConflictImported packageNameConflictImported = new PackageNameConflictImported( - new package_name_conflict.package_name_conflict.Blob("test")); + final PackageNameConflictImported packageNameConflictImported = + new PackageNameConflictImported(new package_name_conflict.package_name_conflict.Blob("test")); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); packageNameConflictImported.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final PackageNameConflictImported readPackageNameConflictImported = new PackageNameConflictImported(reader); diff --git a/test/language/packages/java/reader/ReaderTest.java b/test/language/packages/java/reader/ReaderTest.java index d51f7310e..0477f7b04 100644 --- a/test/language/packages/java/reader/ReaderTest.java +++ b/test/language/packages/java/reader/ReaderTest.java @@ -1,10 +1,11 @@ package reader; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.ByteArrayBitStreamReader; +import zserio.runtime.io.ByteArrayBitStreamWriter; public class ReaderTest { @@ -26,8 +27,8 @@ public void readWrite() throws Exception test.initializeOffsets(writer.getBitPosition()); test.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final reader.Test readTest = new reader.Test(reader); assertEquals(ARRAY_SIZE, readTest.getArray().length); diff --git a/test/language/parameterized_types/build.xml b/test/language/parameterized_types/build.xml index 5ce7c5e79..3b63fed01 100644 --- a/test/language/parameterized_types/build.xml +++ b/test/language/parameterized_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/parameterized_types/java/parameterized_types/array_element_param/ArrayElementParamTest.java b/test/language/parameterized_types/java/parameterized_types/array_element_param/ArrayElementParamTest.java index 423301d4c..43cd16785 100644 --- a/test/language/parameterized_types/java/parameterized_types/array_element_param/ArrayElementParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/array_element_param/ArrayElementParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.array_element_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; diff --git a/test/language/parameterized_types/java/parameterized_types/array_element_param_with_optional/ArrayElementParamWithOptionalTest.java b/test/language/parameterized_types/java/parameterized_types/array_element_param_with_optional/ArrayElementParamWithOptionalTest.java index e0372ac84..079c50783 100644 --- a/test/language/parameterized_types/java/parameterized_types/array_element_param_with_optional/ArrayElementParamWithOptionalTest.java +++ b/test/language/parameterized_types/java/parameterized_types/array_element_param_with_optional/ArrayElementParamWithOptionalTest.java @@ -1,17 +1,18 @@ package parameterized_types.array_element_param_with_optional; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + +import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.BitSizeOfCalculator; public class ArrayElementParamWithOptionalTest { @@ -55,7 +56,7 @@ private Holder createHolder() final Param param = new Param(HAS_EXTRA, EXTRA_PARAM); final Value value = new Value(param, null, new ExtraValue(param.getExtraParam(), EXTRA_VALUE)); - return new Holder(param, new Value[] { value }); + return new Holder(param, new Value[] {value}); } private BitBuffer writeHolderToBitBuffer() throws IOException diff --git a/test/language/parameterized_types/java/parameterized_types/bytes_param/BytesParamTest.java b/test/language/parameterized_types/java/parameterized_types/bytes_param/BytesParamTest.java index 860bbbff0..740e13c0d 100644 --- a/test/language/parameterized_types/java/parameterized_types/bytes_param/BytesParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/bytes_param/BytesParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.bytes_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.SerializeUtil; diff --git a/test/language/parameterized_types/java/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamTest.java b/test/language/parameterized_types/java/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamTest.java index f23b2a2ea..d96f35daa 100644 --- a/test/language/parameterized_types/java/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.dynamic_bitfield_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -25,21 +26,22 @@ public void writeRead() throws IOException private DynamicBitfieldParamHolder createDynamicBitfieldParamHolder() { - final DynamicBitfieldParam dynamicBitfieldParam = new DynamicBitfieldParam(BITFIELD, - DYNAMIC_BITFIELD_PARAM_VALUE, DYNAMIC_BITFIELD_EXTRA_VALUE); + final DynamicBitfieldParam dynamicBitfieldParam = + new DynamicBitfieldParam(BITFIELD, DYNAMIC_BITFIELD_PARAM_VALUE, DYNAMIC_BITFIELD_EXTRA_VALUE); return new DynamicBitfieldParamHolder(LENGTH, BITFIELD, dynamicBitfieldParam); } - private void checkDynamicBitfieldParamHolderInBitBuffer(BitBuffer bitBuffer, - DynamicBitfieldParamHolder dynamicBitfieldParamHolder) throws IOException + private void checkDynamicBitfieldParamHolderInBitBuffer( + BitBuffer bitBuffer, DynamicBitfieldParamHolder dynamicBitfieldParamHolder) throws IOException { try (final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer)) { assertEquals(dynamicBitfieldParamHolder.getLength(), reader.readBits(4)); assertEquals(dynamicBitfieldParamHolder.getBitfield(), reader.readSignedBits(LENGTH)); - final DynamicBitfieldParam dynamicBitfieldParam = dynamicBitfieldParamHolder.getDynamicBitfieldParam(); + final DynamicBitfieldParam dynamicBitfieldParam = + dynamicBitfieldParamHolder.getDynamicBitfieldParam(); assertEquals(dynamicBitfieldParam.getParam(), BITFIELD); assertEquals(dynamicBitfieldParam.getValue(), reader.readBits(16)); assertEquals(dynamicBitfieldParam.getExtraValue(), reader.readBits(32)); diff --git a/test/language/parameterized_types/java/parameterized_types/extern_param/ExternParamTest.java b/test/language/parameterized_types/java/parameterized_types/extern_param/ExternParamTest.java index 0b333b348..08aa6952f 100644 --- a/test/language/parameterized_types/java/parameterized_types/extern_param/ExternParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/extern_param/ExternParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.extern_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.SerializeUtil; diff --git a/test/language/parameterized_types/java/parameterized_types/fixed_and_variable_param/FixedAndVariableParamTest.java b/test/language/parameterized_types/java/parameterized_types/fixed_and_variable_param/FixedAndVariableParamTest.java index 285dfb38a..836a0bd65 100644 --- a/test/language/parameterized_types/java/parameterized_types/fixed_and_variable_param/FixedAndVariableParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/fixed_and_variable_param/FixedAndVariableParamTest.java @@ -1,11 +1,12 @@ package parameterized_types.fixed_and_variable_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; @@ -19,34 +20,34 @@ public class FixedAndVariableParamTest @Test public void writeReadFile() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, - LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); SerializeUtil.serializeToFile(fixedAndVariableParam, BLOB_NAME); - final FixedAndVariableParam readFixedAndVariableParam = SerializeUtil.deserializeFromFile( - FixedAndVariableParam.class, BLOB_NAME); + final FixedAndVariableParam readFixedAndVariableParam = + SerializeUtil.deserializeFromFile(FixedAndVariableParam.class, BLOB_NAME); assertEquals(fixedAndVariableParam, readFixedAndVariableParam); } @Test public void writeRead() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, - LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); final BitBuffer bitBuffer = SerializeUtil.serialize(fixedAndVariableParam); - checkFixedAndVariableParamInBitBuffer(bitBuffer, fixedAndVariableParam, - ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + checkFixedAndVariableParamInBitBuffer( + bitBuffer, fixedAndVariableParam, ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); - final FixedAndVariableParam readFixedAndVariableParam = SerializeUtil.deserialize( - FixedAndVariableParam.class, bitBuffer); + final FixedAndVariableParam readFixedAndVariableParam = + SerializeUtil.deserialize(FixedAndVariableParam.class, bitBuffer); assertEquals(fixedAndVariableParam, readFixedAndVariableParam); } @Test public void writeFailureWrongArraySize() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(WRONG_ARRAY_SIZE, - EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(WRONG_ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); try (final BitStreamWriter writer = new ByteArrayBitStreamWriter()) { @@ -57,8 +58,8 @@ public void writeFailureWrongArraySize() throws IOException @Test public void writeFailureWrongExtraLimit() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, - EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setExtraLimit(WRONG_EXTRA_LIMIT); try (final BitStreamWriter writer = new ByteArrayBitStreamWriter()) @@ -70,8 +71,8 @@ public void writeFailureWrongExtraLimit() throws IOException @Test public void writeFailureWrongLimitHolder() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, - EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); final LimitHolder limitHolder = new LimitHolder(LIMIT); fixedAndVariableParam.setLimitHolder(limitHolder); @@ -84,8 +85,8 @@ public void writeFailureWrongLimitHolder() throws IOException @Test public void writeFailureWrongColor() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, - EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setColor(WRONG_COLOR); try (final BitStreamWriter writer = new ByteArrayBitStreamWriter()) @@ -97,8 +98,8 @@ public void writeFailureWrongColor() throws IOException @Test public void writeFailureWrongAccess() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, - EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setAccess(WRONG_ACCESS); try (final BitStreamWriter writer = new ByteArrayBitStreamWriter()) @@ -110,8 +111,8 @@ public void writeFailureWrongAccess() throws IOException @Test public void writeFailureWrongFloatValue() throws IOException { - final FixedAndVariableParam fixedAndVariableParam = createFixedAndVariableParam(ARRAY_SIZE, - EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); + final FixedAndVariableParam fixedAndVariableParam = + createFixedAndVariableParam(ARRAY_SIZE, EXTRA_LIMIT, LIMIT, COLOR, ACCESS, FLOAT_VALUE); fixedAndVariableParam.setFloatValue(WRONG_FLOAT_VALUE); try (final BitStreamWriter writer = new ByteArrayBitStreamWriter()) @@ -120,8 +121,8 @@ public void writeFailureWrongFloatValue() throws IOException } } - private ArrayHolder createArrayHolder(int size, short extraLimit, LimitHolder limitHolder, Color color, - Access access, float floatValue) + private ArrayHolder createArrayHolder( + int size, short extraLimit, LimitHolder limitHolder, Color color, Access access, float floatValue) { final BigInteger[] array = new BigInteger[size]; for (int i = 0; i < size; ++i) @@ -133,19 +134,19 @@ private ArrayHolder createArrayHolder(int size, short extraLimit, LimitHolder li hasBlack, hasRead, hasFloatBiggerThanOne); } - private FixedAndVariableParam createFixedAndVariableParam(int size, short extraLimit, short limit, - Color color, Access access, float floatValue) + private FixedAndVariableParam createFixedAndVariableParam( + int size, short extraLimit, short limit, Color color, Access access, float floatValue) { final LimitHolder limitHolder = new LimitHolder(limit); - final ArrayHolder arrayHolder = createArrayHolder(size, extraLimit, limitHolder, color, access, - floatValue); + final ArrayHolder arrayHolder = + createArrayHolder(size, extraLimit, limitHolder, color, access, floatValue); return new FixedAndVariableParam(extraLimit, limitHolder, color, access, floatValue, arrayHolder); } private void checkArrayHolderInStream(BitStreamReader reader, ArrayHolder arrayHolder, int size, short extraLimit, LimitHolder limitHolder, Color color, Access access, float floatValue) - throws IOException + throws IOException { assertEquals(arrayHolder.getSize(), size); assertEquals(arrayHolder.getExtraLimit(), extraLimit); @@ -172,8 +173,8 @@ private void checkFixedAndVariableParamInBitBuffer(BitBuffer bitBuffer, assertEquals(floatValue, reader.readFloat16()); final ArrayHolder arrayHolder = fixedAndVariableParam.getArrayHolder(); final LimitHolder limitHolder = fixedAndVariableParam.getLimitHolder(); - checkArrayHolderInStream(reader, arrayHolder, size, extraLimit, limitHolder, color, access, - floatValue); + checkArrayHolderInStream( + reader, arrayHolder, size, extraLimit, limitHolder, color, access, floatValue); } } diff --git a/test/language/parameterized_types/java/parameterized_types/grand_child_param/GrandChildParamTest.java b/test/language/parameterized_types/java/parameterized_types/grand_child_param/GrandChildParamTest.java index 8e69f0707..be67df685 100644 --- a/test/language/parameterized_types/java/parameterized_types/grand_child_param/GrandChildParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/grand_child_param/GrandChildParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.grand_child_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -18,8 +19,8 @@ public void writeReadFile() throws IOException final GrandChildParam grandChildParam = createGrandChildParam(); SerializeUtil.serializeToFile(grandChildParam, BLOB_NAME); - final GrandChildParam readGrandChildParam = SerializeUtil.deserializeFromFile( - GrandChildParam.class, BLOB_NAME); + final GrandChildParam readGrandChildParam = + SerializeUtil.deserializeFromFile(GrandChildParam.class, BLOB_NAME); assertEquals(grandChildParam, readGrandChildParam); } diff --git a/test/language/parameterized_types/java/parameterized_types/nested_parameterized_field/NestedParameterizedFieldTest.java b/test/language/parameterized_types/java/parameterized_types/nested_parameterized_field/NestedParameterizedFieldTest.java index 19dfef208..11e4266f8 100644 --- a/test/language/parameterized_types/java/parameterized_types/nested_parameterized_field/NestedParameterizedFieldTest.java +++ b/test/language/parameterized_types/java/parameterized_types/nested_parameterized_field/NestedParameterizedFieldTest.java @@ -1,10 +1,11 @@ package parameterized_types.nested_parameterized_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; diff --git a/test/language/parameterized_types/java/parameterized_types/packed_array_element_param/PackedArrayElementParamTest.java b/test/language/parameterized_types/java/parameterized_types/packed_array_element_param/PackedArrayElementParamTest.java index 889cb7d05..e02909766 100644 --- a/test/language/parameterized_types/java/parameterized_types/packed_array_element_param/PackedArrayElementParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/packed_array_element_param/PackedArrayElementParamTest.java @@ -1,12 +1,13 @@ package parameterized_types.packed_array_element_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -75,9 +76,11 @@ private void checkBitSizeOf(int numBlocks) throws IOException, ZserioError final int packedBitsizeOf = database.bitSizeOf(); final double minCompressionRatio = 0.12; - assertTrue(unpackedBitsizeOf * minCompressionRatio > packedBitsizeOf, () -> - "Unpacked array has " + unpackedBitsizeOf + " bits, packed array has " + packedBitsizeOf + - " bits, " + "compression ratio is " + packedBitsizeOf * 100.0 / unpackedBitsizeOf + "%!"); + assertTrue(unpackedBitsizeOf * minCompressionRatio > packedBitsizeOf, + () + -> "Unpacked array has " + unpackedBitsizeOf + " bits, packed array has " + + packedBitsizeOf + " bits, " + + "compression ratio is " + packedBitsizeOf * 100.0 / unpackedBitsizeOf + "%!"); } private void checkWriteRead(int numBlocks) throws IOException, ZserioError @@ -92,8 +95,8 @@ private void checkWriteRead(int numBlocks) throws IOException, ZserioError assertEquals(database.bitSizeOf(), writtenBitPosition); assertEquals(database.initializeOffsets(), writtenBitPosition); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final Database readDatabase = new Database(reader); assertEquals(database, readDatabase); } diff --git a/test/language/parameterized_types/java/parameterized_types/param_with_optional/ParamWithOptionalTest.java b/test/language/parameterized_types/java/parameterized_types/param_with_optional/ParamWithOptionalTest.java index f1b92d4e7..053c631ad 100644 --- a/test/language/parameterized_types/java/parameterized_types/param_with_optional/ParamWithOptionalTest.java +++ b/test/language/parameterized_types/java/parameterized_types/param_with_optional/ParamWithOptionalTest.java @@ -1,12 +1,13 @@ package parameterized_types.param_with_optional; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; import java.math.BigInteger; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; import zserio.runtime.io.ByteArrayBitStreamWriter; diff --git a/test/language/parameterized_types/java/parameterized_types/parameterized_inner_classes_clashing/ParameterizedInnerClassesClashingTest.java b/test/language/parameterized_types/java/parameterized_types/parameterized_inner_classes_clashing/ParameterizedInnerClassesClashingTest.java index b614a281f..63fbed36d 100644 --- a/test/language/parameterized_types/java/parameterized_types/parameterized_inner_classes_clashing/ParameterizedInnerClassesClashingTest.java +++ b/test/language/parameterized_types/java/parameterized_types/parameterized_inner_classes_clashing/ParameterizedInnerClassesClashingTest.java @@ -1,10 +1,11 @@ package parameterized_types.parameterized_inner_classes_clashing; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -15,15 +16,14 @@ public class ParameterizedInnerClassesClashingTest public void writeReadElementFactory() throws IOException, ZserioError { final long param = 100; - final ElementFactory_array testStructure = new ElementFactory_array(param, - new Compound[] { new Compound(param, 13), new Compound(param, 42) } - ); + final ElementFactory_array testStructure = new ElementFactory_array( + param, new Compound[] {new Compound(param, 13), new Compound(param, 42)}); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final ElementFactory_array readTestStructure = new ElementFactory_array(reader); assertEquals(testStructure, readTestStructure); } @@ -32,15 +32,14 @@ public void writeReadElementFactory() throws IOException, ZserioError public void writeReadElementInitializer() throws IOException, ZserioError { final long param = 100; - final ElementInitializer_array testStructure = new ElementInitializer_array(param, - new Compound[] { new Compound(param, 13), new Compound(param, 42) } - ); + final ElementInitializer_array testStructure = new ElementInitializer_array( + param, new Compound[] {new Compound(param, 13), new Compound(param, 42)}); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final ElementInitializer_array readTestStructure = new ElementInitializer_array(reader); assertEquals(testStructure, readTestStructure); } @@ -49,18 +48,15 @@ public void writeReadElementInitializer() throws IOException, ZserioError public void writeReadElementChildrenInitializer() throws IOException, ZserioError { final long param = 100; - final ElementChildrenInitializer_array testStructure = new ElementChildrenInitializer_array( - new Parent[] { - new Parent(param, new Compound(param, 13)), - new Parent(param, new Compound(param, 42)) - } - ); + final ElementChildrenInitializer_array testStructure = + new ElementChildrenInitializer_array(new Parent[] {new Parent(param, new Compound(param, 13)), + new Parent(param, new Compound(param, 42))}); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final ElementChildrenInitializer_array readTestStructure = new ElementChildrenInitializer_array(reader); assertEquals(testStructure, readTestStructure); } diff --git a/test/language/parameterized_types/java/parameterized_types/parameterized_param/ParameterizedParamTest.java b/test/language/parameterized_types/java/parameterized_types/parameterized_param/ParameterizedParamTest.java index 96ce2fa2d..674a3ab76 100644 --- a/test/language/parameterized_types/java/parameterized_types/parameterized_param/ParameterizedParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/parameterized_param/ParameterizedParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.parameterized_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -27,14 +28,14 @@ public void writeRead() throws IOException private ParameterizedParamHolder createParameterizedParamHolder() { final Param param = new Param(PARAMETER, PARAM_VALUE, PARAM_EXTRA_VALUE); - final ParameterizedParam parameterizedParam = new ParameterizedParam(param, PARAMETERIZED_PARAM_VALUE, - PARAMETERIZED_PARAM_EXTRA_VALUE); + final ParameterizedParam parameterizedParam = + new ParameterizedParam(param, PARAMETERIZED_PARAM_VALUE, PARAMETERIZED_PARAM_EXTRA_VALUE); return new ParameterizedParamHolder(PARAMETER, param, parameterizedParam); } - private void checkParameterizedParamHolderInBitBuffer(BitBuffer bitBuffer, ParameterizedParamHolder - parameterizedParamHolder) throws IOException + private void checkParameterizedParamHolderInBitBuffer( + BitBuffer bitBuffer, ParameterizedParamHolder parameterizedParamHolder) throws IOException { try (final BitStreamReader reader = new ByteArrayBitStreamReader(bitBuffer)) { diff --git a/test/language/parameterized_types/java/parameterized_types/simple_param/SimpleParamTest.java b/test/language/parameterized_types/java/parameterized_types/simple_param/SimpleParamTest.java index a5193c1e2..9dc4a4e6a 100644 --- a/test/language/parameterized_types/java/parameterized_types/simple_param/SimpleParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/simple_param/SimpleParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.simple_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; diff --git a/test/language/parameterized_types/java/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamTest.java b/test/language/parameterized_types/java/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamTest.java index c37211bd6..76bf797aa 100644 --- a/test/language/parameterized_types/java/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamTest.java +++ b/test/language/parameterized_types/java/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamTest.java @@ -1,10 +1,11 @@ package parameterized_types.subtyped_bitfield_param; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitBuffer; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; @@ -25,14 +26,14 @@ public void writeRead() throws IOException private SubtypedBitfieldParamHolder createSubtypedBitfieldParamHolder() { - final SubtypedBitfieldParam subtypedBitfieldParam = new SubtypedBitfieldParam(SUBTYPED_BITFIELD_PARAM, - SUBTYPED_BITFIELD_PARAM_VALUE, SUBTYPED_BITFIELD_PARAM_EXTRA_VALUE); + final SubtypedBitfieldParam subtypedBitfieldParam = new SubtypedBitfieldParam( + SUBTYPED_BITFIELD_PARAM, SUBTYPED_BITFIELD_PARAM_VALUE, SUBTYPED_BITFIELD_PARAM_EXTRA_VALUE); return new SubtypedBitfieldParamHolder(subtypedBitfieldParam); } - private void checkSubtypedBitfieldParamHolderInBitBuffer(BitBuffer bitBuffer, SubtypedBitfieldParamHolder - subtypedBitfieldParamHolder) throws IOException + private void checkSubtypedBitfieldParamHolderInBitBuffer( + BitBuffer bitBuffer, SubtypedBitfieldParamHolder subtypedBitfieldParamHolder) throws IOException { try (final BitStreamReader stream = new ByteArrayBitStreamReader(bitBuffer)) { diff --git a/test/language/pubsub_types/build.xml b/test/language/pubsub_types/build.xml index 74269ce41..7a0bfe1f1 100644 --- a/test/language/pubsub_types/build.xml +++ b/test/language/pubsub_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/pubsub_types/java/pubsub_types/TestPubsub.java b/test/language/pubsub_types/java/pubsub_types/TestPubsub.java index dd8258dfc..2ca932893 100644 --- a/test/language/pubsub_types/java/pubsub_types/TestPubsub.java +++ b/test/language/pubsub_types/java/pubsub_types/TestPubsub.java @@ -1,9 +1,10 @@ package pubsub_types; -import java.util.Map; import java.util.HashMap; -import zserio.runtime.pubsub.PubsubInterface; +import java.util.Map; + import zserio.runtime.pubsub.PubsubException; +import zserio.runtime.pubsub.PubsubInterface; public class TestPubsub implements PubsubInterface { diff --git a/test/language/pubsub_types/java/pubsub_types/simple_pubsub/SimplePubsubTest.java b/test/language/pubsub_types/java/pubsub_types/simple_pubsub/SimplePubsubTest.java index cacd13e9e..b44442afe 100644 --- a/test/language/pubsub_types/java/pubsub_types/simple_pubsub/SimplePubsubTest.java +++ b/test/language/pubsub_types/java/pubsub_types/simple_pubsub/SimplePubsubTest.java @@ -1,16 +1,17 @@ package pubsub_types.simple_pubsub; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.BeforeEach; import java.math.BigInteger; -import java.util.Map; import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; -import zserio.runtime.pubsub.PubsubException; -import zserio.runtime.pubsub.PubsubCallback; import zserio.runtime.io.SerializeUtil; +import zserio.runtime.pubsub.PubsubCallback; +import zserio.runtime.pubsub.PubsubException; import pubsub_types.TestPubsub; diff --git a/test/language/service_types/build.xml b/test/language/service_types/build.xml index a54ede41e..2541c48c1 100644 --- a/test/language/service_types/build.xml +++ b/test/language/service_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/service_types/java/service_types/complex_types_service/ComplexTypesServiceTest.java b/test/language/service_types/java/service_types/complex_types_service/ComplexTypesServiceTest.java index 651cc0a03..ae442ddd9 100644 --- a/test/language/service_types/java/service_types/complex_types_service/ComplexTypesServiceTest.java +++ b/test/language/service_types/java/service_types/complex_types_service/ComplexTypesServiceTest.java @@ -1,12 +1,13 @@ package service_types.complex_types_service; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import zserio.runtime.io.Writer; import zserio.runtime.service.ServiceData; import zserio.runtime.service.ServiceException; -import zserio.runtime.io.Writer; public class ComplexTypesServiceTest { @@ -88,8 +89,8 @@ public void cmykToRgb() for (int i = 0; i < length; ++i) { final ColorModelChoice choice = new ColorModelChoice(ColorModel.CMYK); - choice.setCmyk(new CMYKModel(cmykValues[i % 3][0], cmykValues[i % 3][1], cmykValues[i % 3][2], - cmykValues[i % 3][3])); + choice.setCmyk(new CMYKModel( + cmykValues[i % 3][0], cmykValues[i % 3][1], cmykValues[i % 3][2], cmykValues[i % 3][3])); data[i] = choice; } @@ -236,6 +237,6 @@ public byte[] callMethod(String methodName, ServiceData reques // note that conversion is slightly inaccurate and therefore this values are carefully chosen // to provide consistent results for the test needs - private static final short rgbValues[][] = { { 0 ,128, 255 }, { 222, 222, 0 }, { 65, 196, 31 } }; + private static final short rgbValues[][] = {{0, 128, 255}, {222, 222, 0}, {65, 196, 31}}; private static short cmykValues[][]; } diff --git a/test/language/service_types/java/service_types/simple_service/SimpleServiceTest.java b/test/language/service_types/java/service_types/simple_service/SimpleServiceTest.java index 97036a80e..ec0434dea 100644 --- a/test/language/service_types/java/service_types/simple_service/SimpleServiceTest.java +++ b/test/language/service_types/java/service_types/simple_service/SimpleServiceTest.java @@ -1,10 +1,11 @@ package service_types.simple_service; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.math.BigInteger; import java.io.IOException; +import java.math.BigInteger; + +import org.junit.jupiter.api.Test; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -97,7 +98,7 @@ public byte[] powerOfTwoRawImpl(byte[] requestData, Object context) } catch (IOException e) { - return new byte[]{}; + return new byte[] {}; } } } diff --git a/test/language/sql_constraints/build.xml b/test/language/sql_constraints/build.xml index d16a573f9..3bafe6089 100644 --- a/test/language/sql_constraints/build.xml +++ b/test/language/sql_constraints/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/sql_constraints/java/sql_constraints/field_constraints/FieldConstraintsTest.java b/test/language/sql_constraints/java/sql_constraints/field_constraints/FieldConstraintsTest.java index d09ebbe10..39528d162 100644 --- a/test/language/sql_constraints/java/sql_constraints/field_constraints/FieldConstraintsTest.java +++ b/test/language/sql_constraints/java/sql_constraints/field_constraints/FieldConstraintsTest.java @@ -1,22 +1,22 @@ package sql_constraints.field_constraints; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.Arrays; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import sql_constraints.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class FieldConstraintsTest { @@ -102,8 +102,8 @@ public void sqlCheckImportedConstant() throws IOException, SQLException final SQLException thrown = assertThrows(SQLException.class, () -> fieldConstraintsTable.write(Arrays.asList(row))); - assertThat(thrown.getMessage(), - containsString("CHECK constraint failed: sqlCheckImportedConstant < 321")); + assertThat( + thrown.getMessage(), containsString("CHECK constraint failed: sqlCheckImportedConstant < 321")); } @Test diff --git a/test/language/sql_constraints/java/sql_constraints/table_constraints/TableConstraintsTest.java b/test/language/sql_constraints/java/sql_constraints/table_constraints/TableConstraintsTest.java index a0b7f6ea1..44df584e1 100644 --- a/test/language/sql_constraints/java/sql_constraints/table_constraints/TableConstraintsTest.java +++ b/test/language/sql_constraints/java/sql_constraints/table_constraints/TableConstraintsTest.java @@ -1,23 +1,23 @@ package sql_constraints.table_constraints; -import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.SQLException; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import sql_constraints.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class TableConstraintsTest { @@ -76,9 +76,9 @@ public void primaryKeyWrong() throws IOException, SQLException rows.add(row2); final SQLException thrown = assertThrows(SQLException.class, () -> tableConstraintsTable.write(rows)); - assertThat(thrown.getMessage(), containsString( - "UNIQUE constraint failed: tableConstraintsTable.primaryKey1, " + - "tableConstraintsTable.primaryKey2")); + assertThat(thrown.getMessage(), + containsString("UNIQUE constraint failed: tableConstraintsTable.primaryKey1, " + + "tableConstraintsTable.primaryKey2")); } @Test @@ -112,9 +112,9 @@ public void uniqueWrong() throws IOException, SQLException rows.add(row2); final SQLException thrown = assertThrows(SQLException.class, () -> tableConstraintsTable.write(rows)); - assertThat(thrown.getMessage(), containsString( - "UNIQUE constraint failed: tableConstraintsTable.uniqueValue1, " + - "tableConstraintsTable.uniqueValue2")); + assertThat(thrown.getMessage(), + containsString("UNIQUE constraint failed: tableConstraintsTable.uniqueValue1, " + + "tableConstraintsTable.uniqueValue2")); } private static final String FILE_NAME = "table_constraints_test.sqlite"; diff --git a/test/language/sql_databases/build.xml b/test/language/sql_databases/build.xml index eca6a85a8..347f88981 100644 --- a/test/language/sql_databases/build.xml +++ b/test/language/sql_databases/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/language/sql_databases/java/sql_databases/db_with_relocation/DbWithRelocationTest.java b/test/language/sql_databases/java/sql_databases/db_with_relocation/DbWithRelocationTest.java index fc5b81bf7..05a88a6c9 100644 --- a/test/language/sql_databases/java/sql_databases/db_with_relocation/DbWithRelocationTest.java +++ b/test/language/sql_databases/java/sql_databases/db_with_relocation/DbWithRelocationTest.java @@ -1,10 +1,6 @@ package sql_databases.db_with_relocation; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -19,12 +15,17 @@ import java.util.Map; import java.util.Set; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.SqlDatabase; import zserio.runtime.validation.ValidationReport; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class DbWithRelocationTest { @BeforeAll @@ -110,14 +111,14 @@ public void checkRelocatedSlovakiaTable() throws SQLException, IOException // write to relocated table final int updateTileId = 1; - final List writtenRows = createCountryMapTableRows(updateTileId, (short)'a', - (short)'A'); + final List writtenRows = + createCountryMapTableRows(updateTileId, (short)'a', (short)'A'); final CountryMapTable relocatedTable = americaDb.getSlovakia(); relocatedTable.write(writtenRows); // update it - final List updatedRows = createCountryMapTableRows(updateTileId, (short)'b', - (short)'B'); + final List updatedRows = + createCountryMapTableRows(updateTileId, (short)'b', (short)'B'); final String updateCondition = "tileId=" + updateTileId; relocatedTable.update(updatedRows.get(0), updateCondition); @@ -144,14 +145,14 @@ public void checkRelocatedCzechiaTable() throws SQLException, IOException // write to relocated table final int updateTileId = 1; - final List writtenRows = createCountryMapTableRows(updateTileId, (short)'c', - (short)'C'); + final List writtenRows = + createCountryMapTableRows(updateTileId, (short)'c', (short)'C'); final CountryMapTable relocatedTable = americaDb.getCzechia(); relocatedTable.write(writtenRows); // update it - final List updatedRows = createCountryMapTableRows(updateTileId, (short)'d', - (short)'D'); + final List updatedRows = + createCountryMapTableRows(updateTileId, (short)'d', (short)'D'); final String updateCondition = "tileId=" + updateTileId; relocatedTable.update(updatedRows.get(0), updateCondition); @@ -171,10 +172,8 @@ public void checkRelocatedCzechiaTable() throws SQLException, IOException public void checkAttachedDatabases() throws SQLException { final String sqlQuery = "PRAGMA database_list"; - try ( - final PreparedStatement statement = americaDb.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = americaDb.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { while (resultSet.next()) { @@ -192,13 +191,11 @@ public void checkAttachedDatabases() throws SQLException private static boolean isRelocatedTableInDb(String relocatedTableName, SqlDatabase db) throws SQLException { // check if database does contain relocated table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + - relocatedTableName + "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + relocatedTableName + "'"; - try ( - final PreparedStatement statement = db.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = db.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -223,8 +220,8 @@ private static List createCountryMapTableRows(int tileId, sh return rows; } - private static void checkCountryMapTableRows(List expectedRows, - List currentRows) + private static void checkCountryMapTableRows( + List expectedRows, List currentRows) { assertEquals(expectedRows.size(), currentRows.size()); for (int i = 0; i < expectedRows.size(); ++i) @@ -244,14 +241,11 @@ private static void checkCountryMapTableRows(List expectedRo private static final int NUM_ALL_AMERICA_DB_TABLES = 4; private static final Set attachedDatabaseNames = new HashSet(Arrays.asList( - "main", - "AmericaDb_" + RELOCATED_SLOVAKIA_TABLE_NAME, - "AmericaDb_" + RELOCATED_CZECHIA_TABLE_NAME - )); + "main", "AmericaDb_" + RELOCATED_SLOVAKIA_TABLE_NAME, "AmericaDb_" + RELOCATED_CZECHIA_TABLE_NAME)); - private final File europeDbFile = new File(EUROPE_DB_FILE_NAME); - private final File americaDbFile = new File(AMERICA_DB_FILE_NAME); + private final File europeDbFile = new File(EUROPE_DB_FILE_NAME); + private final File americaDbFile = new File(AMERICA_DB_FILE_NAME); - private EuropeDb europeDb = null; - private AmericaDb americaDb = null; + private EuropeDb europeDb = null; + private AmericaDb americaDb = null; } diff --git a/test/language/sql_databases/java/sql_databases/simple_db/SimpleDbTest.java b/test/language/sql_databases/java/sql_databases/simple_db/SimpleDbTest.java index 53c1ab144..b4744665d 100644 --- a/test/language/sql_databases/java/sql_databases/simple_db/SimpleDbTest.java +++ b/test/language/sql_databases/java/sql_databases/simple_db/SimpleDbTest.java @@ -1,9 +1,6 @@ package sql_databases.simple_db; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.sql.Connection; @@ -17,11 +14,15 @@ import java.util.Properties; import java.util.Set; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.validation.ValidationReport; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class SimpleDbTest { @BeforeAll @@ -64,10 +65,8 @@ public void connectionConstructor() throws SQLException connectionProps.setProperty("flags", "CREATE"); final String uriPath = "jdbc:sqlite:file:" + dbFile.toString(); - try ( - final Connection connection = DriverManager.getConnection(uriPath, connectionProps); - final WorldDb database = new WorldDb(connection); - ) + try (final Connection connection = DriverManager.getConnection(uriPath, connectionProps); + final WorldDb database = new WorldDb(connection);) { database.createSchema(); checkDb(database); @@ -82,10 +81,8 @@ public void connectionConstructorTableRelocationMap() throws SQLException final String uriPath = "jdbc:sqlite:file:" + dbFile.toString(); final Map tableToDbFileNameRelocationMap = new HashMap(); - try ( - final Connection connection = DriverManager.getConnection(uriPath, connectionProps); - final WorldDb database = new WorldDb(connection, tableToDbFileNameRelocationMap); - ) + try (final Connection connection = DriverManager.getConnection(uriPath, connectionProps); + final WorldDb database = new WorldDb(connection, tableToDbFileNameRelocationMap);) { database.createSchema(); checkDb(database); @@ -185,14 +182,10 @@ private boolean isTableInDb(WorldDb database, String checkTableName) throws SQLE // check if database does contain table final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name=?"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery);) { statement.setString(1, checkTableName); - try ( - final ResultSet resultSet = statement.executeQuery(); - ) + try (final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; diff --git a/test/language/sql_tables/build.xml b/test/language/sql_tables/build.xml index 6953b27cb..1c33ebda0 100644 --- a/test/language/sql_tables/build.xml +++ b/test/language/sql_tables/build.xml @@ -23,7 +23,11 @@ - + + + + + diff --git a/test/language/sql_tables/java/sql_tables/blob_field_with_children_initialization_table/BlobFieldWithChildrenInitializationTableTest.java b/test/language/sql_tables/java/sql_tables/blob_field_with_children_initialization_table/BlobFieldWithChildrenInitializationTableTest.java index bbe52fadb..df8f46131 100644 --- a/test/language/sql_tables/java/sql_tables/blob_field_with_children_initialization_table/BlobFieldWithChildrenInitializationTableTest.java +++ b/test/language/sql_tables/java/sql_tables/blob_field_with_children_initialization_table/BlobFieldWithChildrenInitializationTableTest.java @@ -1,10 +1,6 @@ package sql_tables.blob_field_with_children_initialization_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,13 +8,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class BlobFieldWithChildrenInitializationTableTest { @BeforeAll @@ -86,20 +86,22 @@ private static BlobFieldWithChildrenInitializationTableRow createRow(int index) return row; } - private static void checkRows(List rows1, List rows2) + private static void checkRows(List rows1, + List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) checkRow(rows1.get(i), rows2.get(i)); } - private static void checkRow(BlobFieldWithChildrenInitializationTableRow row1, BlobFieldWithChildrenInitializationTableRow row2) + private static void checkRow( + BlobFieldWithChildrenInitializationTableRow row1, BlobFieldWithChildrenInitializationTableRow row2) { assertEquals(row1.getId(), row2.getId()); assertEquals(row1.getBlob(), row2.getBlob()); } - private static final int NUM_ROWS = 5; + private static final int NUM_ROWS = 5; private static final String FILE_NAME = "blob_field_with_children_initialization_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/blob_offsets_param_table/BlobOffsetsParamTableTest.java b/test/language/sql_tables/java/sql_tables/blob_offsets_param_table/BlobOffsetsParamTableTest.java index d6b4d94d9..cfba1ad4f 100644 --- a/test/language/sql_tables/java/sql_tables/blob_offsets_param_table/BlobOffsetsParamTableTest.java +++ b/test/language/sql_tables/java/sql_tables/blob_offsets_param_table/BlobOffsetsParamTableTest.java @@ -1,10 +1,6 @@ package sql_tables.blob_offsets_param_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,13 +10,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class BlobOffsetsParamTableTest { @BeforeAll @@ -144,15 +144,16 @@ private static BlobOffsetsParamTableRow createBlobOffsetsParamTableRow(int blobI return row; } - private static void checkBlobOffsetsParamTableRows(List rows1, - List rows2) + private static void checkBlobOffsetsParamTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) checkBlobOffsetsParamTableRow(rows1.get(i), rows2.get(i)); } - private static void checkBlobOffsetsParamTableRow(BlobOffsetsParamTableRow row1, BlobOffsetsParamTableRow row2) + private static void checkBlobOffsetsParamTableRow( + BlobOffsetsParamTableRow row1, BlobOffsetsParamTableRow row2) { assertEquals(row1.getBlobId(), row2.getBlobId()); assertEquals(row1.getName(), row2.getName()); @@ -163,13 +164,11 @@ private static void checkBlobOffsetsParamTableRow(BlobOffsetsParamTableRow row1, private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -185,8 +184,8 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "blobOffsetsParamTable"; - private static final int ARRAY_SIZE = 10; - private static final int NUM_BLOB_OFFSETS_PARAM_TABLE_ROWS = 5; + private static final int ARRAY_SIZE = 10; + private static final int NUM_BLOB_OFFSETS_PARAM_TABLE_ROWS = 5; private static final String FILE_NAME = "blob_offsets_param_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/blob_param_table/BlobParamTableTest.java b/test/language/sql_tables/java/sql_tables/blob_param_table/BlobParamTableTest.java index c492d581f..1d34657bc 100644 --- a/test/language/sql_tables/java/sql_tables/blob_param_table/BlobParamTableTest.java +++ b/test/language/sql_tables/java/sql_tables/blob_param_table/BlobParamTableTest.java @@ -1,10 +1,6 @@ package sql_tables.blob_param_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,13 +10,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class BlobParamTableTest { @BeforeAll @@ -165,8 +165,7 @@ private static BlobParamTableRow createBlobParamTableRowWithNullValues(int blobI return row; } - private static void checkBlobParamTableRows(List rows1, - List rows2) + private static void checkBlobParamTableRows(List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -193,13 +192,11 @@ private static void checkBlobParamTableRow(BlobParamTableRow row1, BlobParamTabl private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -215,8 +212,8 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "blobParamTable"; - private static final int PARAMETERS_COUNT = 10; - private static final int NUM_BLOB_PARAM_TABLE_ROWS = 5; + private static final int PARAMETERS_COUNT = 10; + private static final int NUM_BLOB_PARAM_TABLE_ROWS = 5; private static final String FILE_NAME = "blob_param_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/column_param_table/ColumnParamTableTest.java b/test/language/sql_tables/java/sql_tables/column_param_table/ColumnParamTableTest.java index 9e1fa0041..fc597a37f 100644 --- a/test/language/sql_tables/java/sql_tables/column_param_table/ColumnParamTableTest.java +++ b/test/language/sql_tables/java/sql_tables/column_param_table/ColumnParamTableTest.java @@ -1,10 +1,6 @@ package sql_tables.column_param_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,13 +10,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ColumnParamTableTest { @BeforeAll @@ -132,8 +132,8 @@ private static ColumnParamTableRow createColumnParamTableRow(int blobId, String return row; } - private static void checkColumnParamTableRows(List rows1, - List rows2) + private static void checkColumnParamTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -150,13 +150,11 @@ private static void checkColumnParamTableRow(ColumnParamTableRow row1, ColumnPar private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -172,8 +170,8 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "columnParamTable"; - private static final int PARAMETERIZED_BLOB_VALUE = 0xABCD; - private static final int NUM_COLUMN_PARAM_TABLE_ROWS = 5; + private static final int PARAMETERIZED_BLOB_VALUE = 0xABCD; + private static final int NUM_COLUMN_PARAM_TABLE_ROWS = 5; private static final String FILE_NAME = "column_param_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/complex_table/ComplexTableTest.java b/test/language/sql_tables/java/sql_tables/complex_table/ComplexTableTest.java index fc317401f..4d7306550 100644 --- a/test/language/sql_tables/java/sql_tables/complex_table/ComplexTableTest.java +++ b/test/language/sql_tables/java/sql_tables/complex_table/ComplexTableTest.java @@ -1,10 +1,6 @@ package sql_tables.complex_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -15,13 +11,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ComplexTableTest { @BeforeAll @@ -210,8 +210,8 @@ private static void checkComplexTableRow(ComplexTableRow row1, ComplexTableRow r assertEquals(row1.getBlob(), row2.getBlob()); } - private static void checkComplexTableRowsWithNullValues(List rows1, - List rows2) + private static void checkComplexTableRowsWithNullValues( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -235,13 +235,11 @@ private static void checkComplexTableRowWithNullValues(ComplexTableRow row1, Com private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -257,8 +255,8 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "complexTable"; - private static final int NUM_COMPLEX_TABLE_ROWS = 5; - private static final int COMPLEX_TABLE_COUNT = 10; + private static final int NUM_COMPLEX_TABLE_ROWS = 5; + private static final int COMPLEX_TABLE_COUNT = 10; private static final String FILE_NAME = "complex_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/const_param_table/ConstParamTableTest.java b/test/language/sql_tables/java/sql_tables/const_param_table/ConstParamTableTest.java index da81d7823..b3888b6c6 100644 --- a/test/language/sql_tables/java/sql_tables/const_param_table/ConstParamTableTest.java +++ b/test/language/sql_tables/java/sql_tables/const_param_table/ConstParamTableTest.java @@ -1,10 +1,6 @@ package sql_tables.const_param_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,13 +10,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class ConstParamTableTest { @BeforeAll @@ -126,15 +126,14 @@ private static ConstParamTableRow createConstParamTableRow(int blobId, String na final ConstParamTableRow row = new ConstParamTableRow(); row.setBlobId(blobId); row.setName(name); - final ParameterizedBlob parameterizedBlob = new ParameterizedBlob(PARAMETERIZED_BLOB_PARAM, - PARAMETERIZED_BLOB_VALUE); + final ParameterizedBlob parameterizedBlob = + new ParameterizedBlob(PARAMETERIZED_BLOB_PARAM, PARAMETERIZED_BLOB_VALUE); row.setBlob(parameterizedBlob); return row; } - private static void checkConstParamTableRows(List rows1, - List rows2) + private static void checkConstParamTableRows(List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -151,13 +150,11 @@ private static void checkConstParamTableRow(ConstParamTableRow row1, ConstParamT private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -173,9 +170,9 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "constParamTable"; - private static final int PARAMETERIZED_BLOB_VALUE = 0xABCD; - private static final int PARAMETERIZED_BLOB_PARAM = 2; - private static final int NUM_CONST_PARAM_TABLE_ROWS = 5; + private static final int PARAMETERIZED_BLOB_VALUE = 0xABCD; + private static final int PARAMETERIZED_BLOB_PARAM = 2; + private static final int NUM_CONST_PARAM_TABLE_ROWS = 5; private static final String FILE_NAME = "const_param_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/dynamic_bit_field_enum_field_table/DynamicBitFieldEnumFieldTableTest.java b/test/language/sql_tables/java/sql_tables/dynamic_bit_field_enum_field_table/DynamicBitFieldEnumFieldTableTest.java index 73f91fc41..996acb532 100644 --- a/test/language/sql_tables/java/sql_tables/dynamic_bit_field_enum_field_table/DynamicBitFieldEnumFieldTableTest.java +++ b/test/language/sql_tables/java/sql_tables/dynamic_bit_field_enum_field_table/DynamicBitFieldEnumFieldTableTest.java @@ -1,10 +1,6 @@ package sql_tables.dynamic_bit_field_enum_field_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,13 +8,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class DynamicBitFieldEnumFieldTableTest { @BeforeAll @@ -71,17 +71,13 @@ private static DynamicBitFieldEnumFieldTableRow createRow(int i) { final DynamicBitFieldEnumFieldTableRow row = new DynamicBitFieldEnumFieldTableRow(); row.setId(i); - row.setEnumField(i % 3 == 0 - ? TestEnum.ONE - : i % 3 == 1 - ? TestEnum.TWO - : TestEnum.THREE); + row.setEnumField(i % 3 == 0 ? TestEnum.ONE : i % 3 == 1 ? TestEnum.TWO : TestEnum.THREE); return row; } - private static void checkRows(List rows1, - List rows2) + private static void checkRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -94,7 +90,7 @@ private static void checkRow(DynamicBitFieldEnumFieldTableRow row1, DynamicBitFi assertEquals(row1.getEnumField(), row2.getEnumField()); } - private static final int NUM_ROWS = 5; + private static final int NUM_ROWS = 5; private static final String FILE_NAME = "dynamic_bit_field_enum_field_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/multiple_pk_table/MultiplePkTableTest.java b/test/language/sql_tables/java/sql_tables/multiple_pk_table/MultiplePkTableTest.java index 32bddc401..e9710f78f 100644 --- a/test/language/sql_tables/java/sql_tables/multiple_pk_table/MultiplePkTableTest.java +++ b/test/language/sql_tables/java/sql_tables/multiple_pk_table/MultiplePkTableTest.java @@ -1,10 +1,6 @@ package sql_tables.multiple_pk_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,13 +10,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class MultiplePkTableTest { @BeforeAll @@ -147,13 +147,11 @@ private static void checkMultiplePkTableRow(MultiplePkTableRow row1, MultiplePkT private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -169,7 +167,7 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "multiplePkTable"; - private static final int NUM_MULTIPLE_PK_TABLE_ROWS = 5; + private static final int NUM_MULTIPLE_PK_TABLE_ROWS = 5; private static final String FILE_NAME = "multiple_pk_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/subtyped_bitmask_field_table/SubtypedBitmaskFieldTableTest.java b/test/language/sql_tables/java/sql_tables/subtyped_bitmask_field_table/SubtypedBitmaskFieldTableTest.java index 9f3540754..377c37058 100644 --- a/test/language/sql_tables/java/sql_tables/subtyped_bitmask_field_table/SubtypedBitmaskFieldTableTest.java +++ b/test/language/sql_tables/java/sql_tables/subtyped_bitmask_field_table/SubtypedBitmaskFieldTableTest.java @@ -1,10 +1,6 @@ package sql_tables.subtyped_bitmask_field_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,13 +8,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class SubtypedBitmaskFieldTableTest { @BeforeAll @@ -70,17 +70,15 @@ private static SubtypedBitmaskFieldTableRow createRow(int i) { final SubtypedBitmaskFieldTableRow row = new SubtypedBitmaskFieldTableRow(); row.setId(i); - row.setBitmaskField(i % 3 == 0 - ? TestBitmask.Values.ONE - : i % 3 == 1 - ? TestBitmask.Values.TWO - : TestBitmask.Values.THREE); + row.setBitmaskField(i % 3 == 0 ? TestBitmask.Values.ONE + : i % 3 == 1 ? TestBitmask.Values.TWO + : TestBitmask.Values.THREE); return row; } - private static void checkRows(List rows1, - List rows2) + private static void checkRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -93,7 +91,7 @@ private static void checkRow(SubtypedBitmaskFieldTableRow row1, SubtypedBitmaskF assertEquals(row1.getBitmaskField(), row2.getBitmaskField()); } - private static final int NUM_ROWS = 5; + private static final int NUM_ROWS = 5; private static final String FILE_NAME = "subtyped_bitmask_field_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/subtyped_bool_field_table/SubtypedBoolFieldTableTest.java b/test/language/sql_tables/java/sql_tables/subtyped_bool_field_table/SubtypedBoolFieldTableTest.java index 2e0c845f3..d149c3d8e 100644 --- a/test/language/sql_tables/java/sql_tables/subtyped_bool_field_table/SubtypedBoolFieldTableTest.java +++ b/test/language/sql_tables/java/sql_tables/subtyped_bool_field_table/SubtypedBoolFieldTableTest.java @@ -1,10 +1,6 @@ package sql_tables.subtyped_bool_field_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,13 +8,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class SubtypedBoolFieldTableTest { @BeforeAll @@ -88,7 +88,7 @@ private static void checkRow(SubtypedBoolFieldTableRow row1, SubtypedBoolFieldTa assertEquals(row1.getBoolField(), row2.getBoolField()); } - private static final int NUM_ROWS = 5; + private static final int NUM_ROWS = 5; private static final String FILE_NAME = "subtyped_bool_field_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/subtyped_enum_field_table/SubtypedEnumFieldTableTest.java b/test/language/sql_tables/java/sql_tables/subtyped_enum_field_table/SubtypedEnumFieldTableTest.java index 4f09b9f96..9eb24eb42 100644 --- a/test/language/sql_tables/java/sql_tables/subtyped_enum_field_table/SubtypedEnumFieldTableTest.java +++ b/test/language/sql_tables/java/sql_tables/subtyped_enum_field_table/SubtypedEnumFieldTableTest.java @@ -1,10 +1,6 @@ package sql_tables.subtyped_enum_field_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -12,13 +8,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class SubtypedEnumFieldTableTest { @BeforeAll @@ -70,11 +70,7 @@ private static SubtypedEnumFieldTableRow createRow(int i) { final SubtypedEnumFieldTableRow row = new SubtypedEnumFieldTableRow(); row.setId(i); - row.setEnumField(i % 3 == 0 - ? TestEnum.ONE - : i % 3 == 1 - ? TestEnum.TWO - : TestEnum.THREE); + row.setEnumField(i % 3 == 0 ? TestEnum.ONE : i % 3 == 1 ? TestEnum.TWO : TestEnum.THREE); return row; } @@ -92,7 +88,7 @@ private static void checkRow(SubtypedEnumFieldTableRow row1, SubtypedEnumFieldTa assertEquals(row1.getEnumField(), row2.getEnumField()); } - private static final int NUM_ROWS = 5; + private static final int NUM_ROWS = 5; private static final String FILE_NAME = "subtyped_enum_field_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_tables/java/sql_tables/subtyped_table/SubtypedTableTest.java b/test/language/sql_tables/java/sql_tables/subtyped_table/SubtypedTableTest.java index ff01511b1..a5c75c465 100644 --- a/test/language/sql_tables/java/sql_tables/subtyped_table/SubtypedTableTest.java +++ b/test/language/sql_tables/java/sql_tables/subtyped_table/SubtypedTableTest.java @@ -1,22 +1,21 @@ package sql_tables.subtyped_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; - import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class SubtypedTableTest { @@ -56,13 +55,11 @@ public void testSubtypedTable() throws SQLException private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; diff --git a/test/language/sql_tables/java/sql_tables/without_pk_table/WithoutPkTableTest.java b/test/language/sql_tables/java/sql_tables/without_pk_table/WithoutPkTableTest.java index 3200fa6e3..e48721518 100644 --- a/test/language/sql_tables/java/sql_tables/without_pk_table/WithoutPkTableTest.java +++ b/test/language/sql_tables/java/sql_tables/without_pk_table/WithoutPkTableTest.java @@ -1,10 +1,6 @@ package sql_tables.without_pk_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,13 +10,17 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; - -import sql_tables.TestDb; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import sql_tables.TestDb; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class WithoutPkTableTest { @BeforeAll @@ -146,13 +146,11 @@ private static void checkWithoutPkTableRow(WithoutPkTableRow row1, WithoutPkTabl private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -168,7 +166,7 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "withoutPkTable"; - private static final int NUM_WITHOUT_PK_TABLE_ROWS = 5; + private static final int NUM_WITHOUT_PK_TABLE_ROWS = 5; private static final String FILE_NAME = "without_pk_table_test.sqlite"; private final File file = new File(FILE_NAME); diff --git a/test/language/sql_types/build.xml b/test/language/sql_types/build.xml index cbec69730..8aae6231e 100644 --- a/test/language/sql_types/build.xml +++ b/test/language/sql_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/sql_types/java/sql_types/SqlTypesTest.java b/test/language/sql_types/java/sql_types/SqlTypesTest.java index 50a9e3c56..0f166b5d9 100644 --- a/test/language/sql_types/java/sql_types/SqlTypesTest.java +++ b/test/language/sql_types/java/sql_types/SqlTypesTest.java @@ -1,10 +1,6 @@ package sql_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,6 +10,11 @@ import java.util.HashMap; import java.util.Map; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import test_utils.FileUtil; import test_utils.JdbcUtil; @@ -273,10 +274,8 @@ private Map getSqlColumnTypes() throws SQLException sqlQuery.append(")"); // get table info - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery.toString()); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery.toString()); + final ResultSet resultSet = statement.executeQuery();) { while (resultSet.next()) { diff --git a/test/language/sql_virtual_columns/build.xml b/test/language/sql_virtual_columns/build.xml index 365b2ac00..22294eb24 100644 --- a/test/language/sql_virtual_columns/build.xml +++ b/test/language/sql_virtual_columns/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/sql_virtual_columns/java/sql_virtual_columns/HiddenVirtualColumnsTest.java b/test/language/sql_virtual_columns/java/sql_virtual_columns/HiddenVirtualColumnsTest.java index 0c844f67e..b57fc9abf 100644 --- a/test/language/sql_virtual_columns/java/sql_virtual_columns/HiddenVirtualColumnsTest.java +++ b/test/language/sql_virtual_columns/java/sql_virtual_columns/HiddenVirtualColumnsTest.java @@ -1,10 +1,6 @@ package sql_virtual_columns; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,14 +10,18 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import zserio.runtime.ZserioError; import sql_virtual_columns.hidden_virtual_columns.HiddenVirtualColumnsDb; import sql_virtual_columns.hidden_virtual_columns.HiddenVirtualColumnsTable; import sql_virtual_columns.hidden_virtual_columns.HiddenVirtualColumnsTableRow; - -import zserio.runtime.ZserioError; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class HiddenVirtualColumnsTest { @@ -104,8 +104,8 @@ public void update() throws SQLException, IOException, ZserioError testTable.write(writtenRows); final int updateDocId = 1; - final HiddenVirtualColumnsTableRow updateRow = createHiddenVirtualColumnsTableRow(updateDocId, - "Updated Search Tags"); + final HiddenVirtualColumnsTableRow updateRow = + createHiddenVirtualColumnsTableRow(updateDocId, "Updated Search Tags"); final String updateCondition = "docId='" + updateDocId + "'"; testTable.update(updateRow, updateCondition); @@ -142,16 +142,16 @@ private static HiddenVirtualColumnsTableRow createHiddenVirtualColumnsTableRow(i return row; } - private static void checkHiddenVirtualColumnsTableRows(List rows1, - List rows2) + private static void checkHiddenVirtualColumnsTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) checkHiddenVirtualColumnsTableRow(rows1.get(i), rows2.get(i)); } - private static void checkHiddenVirtualColumnsTableRow(HiddenVirtualColumnsTableRow row1, - HiddenVirtualColumnsTableRow row2) + private static void checkHiddenVirtualColumnsTableRow( + HiddenVirtualColumnsTableRow row1, HiddenVirtualColumnsTableRow row2) { assertEquals(row1.getDocId(), row2.getDocId()); assertEquals(row1.getLanguageCode(), row2.getLanguageCode()); @@ -162,13 +162,11 @@ private static void checkHiddenVirtualColumnsTableRow(HiddenVirtualColumnsTableR private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -199,10 +197,10 @@ private boolean isHiddenVirtualColumnInTable(String columnName) throws SQLExcept private static final String TABLE_NAME = "hiddenVirtualColumnsTable"; - private static final int NUM_TABLE_ROWS = 5; + private static final int NUM_TABLE_ROWS = 5; - private static final short LANGUAGE_CODE_VALUE = 1; - private static final long FREQUENCY_VALUE = 0xDEAD; + private static final short LANGUAGE_CODE_VALUE = 1; + private static final long FREQUENCY_VALUE = 0xDEAD; private static final String FILE_NAME = "hidden_virtual_columns_test.sqlite"; diff --git a/test/language/sql_virtual_columns/java/sql_virtual_columns/SimpleVirtualColumnsTest.java b/test/language/sql_virtual_columns/java/sql_virtual_columns/SimpleVirtualColumnsTest.java index 17b35bb61..b32cef7c7 100644 --- a/test/language/sql_virtual_columns/java/sql_virtual_columns/SimpleVirtualColumnsTest.java +++ b/test/language/sql_virtual_columns/java/sql_virtual_columns/SimpleVirtualColumnsTest.java @@ -1,10 +1,6 @@ package sql_virtual_columns; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,14 +10,18 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import zserio.runtime.ZserioError; import sql_virtual_columns.simple_virtual_columns.SimpleVirtualColumnsDb; import sql_virtual_columns.simple_virtual_columns.SimpleVirtualColumnsTable; import sql_virtual_columns.simple_virtual_columns.SimpleVirtualColumnsTableRow; - -import zserio.runtime.ZserioError; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class SimpleVirtualColumnsTest { @@ -138,16 +138,16 @@ private static SimpleVirtualColumnsTableRow createSimpleVirtualColumnsTableRow(S return row; } - private static void checkSimpleVirtualColumnsTableRows(List rows1, - List rows2) + private static void checkSimpleVirtualColumnsTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) checkSimpleVirtualColumnsTableRow(rows1.get(i), rows2.get(i)); } - private static void checkSimpleVirtualColumnsTableRow(SimpleVirtualColumnsTableRow row1, - SimpleVirtualColumnsTableRow row2) + private static void checkSimpleVirtualColumnsTableRow( + SimpleVirtualColumnsTableRow row1, SimpleVirtualColumnsTableRow row2) { assertEquals(row1.getContent(), row2.getContent()); } @@ -155,13 +155,11 @@ private static void checkSimpleVirtualColumnsTableRow(SimpleVirtualColumnsTableR private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -178,10 +176,8 @@ private boolean isTableInDb() throws SQLException private boolean isVirtualColumnInTable() throws SQLException { final String sqlQuery = "PRAGMA table_info(" + TABLE_NAME + ")"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { while (resultSet.next()) { @@ -200,7 +196,7 @@ private boolean isVirtualColumnInTable() throws SQLException private static final String TABLE_NAME = "simpleVirtualColumnsTable"; private static final String VIRTUAL_COLUMN_NAME = "content"; - private static final int NUM_TABLE_ROWS = 5; + private static final int NUM_TABLE_ROWS = 5; private static final String FILE_NAME = "simple_virtual_columns_test.sqlite"; diff --git a/test/language/sql_virtual_tables/build.xml b/test/language/sql_virtual_tables/build.xml index 409042bb0..3fda72da4 100644 --- a/test/language/sql_virtual_tables/build.xml +++ b/test/language/sql_virtual_tables/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/sql_virtual_tables/java/sql_virtual_tables/fts3_virtual_table/Fts3VirtualTableTest.java b/test/language/sql_virtual_tables/java/sql_virtual_tables/fts3_virtual_table/Fts3VirtualTableTest.java index b0b1019ef..36062a975 100644 --- a/test/language/sql_virtual_tables/java/sql_virtual_tables/fts3_virtual_table/Fts3VirtualTableTest.java +++ b/test/language/sql_virtual_tables/java/sql_virtual_tables/fts3_virtual_table/Fts3VirtualTableTest.java @@ -1,10 +1,6 @@ package sql_virtual_tables.fts3_virtual_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,11 +10,16 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class Fts3VirtualTableTest { @BeforeAll @@ -128,8 +129,8 @@ private static Fts3VirtualTableRow createFts3VirtualTableRow(String title, Strin return row; } - private static void checkFts3VirtualTableRows(List rows1, - List rows2) + private static void checkFts3VirtualTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -145,13 +146,11 @@ private static void checkFts3VirtualTableRow(Fts3VirtualTableRow row1, Fts3Virtu private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -167,7 +166,7 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "fts3VirtualTable"; - private static final int NUM_VIRTUAL_TABLE_ROWS = 5; + private static final int NUM_VIRTUAL_TABLE_ROWS = 5; private static final String FILE_NAME = "fts3_virtual_table_test.sqlite"; diff --git a/test/language/sql_virtual_tables/java/sql_virtual_tables/fts5_virtual_table/Fts5VirtualTableTest.java b/test/language/sql_virtual_tables/java/sql_virtual_tables/fts5_virtual_table/Fts5VirtualTableTest.java index 1bd55cc94..29525419b 100644 --- a/test/language/sql_virtual_tables/java/sql_virtual_tables/fts5_virtual_table/Fts5VirtualTableTest.java +++ b/test/language/sql_virtual_tables/java/sql_virtual_tables/fts5_virtual_table/Fts5VirtualTableTest.java @@ -1,10 +1,6 @@ package sql_virtual_tables.fts5_virtual_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -14,11 +10,16 @@ import java.util.ArrayList; import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; +import test_utils.FileUtil; +import test_utils.JdbcUtil; + public class Fts5VirtualTableTest { @BeforeAll @@ -128,8 +129,8 @@ private static Fts5VirtualTableRow createFts5VirtualTableRow(String title, Strin return row; } - private static void checkFts5VirtualTableRows(List rows1, - List rows2) + private static void checkFts5VirtualTableRows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) @@ -145,13 +146,11 @@ private static void checkFts5VirtualTableRow(Fts5VirtualTableRow row1, Fts5Virtu private boolean isTableInDb() throws SQLException { // check if database does contain table - final String sqlQuery = "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + - "'"; + final String sqlQuery = + "SELECT name FROM sqlite_master WHERE type='table' AND name='" + TABLE_NAME + "'"; - try ( - final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); - final ResultSet resultSet = statement.executeQuery(); - ) + try (final PreparedStatement statement = database.connection().prepareStatement(sqlQuery); + final ResultSet resultSet = statement.executeQuery();) { if (!resultSet.next()) return false; @@ -167,7 +166,7 @@ private boolean isTableInDb() throws SQLException private static final String TABLE_NAME = "fts5VirtualTable"; - private static final int NUM_VIRTUAL_TABLE_ROWS = 5; + private static final int NUM_VIRTUAL_TABLE_ROWS = 5; private static final String FILE_NAME = "fts5_virtual_table_test.sqlite"; diff --git a/test/language/sql_without_rowid_tables/build.xml b/test/language/sql_without_rowid_tables/build.xml index aaf039381..61cddfd01 100644 --- a/test/language/sql_without_rowid_tables/build.xml +++ b/test/language/sql_without_rowid_tables/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdTablesTest.java b/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdTablesTest.java index fd9965f09..ba6434141 100644 --- a/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdTablesTest.java +++ b/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdTablesTest.java @@ -1,10 +1,6 @@ package sql_without_rowid_tables.rowid_and_without_rowid_tables; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,6 +9,11 @@ import java.util.HashSet; import java.util.Set; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import test_utils.FileUtil; import test_utils.JdbcUtil; diff --git a/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdTableTest.java b/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdTableTest.java index e44d7a928..de1daa708 100644 --- a/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdTableTest.java +++ b/test/language/sql_without_rowid_tables/java/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdTableTest.java @@ -1,10 +1,6 @@ package sql_without_rowid_tables.simple_without_rowid_table; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; @@ -13,6 +9,11 @@ import java.util.HashSet; import java.util.Set; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import test_utils.FileUtil; import test_utils.JdbcUtil; diff --git a/test/language/structure_types/build.xml b/test/language/structure_types/build.xml index be6af3d03..f932de08b 100644 --- a/test/language/structure_types/build.xml +++ b/test/language/structure_types/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/language/structure_types/java/structure_types/EmptyStructureTest.java b/test/language/structure_types/java/structure_types/EmptyStructureTest.java index 6ee2be44a..a04b5b3eb 100644 --- a/test/language/structure_types/java/structure_types/EmptyStructureTest.java +++ b/test/language/structure_types/java/structure_types/EmptyStructureTest.java @@ -1,16 +1,17 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import structure_types.empty_structure.EmptyStructure; +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import structure_types.empty_structure.EmptyStructure; + public class EmptyStructureTest { @Test diff --git a/test/language/structure_types/java/structure_types/EmptyStructureWithParameterTest.java b/test/language/structure_types/java/structure_types/EmptyStructureWithParameterTest.java index 6e45fbf1d..6df6a69a7 100644 --- a/test/language/structure_types/java/structure_types/EmptyStructureWithParameterTest.java +++ b/test/language/structure_types/java/structure_types/EmptyStructureWithParameterTest.java @@ -1,16 +1,17 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import structure_types.empty_structure_with_parameter.EmptyStructureWithParameter; +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import structure_types.empty_structure_with_parameter.EmptyStructureWithParameter; + public class EmptyStructureWithParameterTest { @Test @@ -95,8 +96,7 @@ public void read() throws IOException final short param = 1; final BitStreamReader reader = new ByteArrayBitStreamReader(new byte[0], 0); - final EmptyStructureWithParameter emptyStructureWithParameter = - new EmptyStructureWithParameter(param); + final EmptyStructureWithParameter emptyStructureWithParameter = new EmptyStructureWithParameter(param); emptyStructureWithParameter.read(reader); assertEquals(param, emptyStructureWithParameter.getParam()); assertEquals(0, emptyStructureWithParameter.bitSizeOf()); @@ -107,8 +107,7 @@ public void write() throws IOException { final short param = 1; ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); - final EmptyStructureWithParameter emptyStructureWithParameter = - new EmptyStructureWithParameter(param); + final EmptyStructureWithParameter emptyStructureWithParameter = new EmptyStructureWithParameter(param); emptyStructureWithParameter.write(writer); byte bytes[] = writer.toByteArray(); assertEquals(0, bytes.length); diff --git a/test/language/structure_types/java/structure_types/FieldConstructorClashingTest.java b/test/language/structure_types/java/structure_types/FieldConstructorClashingTest.java index 16f820bb7..2d2e4376b 100644 --- a/test/language/structure_types/java/structure_types/FieldConstructorClashingTest.java +++ b/test/language/structure_types/java/structure_types/FieldConstructorClashingTest.java @@ -1,19 +1,20 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import structure_types.field_constructor_clashing.FieldConstructorClashing; -import structure_types.field_constructor_clashing.CompoundRead; -import structure_types.field_constructor_clashing.CompoundPackingRead; -import structure_types.field_constructor_clashing.Field; +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import structure_types.field_constructor_clashing.CompoundPackingRead; +import structure_types.field_constructor_clashing.CompoundRead; +import structure_types.field_constructor_clashing.Field; +import structure_types.field_constructor_clashing.FieldConstructorClashing; + // this test is mainly for C++, so just check that it is ok public class FieldConstructorClashingTest { @@ -25,8 +26,8 @@ public void writeRead() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); fieldConstructorClashing.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final FieldConstructorClashing readFieldConstructorClashing = new FieldConstructorClashing(reader); assertEquals(fieldConstructorClashing, readFieldConstructorClashing); } @@ -37,9 +38,9 @@ private FieldConstructorClashing createFieldConstructorClashing() final Field field2 = new Field(FIELD2); final Field field3 = new Field(FIELD3); - final CompoundRead[] compoundReadArray = { new CompoundRead(field1, field2) }; - final CompoundPackingRead[] compoundPackingReadArray = - { new CompoundPackingRead(field1, field2, field3) }; + final CompoundRead[] compoundReadArray = {new CompoundRead(field1, field2)}; + final CompoundPackingRead[] compoundPackingReadArray = { + new CompoundPackingRead(field1, field2, field3)}; return new FieldConstructorClashing(compoundReadArray, compoundPackingReadArray); } diff --git a/test/language/structure_types/java/structure_types/OneStringStructureTest.java b/test/language/structure_types/java/structure_types/OneStringStructureTest.java index 5a4599d19..aac7c9f89 100644 --- a/test/language/structure_types/java/structure_types/OneStringStructureTest.java +++ b/test/language/structure_types/java/structure_types/OneStringStructureTest.java @@ -1,11 +1,10 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import structure_types.one_string_structure.OneStringStructure; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -14,6 +13,8 @@ import zserio.runtime.io.ByteArrayBitStreamWriter; import zserio.runtime.io.SerializeUtil; +import structure_types.one_string_structure.OneStringStructure; + public class OneStringStructureTest { @Test @@ -92,8 +93,8 @@ public void initializeOffsets() { final OneStringStructure oneStringStructure = new OneStringStructure(ONE_STRING); final int bitPosition = 1; - assertEquals(ONE_STRING_STRUCTURE_BIT_SIZE + bitPosition, - oneStringStructure.initializeOffsets(bitPosition)); + assertEquals( + ONE_STRING_STRUCTURE_BIT_SIZE + bitPosition, oneStringStructure.initializeOffsets(bitPosition)); } @Test @@ -103,8 +104,8 @@ public void writeReadFile() throws IOException, ZserioError SerializeUtil.serializeToFile(oneStringStructure, BLOB_NAME); - final OneStringStructure readOneStringStructure = SerializeUtil.deserializeFromFile( - OneStringStructure.class, BLOB_NAME); + final OneStringStructure readOneStringStructure = + SerializeUtil.deserializeFromFile(OneStringStructure.class, BLOB_NAME); assertEquals(ONE_STRING, readOneStringStructure.getOneString()); assertTrue(oneStringStructure.equals(readOneStringStructure)); } @@ -116,8 +117,8 @@ public void writeRead() throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); oneStringStructure.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OneStringStructure readOneStringStructure = new OneStringStructure(reader); assertEquals(ONE_STRING, readOneStringStructure.getOneString()); assertTrue(oneStringStructure.equals(readOneStringStructure)); @@ -134,5 +135,5 @@ private BitBuffer writeOneStringStructureToBitBuffer(String oneString) throws IO private static final String BLOB_NAME = "one_string_structure.blob"; private static final String ONE_STRING = "This is a string!"; - private static final int ONE_STRING_STRUCTURE_BIT_SIZE = (1 + ONE_STRING.length()) * 8; + private static final int ONE_STRING_STRUCTURE_BIT_SIZE = (1 + ONE_STRING.length()) * 8; } diff --git a/test/language/structure_types/java/structure_types/SimpleStructureTest.java b/test/language/structure_types/java/structure_types/SimpleStructureTest.java index e1db77c91..d1849bad8 100644 --- a/test/language/structure_types/java/structure_types/SimpleStructureTest.java +++ b/test/language/structure_types/java/structure_types/SimpleStructureTest.java @@ -1,11 +1,10 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import structure_types.simple_structure.SimpleStructure; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitBuffer; @@ -13,6 +12,8 @@ import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import structure_types.simple_structure.SimpleStructure; + public class SimpleStructureTest { @Test @@ -158,8 +159,8 @@ public void writeRead() throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); simpleStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final SimpleStructure readsimpleStructure = new SimpleStructure(reader); assertEquals(numberA, readsimpleStructure.getNumberA()); assertEquals(numberB, readsimpleStructure.getNumberB()); diff --git a/test/language/structure_types/java/structure_types/StructureInnerClassesClashingTest.java b/test/language/structure_types/java/structure_types/StructureInnerClassesClashingTest.java index a7bd02d17..5232848ae 100644 --- a/test/language/structure_types/java/structure_types/StructureInnerClassesClashingTest.java +++ b/test/language/structure_types/java/structure_types/StructureInnerClassesClashingTest.java @@ -1,18 +1,19 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import structure_types.structure_inner_classes_clashing.ArrayType_array; -import structure_types.structure_inner_classes_clashing.OffsetChecker_array; -import structure_types.structure_inner_classes_clashing.OffsetInitializer_array; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import structure_types.structure_inner_classes_clashing.ArrayType_array; +import structure_types.structure_inner_classes_clashing.OffsetChecker_array; +import structure_types.structure_inner_classes_clashing.OffsetInitializer_array; + public class StructureInnerClassesClashingTest { @Test @@ -23,8 +24,8 @@ public void writeReadArrayType() throws IOException, ZserioError final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final ArrayType_array readTestStructure = new ArrayType_array(reader); assertEquals(testStructure, readTestStructure); } @@ -32,15 +33,14 @@ public void writeReadArrayType() throws IOException, ZserioError @Test public void writeReadOffsetChecker() throws IOException, ZserioError { - final OffsetChecker_array testStructure = new OffsetChecker_array( - new long[4], new long[] {1, 2, 3, 4}); + final OffsetChecker_array testStructure = new OffsetChecker_array(new long[4], new long[] {1, 2, 3, 4}); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testStructure.initializeOffsets(writer.getBitPosition()); testStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OffsetChecker_array readTestStructure = new OffsetChecker_array(reader); assertEquals(testStructure, readTestStructure); } @@ -48,15 +48,15 @@ public void writeReadOffsetChecker() throws IOException, ZserioError @Test public void writeReadOffsetInitializer() throws IOException, ZserioError { - final OffsetInitializer_array testStructure = new OffsetInitializer_array( - new long[4], new long[] {1, 2, 3, 4}); + final OffsetInitializer_array testStructure = + new OffsetInitializer_array(new long[4], new long[] {1, 2, 3, 4}); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testStructure.initializeOffsets(writer.getBitPosition()); testStructure.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final OffsetInitializer_array readTestStructure = new OffsetInitializer_array(reader); assertEquals(testStructure, readTestStructure); } diff --git a/test/language/structure_types/java/structure_types/StructureWithRemovedEnumItemFieldTest.java b/test/language/structure_types/java/structure_types/StructureWithRemovedEnumItemFieldTest.java index ee8752f70..b4b1739f0 100644 --- a/test/language/structure_types/java/structure_types/StructureWithRemovedEnumItemFieldTest.java +++ b/test/language/structure_types/java/structure_types/StructureWithRemovedEnumItemFieldTest.java @@ -1,19 +1,21 @@ package structure_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; + import static test_utils.AssertionUtils.assertJsonEquals; import java.io.IOException; -import structure_types.structure_with_removed_enum_item_field.StructureWithRemovedEnumItemField; -import structure_types.structure_with_removed_enum_item_field.Enumeration; +import org.junit.jupiter.api.Test; +import zserio.runtime.DebugStringUtil; +import zserio.runtime.ZserioError; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.SerializeUtil; -import zserio.runtime.DebugStringUtil; -import zserio.runtime.ZserioError; + +import structure_types.structure_with_removed_enum_item_field.Enumeration; +import structure_types.structure_with_removed_enum_item_field.StructureWithRemovedEnumItemField; public class StructureWithRemovedEnumItemFieldTest { @@ -74,8 +76,8 @@ public void toJsonString() @Test public void fromJsonString() { - final Object zserioObject = DebugStringUtil.fromJsonString(StructureWithRemovedEnumItemField.class, - "{\n \"enumeration\": \"REMOVED\"\n}"); + final Object zserioObject = DebugStringUtil.fromJsonString( + StructureWithRemovedEnumItemField.class, "{\n \"enumeration\": \"REMOVED\"\n}"); assertNotNull(zserioObject); assertInstanceOf(StructureWithRemovedEnumItemField.class, zserioObject); final StructureWithRemovedEnumItemField structureWithRemovedEnumItemField = diff --git a/test/language/subtypes/build.xml b/test/language/subtypes/build.xml index bead8a5cf..c2b7cd75b 100644 --- a/test/language/subtypes/build.xml +++ b/test/language/subtypes/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/subtypes/java/subtypes/BitmaskSubtypeTest.java b/test/language/subtypes/java/subtypes/BitmaskSubtypeTest.java index 551fb8a3c..28da1f1b5 100644 --- a/test/language/subtypes/java/subtypes/BitmaskSubtypeTest.java +++ b/test/language/subtypes/java/subtypes/BitmaskSubtypeTest.java @@ -1,10 +1,11 @@ package subtypes; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import subtypes.bitmask_subtype.Permission; import subtypes.bitmask_subtype.CONST_READ; +import subtypes.bitmask_subtype.Permission; public class BitmaskSubtypeTest { diff --git a/test/language/subtypes/java/subtypes/EnumSubtypeTest.java b/test/language/subtypes/java/subtypes/EnumSubtypeTest.java index 2253448e8..ab953f883 100644 --- a/test/language/subtypes/java/subtypes/EnumSubtypeTest.java +++ b/test/language/subtypes/java/subtypes/EnumSubtypeTest.java @@ -1,10 +1,11 @@ package subtypes; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import subtypes.enum_subtype.Color; import subtypes.enum_subtype.CONST_BLACK; +import subtypes.enum_subtype.Color; public class EnumSubtypeTest { diff --git a/test/language/subtypes/java/subtypes/ParamStructureSubtypeTest.java b/test/language/subtypes/java/subtypes/ParamStructureSubtypeTest.java index c56745744..02284b6ac 100644 --- a/test/language/subtypes/java/subtypes/ParamStructureSubtypeTest.java +++ b/test/language/subtypes/java/subtypes/ParamStructureSubtypeTest.java @@ -1,6 +1,7 @@ package subtypes; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import subtypes.param_structure_subtype.ParameterizedStruct; @@ -12,14 +13,13 @@ public class ParamStructureSubtypeTest public void testSubtype() { // check that correct type is used instead of subtype (Java has nothing like a typedef) - final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(10); + final ParameterizedStruct parameterizedStruct = new ParameterizedStruct(10); final ParameterizedSubtypeStruct parameterizedSubtypeStruct = new ParameterizedSubtypeStruct(); parameterizedSubtypeStruct.setLength(10); parameterizedSubtypeStruct.setParameterizedSubtype(parameterizedStruct); - final ParameterizedStruct[] parameterizedStructArray = new ParameterizedStruct[] { - new ParameterizedStruct(10) - }; + final ParameterizedStruct[] parameterizedStructArray = + new ParameterizedStruct[] {new ParameterizedStruct(10)}; parameterizedSubtypeStruct.setParameterizedSubtypeArray(parameterizedStructArray); // it's enough that the code above compiles ok, just check something diff --git a/test/language/subtypes/java/subtypes/StructureSubtypeTest.java b/test/language/subtypes/java/subtypes/StructureSubtypeTest.java index ffc130259..914389559 100644 --- a/test/language/subtypes/java/subtypes/StructureSubtypeTest.java +++ b/test/language/subtypes/java/subtypes/StructureSubtypeTest.java @@ -1,10 +1,11 @@ package subtypes; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import subtypes.structure_subtype.TestStructure; import subtypes.structure_subtype.SubtypeStructure; +import subtypes.structure_subtype.TestStructure; public class StructureSubtypeTest { diff --git a/test/language/subtypes/java/subtypes/SubtypeImportedTest.java b/test/language/subtypes/java/subtypes/SubtypeImportedTest.java index 0627c1881..2a09c5a7d 100644 --- a/test/language/subtypes/java/subtypes/SubtypeImportedTest.java +++ b/test/language/subtypes/java/subtypes/SubtypeImportedTest.java @@ -1,10 +1,11 @@ package subtypes; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -21,8 +22,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); subtypeImported.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); SubtypeImported readSubtypeImported = new SubtypeImported(reader); assertTrue(subtypeImported.equals(readSubtypeImported)); } diff --git a/test/language/subtypes/java/subtypes/UInt16SubtypeTest.java b/test/language/subtypes/java/subtypes/UInt16SubtypeTest.java index f77b80a54..6710d5fab 100644 --- a/test/language/subtypes/java/subtypes/UInt16SubtypeTest.java +++ b/test/language/subtypes/java/subtypes/UInt16SubtypeTest.java @@ -1,6 +1,7 @@ package subtypes; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import subtypes.uint16_subtype.TestStructure; diff --git a/test/language/templates/build.xml b/test/language/templates/build.xml index adb93609c..6749379a7 100644 --- a/test/language/templates/build.xml +++ b/test/language/templates/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/templates/java/templates/ChoiceTemplatedEnumSelectorTest.java b/test/language/templates/java/templates/ChoiceTemplatedEnumSelectorTest.java index 81eb48881..6972bf924 100644 --- a/test/language/templates/java/templates/ChoiceTemplatedEnumSelectorTest.java +++ b/test/language/templates/java/templates/ChoiceTemplatedEnumSelectorTest.java @@ -1,19 +1,20 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.choice_templated_enum_selector.ChoiceTemplatedEnumSelector; -import templates.choice_templated_enum_selector.TemplatedChoice_EnumFromZero; -import templates.choice_templated_enum_selector.TemplatedChoice_EnumFromOne; -import templates.choice_templated_enum_selector.EnumFromZero; import templates.choice_templated_enum_selector.EnumFromOne; +import templates.choice_templated_enum_selector.EnumFromZero; +import templates.choice_templated_enum_selector.TemplatedChoice_EnumFromOne; +import templates.choice_templated_enum_selector.TemplatedChoice_EnumFromZero; public class ChoiceTemplatedEnumSelectorTest { @@ -37,8 +38,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); choiceTemplatedEnumSelector.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); ChoiceTemplatedEnumSelector readChoiceTemplatedEnumSelector = new ChoiceTemplatedEnumSelector(reader); assertTrue(choiceTemplatedEnumSelector.equals(readChoiceTemplatedEnumSelector)); } diff --git a/test/language/templates/java/templates/ChoiceTemplatedFieldTest.java b/test/language/templates/java/templates/ChoiceTemplatedFieldTest.java index 71ba76937..2fb8195ee 100644 --- a/test/language/templates/java/templates/ChoiceTemplatedFieldTest.java +++ b/test/language/templates/java/templates/ChoiceTemplatedFieldTest.java @@ -1,18 +1,19 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.choice_templated_field.ChoiceTemplatedField; -import templates.choice_templated_field.TemplatedChoice_uint32_uint16; -import templates.choice_templated_field.TemplatedChoice_Compound_uint32_uint16; import templates.choice_templated_field.Compound_uint32; +import templates.choice_templated_field.TemplatedChoice_Compound_uint32_uint16; +import templates.choice_templated_field.TemplatedChoice_uint32_uint16; public class ChoiceTemplatedFieldTest { @@ -27,15 +28,16 @@ public void readWrite() throws IOException choice1.setTemplatedField1(42); choiceTemplatedField.setChoice1(choice1); - final TemplatedChoice_Compound_uint32_uint16 choice2 = new TemplatedChoice_Compound_uint32_uint16(selector); + final TemplatedChoice_Compound_uint32_uint16 choice2 = + new TemplatedChoice_Compound_uint32_uint16(selector); choice2.setTemplatedField1(new Compound_uint32(42)); choiceTemplatedField.setChoice2(choice2); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); choiceTemplatedField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); ChoiceTemplatedField readChoiceTemplatedField = new ChoiceTemplatedField(reader); assertTrue(choiceTemplatedField.equals(readChoiceTemplatedField)); } diff --git a/test/language/templates/java/templates/ChoiceTemplatedSelectorTest.java b/test/language/templates/java/templates/ChoiceTemplatedSelectorTest.java index 775f080c6..c46334909 100644 --- a/test/language/templates/java/templates/ChoiceTemplatedSelectorTest.java +++ b/test/language/templates/java/templates/ChoiceTemplatedSelectorTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.choice_templated_selector.ChoiceTemplatedSelector; -import templates.choice_templated_selector.TemplatedChoice_uint32_Shift32; import templates.choice_templated_selector.TemplatedChoice_uint16_Shift16; +import templates.choice_templated_selector.TemplatedChoice_uint32_Shift32; public class ChoiceTemplatedSelectorTest { @@ -35,8 +36,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); choiceTemplatedSelector.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); ChoiceTemplatedSelector readChoiceTemplatedSelector = new ChoiceTemplatedSelector(reader); assertTrue(choiceTemplatedSelector.equals(readChoiceTemplatedSelector)); } diff --git a/test/language/templates/java/templates/ExpressionBitmaskTemplateArgumentTest.java b/test/language/templates/java/templates/ExpressionBitmaskTemplateArgumentTest.java index 646cc8678..13dd310ac 100644 --- a/test/language/templates/java/templates/ExpressionBitmaskTemplateArgumentTest.java +++ b/test/language/templates/java/templates/ExpressionBitmaskTemplateArgumentTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -26,8 +27,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); bitmaskTemplateArgumentHolder.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final BitmaskTemplateArgumentHolder readBitmaskTemplateArgumentHolder = new BitmaskTemplateArgumentHolder(reader); assertTrue(bitmaskTemplateArgumentHolder.equals(readBitmaskTemplateArgumentHolder)); diff --git a/test/language/templates/java/templates/ExpressionEnumTemplateArgumentConflictTest.java b/test/language/templates/java/templates/ExpressionEnumTemplateArgumentConflictTest.java index 698803182..4066ffbd7 100644 --- a/test/language/templates/java/templates/ExpressionEnumTemplateArgumentConflictTest.java +++ b/test/language/templates/java/templates/ExpressionEnumTemplateArgumentConflictTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -26,8 +27,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); enumTemplateArgumentConflictHolder.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final EnumTemplateArgumentConflictHolder readEnumTemplateArgumentConflictHolder = new EnumTemplateArgumentConflictHolder(reader); assertTrue(enumTemplateArgumentConflictHolder.equals(readEnumTemplateArgumentConflictHolder)); diff --git a/test/language/templates/java/templates/ExpressionEnumTemplateArgumentTest.java b/test/language/templates/java/templates/ExpressionEnumTemplateArgumentTest.java index b629239c0..d3c9d98ea 100644 --- a/test/language/templates/java/templates/ExpressionEnumTemplateArgumentTest.java +++ b/test/language/templates/java/templates/ExpressionEnumTemplateArgumentTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); enumTemplateArgumentHolder.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final EnumTemplateArgumentHolder readEnumTemplateArgumentHolder = new EnumTemplateArgumentHolder(reader); assertTrue(enumTemplateArgumentHolder.equals(readEnumTemplateArgumentHolder)); diff --git a/test/language/templates/java/templates/ExpressionFullTemplateArgumentTest.java b/test/language/templates/java/templates/ExpressionFullTemplateArgumentTest.java index 0e5346858..15ddb465d 100644 --- a/test/language/templates/java/templates/ExpressionFullTemplateArgumentTest.java +++ b/test/language/templates/java/templates/ExpressionFullTemplateArgumentTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -30,8 +31,8 @@ public void readWrite() throws IOException new FullTemplateArgumentHolder(colorInternal, colorExternal); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); fullTemplateArgumentHolder.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final FullTemplateArgumentHolder readFullTemplateArgumentHolder = new FullTemplateArgumentHolder(reader); diff --git a/test/language/templates/java/templates/FunctionTemplatedReturnTypeTest.java b/test/language/templates/java/templates/FunctionTemplatedReturnTypeTest.java index 46360caeb..b7a1baa89 100644 --- a/test/language/templates/java/templates/FunctionTemplatedReturnTypeTest.java +++ b/test/language/templates/java/templates/FunctionTemplatedReturnTypeTest.java @@ -1,21 +1,21 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.function_templated_return_type.FunctionTemplatedReturnType; -import templates.function_templated_return_type.TestStructure_uint32; -import templates.function_templated_return_type.TestStructure_string; -import templates.function_templated_return_type.TestStructure_float32; -import templates.function_templated_return_type.Holder_uint32; import templates.function_templated_return_type.Holder_string; - +import templates.function_templated_return_type.Holder_uint32; +import templates.function_templated_return_type.TestStructure_float32; +import templates.function_templated_return_type.TestStructure_string; +import templates.function_templated_return_type.TestStructure_uint32; public class FunctionTemplatedReturnTypeTest { @@ -42,8 +42,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); functionTemplatedReturnType.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final FunctionTemplatedReturnType readFunctionTemplatedReturnType = new FunctionTemplatedReturnType(reader); diff --git a/test/language/templates/java/templates/InstantiateClashOtherTemplateTest.java b/test/language/templates/java/templates/InstantiateClashOtherTemplateTest.java index b55a476a2..910b3565b 100644 --- a/test/language/templates/java/templates/InstantiateClashOtherTemplateTest.java +++ b/test/language/templates/java/templates/InstantiateClashOtherTemplateTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,8 +25,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateClashOtherTemplate.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateClashOtherTemplate readInstantiateClashOtherTemplate = new InstantiateClashOtherTemplate(reader); assertTrue(instantiateClashOtherTemplate.equals(readInstantiateClashOtherTemplate)); diff --git a/test/language/templates/java/templates/InstantiateImportedTest.java b/test/language/templates/java/templates/InstantiateImportedTest.java index e8b3c3288..3659f4cae 100644 --- a/test/language/templates/java/templates/InstantiateImportedTest.java +++ b/test/language/templates/java/templates/InstantiateImportedTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_imported.InstantiateImported; -import templates.instantiate_imported.pkg.U32; import templates.instantiate_imported.Test_string; +import templates.instantiate_imported.pkg.U32; public class InstantiateImportedTest { @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateImported.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateImported readInstantiateImported = new InstantiateImported(reader); assertTrue(instantiateImported.equals(readInstantiateImported)); } diff --git a/test/language/templates/java/templates/InstantiateNestedTemplateTest.java b/test/language/templates/java/templates/InstantiateNestedTemplateTest.java index 0e95d8199..7f6000751 100644 --- a/test/language/templates/java/templates/InstantiateNestedTemplateTest.java +++ b/test/language/templates/java/templates/InstantiateNestedTemplateTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_nested_template.InstantiateNestedTemplate; -import templates.instantiate_nested_template.TStr; import templates.instantiate_nested_template.NStr; +import templates.instantiate_nested_template.TStr; public class InstantiateNestedTemplateTest { @@ -24,8 +25,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateNestedTemplate.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateNestedTemplate readInstantiateNestedTemplate = new InstantiateNestedTemplate(reader); assertTrue(instantiateNestedTemplate.equals(readInstantiateNestedTemplate)); } diff --git a/test/language/templates/java/templates/InstantiateNotImportedTest.java b/test/language/templates/java/templates/InstantiateNotImportedTest.java index 414f6e3f2..b9f457416 100644 --- a/test/language/templates/java/templates/InstantiateNotImportedTest.java +++ b/test/language/templates/java/templates/InstantiateNotImportedTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_not_imported.InstantiateNotImported; -import templates.instantiate_not_imported.pkg.Test_uint32; import templates.instantiate_not_imported.pkg.Test_string; +import templates.instantiate_not_imported.pkg.Test_uint32; public class InstantiateNotImportedTest { @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateNotImported.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateNotImported readInstantiateNotImported = new InstantiateNotImported(reader); assertTrue(instantiateNotImported.equals(readInstantiateNotImported)); } diff --git a/test/language/templates/java/templates/InstantiateOnlyNestedTest.java b/test/language/templates/java/templates/InstantiateOnlyNestedTest.java index 38e79f93e..4984cd827 100644 --- a/test/language/templates/java/templates/InstantiateOnlyNestedTest.java +++ b/test/language/templates/java/templates/InstantiateOnlyNestedTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,10 +25,9 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateOnlyNested.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateOnlyNested readInstantiateOnlyNested = new InstantiateOnlyNested(reader); assertTrue(instantiateOnlyNested.equals(readInstantiateOnlyNested)); } - } diff --git a/test/language/templates/java/templates/InstantiateSimpleTest.java b/test/language/templates/java/templates/InstantiateSimpleTest.java index cdb35f2d1..101be74bf 100644 --- a/test/language/templates/java/templates/InstantiateSimpleTest.java +++ b/test/language/templates/java/templates/InstantiateSimpleTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -23,8 +24,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateSimple.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateSimple readInstantiateSimple = new InstantiateSimple(reader); assertTrue(instantiateSimple.equals(readInstantiateSimple)); } diff --git a/test/language/templates/java/templates/InstantiateSqlTableTest.java b/test/language/templates/java/templates/InstantiateSqlTableTest.java index 9579506d8..b8ed1750b 100644 --- a/test/language/templates/java/templates/InstantiateSqlTableTest.java +++ b/test/language/templates/java/templates/InstantiateSqlTableTest.java @@ -1,21 +1,21 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; -import java.util.Properties; -import java.util.List; import java.util.ArrayList; +import java.util.List; +import java.util.Properties; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import templates.instantiate_sql_table.U32Table; import templates.instantiate_sql_table.U32TableRow; +import test_utils.JdbcUtil; public class InstantiateSqlTableTest { diff --git a/test/language/templates/java/templates/InstantiateTemplateArgumentTest.java b/test/language/templates/java/templates/InstantiateTemplateArgumentTest.java index 0c7929cd0..6c90f1fce 100644 --- a/test/language/templates/java/templates/InstantiateTemplateArgumentTest.java +++ b/test/language/templates/java/templates/InstantiateTemplateArgumentTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,8 +25,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTemplateArgument readInstantiateTemplateArgument = new InstantiateTemplateArgument(reader); assertTrue(instantiateTemplateArgument.equals(readInstantiateTemplateArgument)); } diff --git a/test/language/templates/java/templates/InstantiateTypeAsChoiceFieldTest.java b/test/language/templates/java/templates/InstantiateTypeAsChoiceFieldTest.java index 3305e0ba4..059efe92e 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsChoiceFieldTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsChoiceFieldTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -17,14 +18,15 @@ public class InstantiateTypeAsChoiceFieldTest @Test public void readWrite() throws IOException { - final InstantiateTypeAsChoiceField instantiateTypeAsChoiceField = new InstantiateTypeAsChoiceField(true); + final InstantiateTypeAsChoiceField instantiateTypeAsChoiceField = + new InstantiateTypeAsChoiceField(true); instantiateTypeAsChoiceField.setTest(new Test32(13)); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeAsChoiceField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeAsChoiceField readInstantiateTypeAsChoiceField = new InstantiateTypeAsChoiceField(reader, true); assertTrue(instantiateTypeAsChoiceField.equals(readInstantiateTypeAsChoiceField)); diff --git a/test/language/templates/java/templates/InstantiateTypeAsParameterTest.java b/test/language/templates/java/templates/InstantiateTypeAsParameterTest.java index e2b4b7fc6..79c2749ab 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsParameterTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsParameterTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -19,17 +20,17 @@ public class InstantiateTypeAsParameterTest public void readWrite() throws IOException { final P32 param = new P32(2); - final long[] array = new long[] { 13, 42 }; + final long[] array = new long[] {13, 42}; final Parameterized_P32 parameterized = new Parameterized_P32(param, array); - final InstantiateTypeAsParameter instantiateTypeAsParameter = new InstantiateTypeAsParameter( - param, parameterized); + final InstantiateTypeAsParameter instantiateTypeAsParameter = + new InstantiateTypeAsParameter(param, parameterized); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeAsParameter.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeAsParameter readInstantiateTypeAsParameter = new InstantiateTypeAsParameter(reader); assertTrue(instantiateTypeAsParameter.equals(readInstantiateTypeAsParameter)); } diff --git a/test/language/templates/java/templates/InstantiateTypeAsSqlDatabaseFieldTest.java b/test/language/templates/java/templates/InstantiateTypeAsSqlDatabaseFieldTest.java index 08f80d250..0236e456f 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsSqlDatabaseFieldTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsSqlDatabaseFieldTest.java @@ -1,22 +1,22 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.SQLException; -import java.util.List; import java.util.ArrayList; +import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import templates.instantiate_type_as_sql_database_field.InstantiateTypeAsSqlDatabaseFieldDb; import templates.instantiate_type_as_sql_database_field.StringTable; import templates.instantiate_type_as_sql_database_field.StringTableRow; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class InstantiateTypeAsSqlDatabaseFieldTest { diff --git a/test/language/templates/java/templates/InstantiateTypeAsSqlTableFieldTest.java b/test/language/templates/java/templates/InstantiateTypeAsSqlTableFieldTest.java index c539e4083..84fa359d0 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsSqlTableFieldTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsSqlTableFieldTest.java @@ -1,22 +1,22 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; -import java.util.Properties; -import java.util.List; import java.util.ArrayList; +import java.util.List; +import java.util.Properties; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import templates.instantiate_type_as_sql_table_field.Test32; import templates.instantiate_type_as_sql_table_field.Test32Table; import templates.instantiate_type_as_sql_table_field.Test32TableRow; -import templates.instantiate_type_as_sql_table_field.Test32; +import test_utils.JdbcUtil; public class InstantiateTypeAsSqlTableFieldTest { diff --git a/test/language/templates/java/templates/InstantiateTypeAsStructArrayFieldTest.java b/test/language/templates/java/templates/InstantiateTypeAsStructArrayFieldTest.java index 70a87ca52..53942b0c6 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsStructArrayFieldTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsStructArrayFieldTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -20,13 +21,13 @@ public void readWrite() throws IOException final InstantiateTypeAsStructArrayField instantiateTypeAsStructArrayField = new InstantiateTypeAsStructArrayField(); instantiateTypeAsStructArrayField.setTest( - new Test32[] { new Test32(13), new Test32(17),new Test32(23) }); + new Test32[] {new Test32(13), new Test32(17), new Test32(23)}); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeAsStructArrayField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeAsStructArrayField readInstantiateTypeAsStructArrayField = new InstantiateTypeAsStructArrayField(reader); assertTrue(instantiateTypeAsStructArrayField.equals(readInstantiateTypeAsStructArrayField)); diff --git a/test/language/templates/java/templates/InstantiateTypeAsStructFieldTest.java b/test/language/templates/java/templates/InstantiateTypeAsStructFieldTest.java index 3131d45a6..240f0229d 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsStructFieldTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsStructFieldTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -23,8 +24,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeAsStructField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeAsStructField readInstantiateTypeAsStructField = new InstantiateTypeAsStructField(reader); assertTrue(instantiateTypeAsStructField.equals(readInstantiateTypeAsStructField)); diff --git a/test/language/templates/java/templates/InstantiateTypeAsTemplateArgumentTest.java b/test/language/templates/java/templates/InstantiateTypeAsTemplateArgumentTest.java index dd8a2f4c1..b5f336f84 100644 --- a/test/language/templates/java/templates/InstantiateTypeAsTemplateArgumentTest.java +++ b/test/language/templates/java/templates/InstantiateTypeAsTemplateArgumentTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,8 +25,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeAsTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeAsTemplateArgument readInstantiateTypeAsTemplateArgument = new InstantiateTypeAsTemplateArgument(reader); assertTrue(instantiateTypeAsTemplateArgument.equals(readInstantiateTypeAsTemplateArgument)); diff --git a/test/language/templates/java/templates/InstantiateTypeImportedAsStructFieldTest.java b/test/language/templates/java/templates/InstantiateTypeImportedAsStructFieldTest.java index 2005e4206..b30db55fb 100644 --- a/test/language/templates/java/templates/InstantiateTypeImportedAsStructFieldTest.java +++ b/test/language/templates/java/templates/InstantiateTypeImportedAsStructFieldTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -24,8 +25,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeImportedAsStructField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeImportedAsStructField readInstantiateTypeImportedAsStructField = new InstantiateTypeImportedAsStructField(reader); assertTrue(instantiateTypeImportedAsStructField.equals(readInstantiateTypeImportedAsStructField)); diff --git a/test/language/templates/java/templates/InstantiateTypeOnParameterizedTemplateTest.java b/test/language/templates/java/templates/InstantiateTypeOnParameterizedTemplateTest.java index d2c1c62ba..77120afa5 100644 --- a/test/language/templates/java/templates/InstantiateTypeOnParameterizedTemplateTest.java +++ b/test/language/templates/java/templates/InstantiateTypeOnParameterizedTemplateTest.java @@ -1,24 +1,25 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_type_on_parameterized_template.InstantiateTypeOnParameterizedTemplate; -import templates.instantiate_type_on_parameterized_template.TestP; import templates.instantiate_type_on_parameterized_template.Parameterized; +import templates.instantiate_type_on_parameterized_template.TestP; public class InstantiateTypeOnParameterizedTemplateTest { @Test public void readWrite() throws IOException { - final long[] array = new long[] { 13, 42 }; + final long[] array = new long[] {13, 42}; final Parameterized parameterized = new Parameterized(2, array); final InstantiateTypeOnParameterizedTemplate instantiateTypeOnParameterizedTemplate = new InstantiateTypeOnParameterizedTemplate(2, new TestP(2, parameterized)); @@ -26,8 +27,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateTypeOnParameterizedTemplate.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); InstantiateTypeOnParameterizedTemplate readInstantiateTypeOnParameterizedTemplate = new InstantiateTypeOnParameterizedTemplate(reader); assertTrue(instantiateTypeOnParameterizedTemplate.equals(readInstantiateTypeOnParameterizedTemplate)); diff --git a/test/language/templates/java/templates/InstantiateUnusedTest.java b/test/language/templates/java/templates/InstantiateUnusedTest.java index f8b3c495b..451ee00b6 100644 --- a/test/language/templates/java/templates/InstantiateUnusedTest.java +++ b/test/language/templates/java/templates/InstantiateUnusedTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -21,8 +22,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); u32.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final U32 readU32 = new U32(reader); assertTrue(u32.equals(readU32)); } diff --git a/test/language/templates/java/templates/InstantiateViaImportTest.java b/test/language/templates/java/templates/InstantiateViaImportTest.java index 020ff90dc..4c49b8b5d 100644 --- a/test/language/templates/java/templates/InstantiateViaImportTest.java +++ b/test/language/templates/java/templates/InstantiateViaImportTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_via_import.InstantiateViaImport; -import templates.instantiate_via_import.pkg.U32; import templates.instantiate_via_import.pkg.Test_string; +import templates.instantiate_via_import.pkg.U32; public class InstantiateViaImportTest { @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateViaImport.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateViaImport readInstantiateViaImport = new InstantiateViaImport(reader); assertTrue(instantiateViaImport.equals(readInstantiateViaImport)); } diff --git a/test/language/templates/java/templates/InstantiateViaSingleImportTest.java b/test/language/templates/java/templates/InstantiateViaSingleImportTest.java index e01db327d..e340e34bb 100644 --- a/test/language/templates/java/templates/InstantiateViaSingleImportTest.java +++ b/test/language/templates/java/templates/InstantiateViaSingleImportTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_via_single_import.InstantiateViaSingleImport; -import templates.instantiate_via_single_import.pkg.U32; import templates.instantiate_via_single_import.pkg.Test_string; +import templates.instantiate_via_single_import.pkg.U32; public class InstantiateViaSingleImportTest { @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateViaSingleImport.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateViaSingleImport readInstantiateViaSingleImport = new InstantiateViaSingleImport(reader); assertTrue(instantiateViaSingleImport.equals(readInstantiateViaSingleImport)); diff --git a/test/language/templates/java/templates/InstantiateVsDefaultTest.java b/test/language/templates/java/templates/InstantiateVsDefaultTest.java index 8f03fb414..240ab3c08 100644 --- a/test/language/templates/java/templates/InstantiateVsDefaultTest.java +++ b/test/language/templates/java/templates/InstantiateVsDefaultTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.instantiate_vs_default.InstantiateVsDefault; -import templates.instantiate_vs_default.pkg.Test_uint32; import templates.instantiate_vs_default.TStr; +import templates.instantiate_vs_default.pkg.Test_uint32; public class InstantiateVsDefaultTest { @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateVsDefault.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateVsDefault readInstantiateVsDefault = new InstantiateVsDefault(reader); assertTrue(instantiateVsDefault.equals(readInstantiateVsDefault)); } diff --git a/test/language/templates/java/templates/InstantiateWithInstantiateTemplateArgumentTest.java b/test/language/templates/java/templates/InstantiateWithInstantiateTemplateArgumentTest.java index c9a690f09..89345574d 100644 --- a/test/language/templates/java/templates/InstantiateWithInstantiateTemplateArgumentTest.java +++ b/test/language/templates/java/templates/InstantiateWithInstantiateTemplateArgumentTest.java @@ -1,19 +1,20 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import templates.instantiate_with_instantiate_template_argument.Data32; +import templates.instantiate_with_instantiate_template_argument.Data8; import templates.instantiate_with_instantiate_template_argument.InstantiateWithInstantiateTemplateArgument; import templates.instantiate_with_instantiate_template_argument.Other32; import templates.instantiate_with_instantiate_template_argument.Other8; -import templates.instantiate_with_instantiate_template_argument.Data32; -import templates.instantiate_with_instantiate_template_argument.Data8; public class InstantiateWithInstantiateTemplateArgumentTest { @@ -28,8 +29,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiateWithInstantiateTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiateWithInstantiateTemplateArgument readInstantiateWithInstantiateTemplateArgument = new InstantiateWithInstantiateTemplateArgument(reader); assertTrue(instantiateWithInstantiateTemplateArgument.equals( diff --git a/test/language/templates/java/templates/SqlTableTemplatedFieldTest.java b/test/language/templates/java/templates/SqlTableTemplatedFieldTest.java index 8df3f4820..3c761fbf0 100644 --- a/test/language/templates/java/templates/SqlTableTemplatedFieldTest.java +++ b/test/language/templates/java/templates/SqlTableTemplatedFieldTest.java @@ -1,27 +1,27 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; import java.sql.SQLException; -import java.util.List; import java.util.ArrayList; +import java.util.List; -import test_utils.FileUtil; -import test_utils.JdbcUtil; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import templates.sql_table_templated_field.Data_Union; +import templates.sql_table_templated_field.Data_uint32; import templates.sql_table_templated_field.SqlTableTemplatedFieldDb; -import templates.sql_table_templated_field.TemplatedTable_uint32; import templates.sql_table_templated_field.TemplatedTable_Union; -import templates.sql_table_templated_field.TemplatedTable_uint32Row; import templates.sql_table_templated_field.TemplatedTable_UnionRow; -import templates.sql_table_templated_field.Data_uint32; -import templates.sql_table_templated_field.Data_Union; +import templates.sql_table_templated_field.TemplatedTable_uint32; +import templates.sql_table_templated_field.TemplatedTable_uint32Row; import templates.sql_table_templated_field.Union; +import test_utils.FileUtil; +import test_utils.JdbcUtil; public class SqlTableTemplatedFieldTest { @@ -77,7 +77,8 @@ public void readWrite() throws IOException, SQLException readSqlTableTemplatedFieldDb.close(); } - static void assertEqualUint32Rows(List rows1, List rows2) + static void assertEqualUint32Rows( + List rows1, List rows2) { assertEquals(rows1.size(), rows2.size()); for (int i = 0; i < rows1.size(); ++i) diff --git a/test/language/templates/java/templates/StructFullAndShortTemplateArgumentTest.java b/test/language/templates/java/templates/StructFullAndShortTemplateArgumentTest.java index 343c7c3e5..5dd779e5b 100644 --- a/test/language/templates/java/templates/StructFullAndShortTemplateArgumentTest.java +++ b/test/language/templates/java/templates/StructFullAndShortTemplateArgumentTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.struct_full_and_short_template_argument.StructFullNameTemplateArgument; -import templates.struct_full_and_short_template_argument.templated_struct.StructShortNameTemplateArgument; import templates.struct_full_and_short_template_argument.templated_struct.Storage; +import templates.struct_full_and_short_template_argument.templated_struct.StructShortNameTemplateArgument; import templates.struct_full_and_short_template_argument.templated_struct.TemplatedStruct_Storage; public class StructFullAndShortTemplateArgumentTest @@ -25,8 +26,8 @@ public void readWriteFull() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structFullNameTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructFullNameTemplateArgument readStructFullNameTemplateArgument = new StructFullNameTemplateArgument(reader); assertTrue(structFullNameTemplateArgument.equals(readStructFullNameTemplateArgument)); @@ -41,8 +42,8 @@ public void readWriteShort() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structShortNameTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructShortNameTemplateArgument readStructShortNameTemplateArgument = new StructShortNameTemplateArgument(reader); assertTrue(structShortNameTemplateArgument.equals(readStructShortNameTemplateArgument)); diff --git a/test/language/templates/java/templates/StructFullNameTemplateArgumentTest.java b/test/language/templates/java/templates/StructFullNameTemplateArgumentTest.java index 60ba31c95..4bf8c0577 100644 --- a/test/language/templates/java/templates/StructFullNameTemplateArgumentTest.java +++ b/test/language/templates/java/templates/StructFullNameTemplateArgumentTest.java @@ -1,16 +1,17 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_full_name_template_argument.StructFullNameTemplateArgument; import templates.struct_full_name_template_argument.Storage; +import templates.struct_full_name_template_argument.StructFullNameTemplateArgument; import templates.struct_full_name_template_argument.TemplatedStruct_Storage_A3A4B101; import templates.struct_full_name_template_argument.TemplatedStruct_Storage_C76E422F; @@ -23,14 +24,14 @@ public void readWrite() throws IOException new StructFullNameTemplateArgument(); structFullNameTemplateArgument.setStructExternal(new TemplatedStruct_Storage_C76E422F( new templates.struct_full_name_template_argument.import_storage.Storage((long)42))); - structFullNameTemplateArgument.setStructInternal(new TemplatedStruct_Storage_A3A4B101( - new Storage("string"))); + structFullNameTemplateArgument.setStructInternal( + new TemplatedStruct_Storage_A3A4B101(new Storage("string"))); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structFullNameTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructFullNameTemplateArgument readStructFullNameTemplateArgument = new StructFullNameTemplateArgument(reader); assertTrue(structFullNameTemplateArgument.equals(readStructFullNameTemplateArgument)); diff --git a/test/language/templates/java/templates/StructLongTemplateArgumentClashTest.java b/test/language/templates/java/templates/StructLongTemplateArgumentClashTest.java index d9721d388..965e2cae5 100644 --- a/test/language/templates/java/templates/StructLongTemplateArgumentClashTest.java +++ b/test/language/templates/java/templates/StructLongTemplateArgumentClashTest.java @@ -1,21 +1,20 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.struct_long_template_argument_clash.StructLongTemplateArgumentClash; +import templates.struct_long_template_argument_clash.TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_1B45EF08; +import templates.struct_long_template_argument_clash.TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_619A1B35; import templates.struct_long_template_argument_clash.ThisIsVeryVeryVeryLongNamedStructure; import templates.struct_long_template_argument_clash.ThisIsVeryVeryVeryLongNamedStructure_; -import templates.struct_long_template_argument_clash. - TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_619A1B35; -import templates.struct_long_template_argument_clash. - TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_1B45EF08; public class StructLongTemplateArgumentClashTest { @@ -38,8 +37,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structLongTemplateArgumentClash.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructLongTemplateArgumentClash readStructLongTemplateArgumentClash = new StructLongTemplateArgumentClash(reader); assertTrue(structLongTemplateArgumentClash.equals(readStructLongTemplateArgumentClash)); diff --git a/test/language/templates/java/templates/StructLongTemplateArgumentTest.java b/test/language/templates/java/templates/StructLongTemplateArgumentTest.java index 5c68c1749..8a25d5ccb 100644 --- a/test/language/templates/java/templates/StructLongTemplateArgumentTest.java +++ b/test/language/templates/java/templates/StructLongTemplateArgumentTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.struct_long_template_argument.StructLongTemplateArgument; -import templates.struct_long_template_argument.ThisIsVeryVeryVeryLongNamedStructure; import templates.struct_long_template_argument.TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_ThisIsVery_; +import templates.struct_long_template_argument.ThisIsVeryVeryVeryLongNamedStructure; public class StructLongTemplateArgumentTest { @@ -28,8 +29,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structLongTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructLongTemplateArgument readStructLongTemplateArgument = new StructLongTemplateArgument(reader); assertTrue(structLongTemplateArgument.equals(readStructLongTemplateArgument)); diff --git a/test/language/templates/java/templates/StructRecursiveTemplateTest.java b/test/language/templates/java/templates/StructRecursiveTemplateTest.java index 843cf0d2a..949289e37 100644 --- a/test/language/templates/java/templates/StructRecursiveTemplateTest.java +++ b/test/language/templates/java/templates/StructRecursiveTemplateTest.java @@ -1,20 +1,21 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_recursive_template.StructRecursiveTemplate; -import templates.struct_recursive_template.Compound_uint32; +import templates.struct_recursive_template.Compound_Compound_Compound_string; +import templates.struct_recursive_template.Compound_Compound_string; import templates.struct_recursive_template.Compound_Compound_uint32; import templates.struct_recursive_template.Compound_string; -import templates.struct_recursive_template.Compound_Compound_string; -import templates.struct_recursive_template.Compound_Compound_Compound_string; +import templates.struct_recursive_template.Compound_uint32; +import templates.struct_recursive_template.StructRecursiveTemplate; public class StructRecursiveTemplateTest { @@ -22,16 +23,15 @@ public class StructRecursiveTemplateTest public void readWrite() throws IOException { final StructRecursiveTemplate structRecursiveTemplate = new StructRecursiveTemplate(); - structRecursiveTemplate.setCompound1(new Compound_Compound_uint32( - new Compound_uint32(42))); + structRecursiveTemplate.setCompound1(new Compound_Compound_uint32(new Compound_uint32(42))); structRecursiveTemplate.setCompound2(new Compound_Compound_Compound_string( new Compound_Compound_string(new Compound_string("string")))); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structRecursiveTemplate.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructRecursiveTemplate readStructRecursiveTemplate = new StructRecursiveTemplate(reader); assertTrue(structRecursiveTemplate.equals(readStructRecursiveTemplate)); } diff --git a/test/language/templates/java/templates/StructTemplateClashAcrossPackagesTest.java b/test/language/templates/java/templates/StructTemplateClashAcrossPackagesTest.java index 19b5eb902..4046eeac7 100644 --- a/test/language/templates/java/templates/StructTemplateClashAcrossPackagesTest.java +++ b/test/language/templates/java/templates/StructTemplateClashAcrossPackagesTest.java @@ -1,18 +1,19 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; import templates.struct_template_clash_across_packages.pkg1.InstantiationInPkg1; import templates.struct_template_clash_across_packages.pkg2.InstantiationInPkg2; -import templates.struct_template_clash_across_packages.test_struct.TestStruct_Test_67B82BA5; import templates.struct_template_clash_across_packages.test_struct.TestStruct_Test_639610D0; +import templates.struct_template_clash_across_packages.test_struct.TestStruct_Test_67B82BA5; public class StructTemplateClashAcrossPackagesTest { @@ -26,8 +27,8 @@ public void readWriteInPkg1() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiationInPkg1.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiationInPkg1 readInstantiationInPkg1 = new InstantiationInPkg1(reader); assertTrue(instantiationInPkg1.equals(readInstantiationInPkg1)); } @@ -42,8 +43,8 @@ public void readWriteInPkg2() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiationInPkg2.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiationInPkg2 readInstantiationInPkg2 = new InstantiationInPkg2(reader); assertTrue(instantiationInPkg2.equals(readInstantiationInPkg2)); } diff --git a/test/language/templates/java/templates/StructTemplateClashOtherTemplateTest.java b/test/language/templates/java/templates/StructTemplateClashOtherTemplateTest.java index 0e5e8ca5c..fd6e9be1b 100644 --- a/test/language/templates/java/templates/StructTemplateClashOtherTemplateTest.java +++ b/test/language/templates/java/templates/StructTemplateClashOtherTemplateTest.java @@ -1,16 +1,17 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_template_clash_other_template.InstantiationNameClashOtherTemplate; import templates.struct_template_clash_other_template.A_uint32; +import templates.struct_template_clash_other_template.InstantiationNameClashOtherTemplate; import templates.struct_template_clash_other_template.Test_A_uint32_5D68B0C2; import templates.struct_template_clash_other_template.Test_A_uint32_FA82A3B7; @@ -21,14 +22,13 @@ public void readWrite() throws IOException { final InstantiationNameClashOtherTemplate instantiationNameClashOtherTemplate = new InstantiationNameClashOtherTemplate( - new Test_A_uint32_FA82A3B7(42), - new Test_A_uint32_5D68B0C2(new A_uint32(10))); + new Test_A_uint32_FA82A3B7(42), new Test_A_uint32_5D68B0C2(new A_uint32(10))); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiationNameClashOtherTemplate.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiationNameClashOtherTemplate readInstantiationNameClashOtherTemplate = new InstantiationNameClashOtherTemplate(reader); assertTrue(instantiationNameClashOtherTemplate.equals(readInstantiationNameClashOtherTemplate)); diff --git a/test/language/templates/java/templates/StructTemplateClashOtherTypeTest.java b/test/language/templates/java/templates/StructTemplateClashOtherTypeTest.java index cc8a6f2b1..fb0bd9a10 100644 --- a/test/language/templates/java/templates/StructTemplateClashOtherTypeTest.java +++ b/test/language/templates/java/templates/StructTemplateClashOtherTypeTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -23,8 +24,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiationNameClashOtherType.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiationNameClashOtherType readInstantiationNameClashOtherType = new InstantiationNameClashOtherType(reader); assertTrue(instantiationNameClashOtherType.equals(readInstantiationNameClashOtherType)); diff --git a/test/language/templates/java/templates/StructTemplateClashTest.java b/test/language/templates/java/templates/StructTemplateClashTest.java index 35fc6ac2e..c417f729c 100644 --- a/test/language/templates/java/templates/StructTemplateClashTest.java +++ b/test/language/templates/java/templates/StructTemplateClashTest.java @@ -1,30 +1,30 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_template_clash.InstantiationNameClash; -import templates.struct_template_clash.TestStruct_uint32; -import templates.struct_template_clash.Template_A_B_C_7FE93D34; -import templates.struct_template_clash.Template_A_B_C_5EB4E3FC; -import templates.struct_template_clash.A_B; -import templates.struct_template_clash.C; import templates.struct_template_clash.A; +import templates.struct_template_clash.A_B; import templates.struct_template_clash.B_C; +import templates.struct_template_clash.C; +import templates.struct_template_clash.InstantiationNameClash; +import templates.struct_template_clash.Template_A_B_C_5EB4E3FC; +import templates.struct_template_clash.Template_A_B_C_7FE93D34; +import templates.struct_template_clash.TestStruct_uint32; public class StructTemplateClashTest { @Test public void readWrite() throws IOException { - final TestStruct_uint32 testStruct_uint32 = new TestStruct_uint32( - 42, + final TestStruct_uint32 testStruct_uint32 = new TestStruct_uint32(42, new Template_A_B_C_7FE93D34(new A_B(1), new C(true)), new Template_A_B_C_5EB4E3FC(new A(1), new B_C("string"))); final InstantiationNameClash instantiationNameClash = new InstantiationNameClash(testStruct_uint32); @@ -32,8 +32,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); instantiationNameClash.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final InstantiationNameClash readInstantiationNameClash = new InstantiationNameClash(reader); assertTrue(instantiationNameClash.equals(readInstantiationNameClash)); } diff --git a/test/language/templates/java/templates/StructTemplateInTemplateTest.java b/test/language/templates/java/templates/StructTemplateInTemplateTest.java index 9c7e1af56..f9e604a43 100644 --- a/test/language/templates/java/templates/StructTemplateInTemplateTest.java +++ b/test/language/templates/java/templates/StructTemplateInTemplateTest.java @@ -1,19 +1,20 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_template_in_template.StructTemplateInTemplate; -import templates.struct_template_in_template.Field_uint32; -import templates.struct_template_in_template.Field_string; -import templates.struct_template_in_template.Compound_uint32; import templates.struct_template_in_template.Compound_string; +import templates.struct_template_in_template.Compound_uint32; +import templates.struct_template_in_template.Field_string; +import templates.struct_template_in_template.Field_uint32; +import templates.struct_template_in_template.StructTemplateInTemplate; public class StructTemplateInTemplateTest { @@ -27,8 +28,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structTemplateInTemplate.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); StructTemplateInTemplate readStructTemplateInTemplate = new StructTemplateInTemplate(reader); assertTrue(structTemplateInTemplate.equals(readStructTemplateInTemplate)); } diff --git a/test/language/templates/java/templates/StructTemplatedFieldTest.java b/test/language/templates/java/templates/StructTemplatedFieldTest.java index 9fae48780..4effd878c 100644 --- a/test/language/templates/java/templates/StructTemplatedFieldTest.java +++ b/test/language/templates/java/templates/StructTemplatedFieldTest.java @@ -1,19 +1,20 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_templated_field.StructTemplatedField; -import templates.struct_templated_field.Field_uint32; +import templates.struct_templated_field.Compound; import templates.struct_templated_field.Field_Compound; import templates.struct_templated_field.Field_string; -import templates.struct_templated_field.Compound; +import templates.struct_templated_field.Field_uint32; +import templates.struct_templated_field.StructTemplatedField; public class StructTemplatedFieldTest { @@ -28,8 +29,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structTemplatedField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final StructTemplatedField readStructTemplatedField = new StructTemplatedField(reader); assertTrue(structTemplatedField.equals(readStructTemplatedField)); } diff --git a/test/language/templates/java/templates/StructTemplatedTemplateArgumentTest.java b/test/language/templates/java/templates/StructTemplatedTemplateArgumentTest.java index 77afab1a1..5a4297381 100644 --- a/test/language/templates/java/templates/StructTemplatedTemplateArgumentTest.java +++ b/test/language/templates/java/templates/StructTemplatedTemplateArgumentTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_templated_template_argument.StructTemplatedTemplateArgument; -import templates.struct_templated_template_argument.Field_Compound_uint32; import templates.struct_templated_template_argument.Compound_uint32; +import templates.struct_templated_template_argument.Field_Compound_uint32; +import templates.struct_templated_template_argument.StructTemplatedTemplateArgument; public class StructTemplatedTemplateArgumentTest { @@ -25,8 +26,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); structTemplatedTemplateArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); StructTemplatedTemplateArgument readStructTemplatedTemplateArgument = new StructTemplatedTemplateArgument(reader); assertTrue(structTemplatedTemplateArgument.equals(readStructTemplatedTemplateArgument)); diff --git a/test/language/templates/java/templates/StructTemplatedTypeArgumentTest.java b/test/language/templates/java/templates/StructTemplatedTypeArgumentTest.java index 2ecfc7b38..7ce97695d 100644 --- a/test/language/templates/java/templates/StructTemplatedTypeArgumentTest.java +++ b/test/language/templates/java/templates/StructTemplatedTypeArgumentTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.struct_templated_type_argument.StructTemplatedTypeArgument; import templates.struct_templated_type_argument.ParamHolder_uint32; import templates.struct_templated_type_argument.Parameterized_uint32; +import templates.struct_templated_type_argument.StructTemplatedTypeArgument; public class StructTemplatedTypeArgumentTest { @@ -30,9 +31,10 @@ public void readWrite() throws IOException structTemplatedTypeArgument.initializeOffsets(writer.getBitPosition()); structTemplatedTypeArgument.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); - final StructTemplatedTypeArgument readStructTemplatedTypeArgument = new StructTemplatedTypeArgument(reader); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); + final StructTemplatedTypeArgument readStructTemplatedTypeArgument = + new StructTemplatedTypeArgument(reader); assertTrue(structTemplatedTypeArgument.equals(readStructTemplatedTypeArgument)); } } diff --git a/test/language/templates/java/templates/SubtypeTemplateArgumentTest.java b/test/language/templates/java/templates/SubtypeTemplateArgumentTest.java index 0241ca82f..eb6e7b62b 100644 --- a/test/language/templates/java/templates/SubtypeTemplateArgumentTest.java +++ b/test/language/templates/java/templates/SubtypeTemplateArgumentTest.java @@ -1,11 +1,12 @@ package templates; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import templates.subtype_template_argument.Field_uint32; import templates.subtype_template_argument.Compound; import templates.subtype_template_argument.Field_Compound; +import templates.subtype_template_argument.Field_uint32; import templates.subtype_template_argument.SubtypeTemplateArgument; public class SubtypeTemplateArgumentTest @@ -15,8 +16,8 @@ public void bitSizeOf() { final Field_uint32 field_uint32 = new Field_uint32(10); final Field_Compound field_compound = new Field_Compound(new Compound(10)); - final SubtypeTemplateArgument subtypeTemplateArgument = new SubtypeTemplateArgument(field_uint32, - field_uint32, field_uint32, field_compound, field_compound, field_compound); + final SubtypeTemplateArgument subtypeTemplateArgument = new SubtypeTemplateArgument( + field_uint32, field_uint32, field_uint32, field_compound, field_compound, field_compound); assertEquals(192, subtypeTemplateArgument.bitSizeOf()); } } diff --git a/test/language/templates/java/templates/SubtypeTemplateWithBuiltinTest.java b/test/language/templates/java/templates/SubtypeTemplateWithBuiltinTest.java index a58132995..fee84299b 100644 --- a/test/language/templates/java/templates/SubtypeTemplateWithBuiltinTest.java +++ b/test/language/templates/java/templates/SubtypeTemplateWithBuiltinTest.java @@ -1,10 +1,11 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; @@ -23,8 +24,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); subtypeTemplateWithBuiltin.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); SubtypeTemplateWithBuiltin readSubtypeTemplateWithBuiltin = new SubtypeTemplateWithBuiltin(reader); assertTrue(subtypeTemplateWithBuiltin.equals(readSubtypeTemplateWithBuiltin)); } diff --git a/test/language/templates/java/templates/SubtypeTemplateWithCompoundTest.java b/test/language/templates/java/templates/SubtypeTemplateWithCompoundTest.java index b85280a0b..d5bc19036 100644 --- a/test/language/templates/java/templates/SubtypeTemplateWithCompoundTest.java +++ b/test/language/templates/java/templates/SubtypeTemplateWithCompoundTest.java @@ -1,17 +1,18 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.subtype_template_with_compound.TestStructure_Compound_TemplateCompound_Compound; -import templates.subtype_template_with_compound.TemplateCompound_Compound; import templates.subtype_template_with_compound.Compound; +import templates.subtype_template_with_compound.TemplateCompound_Compound; +import templates.subtype_template_with_compound.TestStructure_Compound_TemplateCompound_Compound; public class SubtypeTemplateWithCompoundTest { @@ -26,8 +27,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); subtypeTemplateWithCompound.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); TestStructure_Compound_TemplateCompound_Compound readSubtypeTemplateWithCompound = new TestStructure_Compound_TemplateCompound_Compound(reader); assertTrue(subtypeTemplateWithCompound.equals(readSubtypeTemplateWithCompound)); diff --git a/test/language/templates/java/templates/TemplatedStructRecursionTest.java b/test/language/templates/java/templates/TemplatedStructRecursionTest.java index 5633742de..c6408a0fb 100644 --- a/test/language/templates/java/templates/TemplatedStructRecursionTest.java +++ b/test/language/templates/java/templates/TemplatedStructRecursionTest.java @@ -1,39 +1,32 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.templated_struct_recursion.TemplatedStructRecursion; import templates.templated_struct_recursion.RecursiveTemplate_uint32; +import templates.templated_struct_recursion.TemplatedStructRecursion; public class TemplatedStructRecursionTest { @Test public void writeRead() throws IOException { - final TemplatedStructRecursion templatedStructRecursion = new TemplatedStructRecursion( - new RecursiveTemplate_uint32( - new long[] {1, 2, 3}, - new RecursiveTemplate_uint32( - new long[] {2, 3, 4}, - new RecursiveTemplate_uint32( - new long[] {}, - null - ) - ) - ) - ); + final TemplatedStructRecursion templatedStructRecursion = + new TemplatedStructRecursion(new RecursiveTemplate_uint32(new long[] {1, 2, 3}, + new RecursiveTemplate_uint32( + new long[] {2, 3, 4}, new RecursiveTemplate_uint32(new long[] {}, null)))); final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); templatedStructRecursion.write(writer); writer.close(); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final TemplatedStructRecursion readTemplatedStructRecursion = new TemplatedStructRecursion(reader); reader.close(); diff --git a/test/language/templates/java/templates/UnionTemplatedFieldTest.java b/test/language/templates/java/templates/UnionTemplatedFieldTest.java index a8c64a99d..b15447769 100644 --- a/test/language/templates/java/templates/UnionTemplatedFieldTest.java +++ b/test/language/templates/java/templates/UnionTemplatedFieldTest.java @@ -1,20 +1,21 @@ package templates; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import templates.union_templated_field.UnionTemplatedField; -import templates.union_templated_field.TemplatedUnion_uint16_uint32; -import templates.union_templated_field.TemplatedUnion_float32_float64; -import templates.union_templated_field.TemplatedUnion_Compound_uint16_Compound_uint32; -import templates.union_templated_field.Compound_uint16; import templates.union_templated_field.Compound_Compound_uint16; +import templates.union_templated_field.Compound_uint16; +import templates.union_templated_field.TemplatedUnion_Compound_uint16_Compound_uint32; +import templates.union_templated_field.TemplatedUnion_float32_float64; +import templates.union_templated_field.TemplatedUnion_uint16_uint32; +import templates.union_templated_field.UnionTemplatedField; public class UnionTemplatedFieldTest { @@ -39,8 +40,8 @@ public void readWrite() throws IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); unionTemplatedField.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UnionTemplatedField readUnionTemplatedField = new UnionTemplatedField(reader); reader.close(); assertTrue(unionTemplatedField.equals(readUnionTemplatedField)); diff --git a/test/language/union_types/build.xml b/test/language/union_types/build.xml index 139bbc0c2..2fa7a7e94 100644 --- a/test/language/union_types/build.xml +++ b/test/language/union_types/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/language/union_types/java/union_types/EmptyUnionTest.java b/test/language/union_types/java/union_types/EmptyUnionTest.java index 4c89a09f0..435cff9f4 100644 --- a/test/language/union_types/java/union_types/EmptyUnionTest.java +++ b/test/language/union_types/java/union_types/EmptyUnionTest.java @@ -1,16 +1,17 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import union_types.empty_union.EmptyUnion; +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import union_types.empty_union.EmptyUnion; + public class EmptyUnionTest { @Test diff --git a/test/language/union_types/java/union_types/EmptyUnionWithParameterTest.java b/test/language/union_types/java/union_types/EmptyUnionWithParameterTest.java index ea6173ec8..2b19ea2e8 100644 --- a/test/language/union_types/java/union_types/EmptyUnionWithParameterTest.java +++ b/test/language/union_types/java/union_types/EmptyUnionWithParameterTest.java @@ -1,23 +1,23 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import union_types.empty_union_with_parameter.EmptyUnionWithParameter; +import org.junit.jupiter.api.Test; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import union_types.empty_union_with_parameter.EmptyUnionWithParameter; + public class EmptyUnionWithParameterTest { @Test public void emptyConstructor() { - final EmptyUnionWithParameter emptyUnionWithParameter = - new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter = new EmptyUnionWithParameter((short)1); assertEquals(1, emptyUnionWithParameter.getParam()); } @@ -27,8 +27,7 @@ public void bitStreamReaderConstructor() throws IOException final short param = 1; final BitStreamReader reader = new ByteArrayBitStreamReader(new byte[0]); - final EmptyUnionWithParameter emptyUnionWithParameter = - new EmptyUnionWithParameter(reader, param); + final EmptyUnionWithParameter emptyUnionWithParameter = new EmptyUnionWithParameter(reader, param); assertEquals(param, emptyUnionWithParameter.getParam()); assertEquals(0, emptyUnionWithParameter.bitSizeOf()); } @@ -44,8 +43,7 @@ public void getParam() @Test public void bitSizeOf() { - final EmptyUnionWithParameter emptyUnionWithParameter = - new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter = new EmptyUnionWithParameter((short)1); assertEquals(0, emptyUnionWithParameter.bitSizeOf(1)); } @@ -54,20 +52,16 @@ public void initializeOffsets() { final int bitPosition = 1; - final EmptyUnionWithParameter emptyUnionWithParameter = - new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter = new EmptyUnionWithParameter((short)1); assertEquals(bitPosition, emptyUnionWithParameter.initializeOffsets(bitPosition)); } @Test public void equals() { - final EmptyUnionWithParameter emptyUnionWithParameter1 = - new EmptyUnionWithParameter((short)1); - final EmptyUnionWithParameter emptyUnionWithParameter2 = - new EmptyUnionWithParameter((short)1); - final EmptyUnionWithParameter emptyUnionWithParameter3 = - new EmptyUnionWithParameter((short)0); + final EmptyUnionWithParameter emptyUnionWithParameter1 = new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter2 = new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter3 = new EmptyUnionWithParameter((short)0); assertTrue(emptyUnionWithParameter1.equals(emptyUnionWithParameter2)); assertFalse(emptyUnionWithParameter1.equals(emptyUnionWithParameter3)); } @@ -75,12 +69,9 @@ public void equals() @Test public void hashCodeMethod() { - final EmptyUnionWithParameter emptyUnionWithParameter1 = - new EmptyUnionWithParameter((short)1); - final EmptyUnionWithParameter emptyUnionWithParameter2 = - new EmptyUnionWithParameter((short)1); - final EmptyUnionWithParameter emptyUnionWithParameter3 = - new EmptyUnionWithParameter((short)0); + final EmptyUnionWithParameter emptyUnionWithParameter1 = new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter2 = new EmptyUnionWithParameter((short)1); + final EmptyUnionWithParameter emptyUnionWithParameter3 = new EmptyUnionWithParameter((short)0); assertEquals(emptyUnionWithParameter1.hashCode(), emptyUnionWithParameter2.hashCode()); assertTrue(emptyUnionWithParameter1.hashCode() != emptyUnionWithParameter3.hashCode()); @@ -95,8 +86,7 @@ public void read() throws IOException final short param = 1; final BitStreamReader reader = new ByteArrayBitStreamReader(new byte[0], 0); - final EmptyUnionWithParameter emptyUnionWithParameter = - new EmptyUnionWithParameter(param); + final EmptyUnionWithParameter emptyUnionWithParameter = new EmptyUnionWithParameter(param); emptyUnionWithParameter.read(reader); assertEquals(param, emptyUnionWithParameter.getParam()); assertEquals(0, emptyUnionWithParameter.bitSizeOf()); @@ -107,14 +97,12 @@ public void write() throws IOException { final short param = 1; ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); - final EmptyUnionWithParameter emptyUnionWithParameter = - new EmptyUnionWithParameter(param); + final EmptyUnionWithParameter emptyUnionWithParameter = new EmptyUnionWithParameter(param); emptyUnionWithParameter.write(writer); byte bytes[] = writer.toByteArray(); assertEquals(0, bytes.length); BitStreamReader reader = new ByteArrayBitStreamReader(bytes); - EmptyUnionWithParameter readEmptyUnionWithParameter = - new EmptyUnionWithParameter(reader, param); + EmptyUnionWithParameter readEmptyUnionWithParameter = new EmptyUnionWithParameter(reader, param); assertEquals(emptyUnionWithParameter, readEmptyUnionWithParameter); } }; diff --git a/test/language/union_types/java/union_types/SimpleUnionTest.java b/test/language/union_types/java/union_types/SimpleUnionTest.java index 64cc0b59c..4c3992e84 100644 --- a/test/language/union_types/java/union_types/SimpleUnionTest.java +++ b/test/language/union_types/java/union_types/SimpleUnionTest.java @@ -1,10 +1,11 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.BitSizeOfCalculator; import zserio.runtime.ZserioError; import zserio.runtime.io.BitStreamReader; @@ -169,7 +170,7 @@ public void operatorEquality() SimpleUnion simpleUnion22 = new SimpleUnion(); simpleUnion22.setCase2Field(CASE2_FIELD); SimpleUnion simpleUnion23 = new SimpleUnion(); - simpleUnion23.setCase2Field(CASE2_FIELD-1); + simpleUnion23.setCase2Field(CASE2_FIELD - 1); assertTrue(simpleUnion21.equals(simpleUnion21)); assertTrue(simpleUnion21.equals(simpleUnion22)); assertFalse(simpleUnion21.equals(simpleUnion23)); @@ -265,8 +266,8 @@ private static SimpleUnion bitStreamReaderConstructor(int choiceTag) throws Zser { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writeSimpleUnionToByteArray(writer, choiceTag); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); SimpleUnion simpleUnion = new SimpleUnion(reader); return simpleUnion; } @@ -275,8 +276,8 @@ private static SimpleUnion read(int choiceTag) throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); writeSimpleUnionToByteArray(writer, choiceTag); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); SimpleUnion simpleUnion = new SimpleUnion(); simpleUnion.read(reader); return simpleUnion; @@ -286,8 +287,8 @@ private static void write(SimpleUnion simpleUnion) throws ZserioError, IOExcepti { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); simpleUnion.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); SimpleUnion readSimpleUnion = new SimpleUnion(reader); assertTrue(simpleUnion.equals(readSimpleUnion)); } diff --git a/test/language/union_types/java/union_types/UnionCompatibilityCheckTest.java b/test/language/union_types/java/union_types/UnionCompatibilityCheckTest.java index afdedfa55..f157aedd3 100644 --- a/test/language/union_types/java/union_types/UnionCompatibilityCheckTest.java +++ b/test/language/union_types/java/union_types/UnionCompatibilityCheckTest.java @@ -1,22 +1,23 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; -import java.io.IOException; import java.io.File; +import java.io.IOException; -import union_types.union_compatibility_check.UnionCompatibilityCheckVersion1; -import union_types.union_compatibility_check.UnionCompatibilityCheckVersion2; -import union_types.union_compatibility_check.UnionVersion1; -import union_types.union_compatibility_check.UnionVersion2; -import union_types.union_compatibility_check.CoordXY; -import union_types.union_compatibility_check.CoordXYZ; +import org.junit.jupiter.api.Test; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; -import zserio.runtime.io.Writer; import zserio.runtime.io.SerializeUtil; +import zserio.runtime.io.Writer; + +import union_types.union_compatibility_check.CoordXY; +import union_types.union_compatibility_check.CoordXYZ; +import union_types.union_compatibility_check.UnionCompatibilityCheckVersion1; +import union_types.union_compatibility_check.UnionCompatibilityCheckVersion2; +import union_types.union_compatibility_check.UnionVersion1; +import union_types.union_compatibility_check.UnionVersion2; public class UnionCompatibilityCheckTest { @@ -24,8 +25,8 @@ public class UnionCompatibilityCheckTest public void writeVersion1ReadVersion1() throws IOException { final UnionCompatibilityCheckVersion1 unionCompatibilityCheckVersion1 = create(createArrayVersion1()); - final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = writeReadVersion1( - unionCompatibilityCheckVersion1); + final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = + writeReadVersion1(unionCompatibilityCheckVersion1); assertEquals(unionCompatibilityCheckVersion1, readUnionCompatibilityCheckVersion1); } @@ -33,8 +34,8 @@ public void writeVersion1ReadVersion1() throws IOException public void writeVersion1ReadVersion2() throws IOException { final UnionCompatibilityCheckVersion1 unionCompatibilityCheckVersion1 = create(createArrayVersion1()); - final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = writeReadVersion2( - unionCompatibilityCheckVersion1); + final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = + writeReadVersion2(unionCompatibilityCheckVersion1); final UnionVersion2[] expectedArrayVersion2 = createArrayVersion2WithVersion1Fields(); assertArrayEquals(expectedArrayVersion2, readUnionCompatibilityCheckVersion2.getArray()); @@ -46,8 +47,8 @@ public void writeVersion2ReadVersion1() throws IOException { final UnionCompatibilityCheckVersion2 unionCompatibilityCheckVersion2 = create(createArrayVersion2WithVersion1Fields()); - final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = writeReadVersion1( - unionCompatibilityCheckVersion2); + final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = + writeReadVersion1(unionCompatibilityCheckVersion2); final UnionVersion1[] expectedArrayVersion1 = createArrayVersion1(); assertArrayEquals(expectedArrayVersion1, readUnionCompatibilityCheckVersion1.getArray()); @@ -58,8 +59,8 @@ public void writeVersion2ReadVersion1() throws IOException public void writeVersion2ReadVersion2() throws IOException { final UnionCompatibilityCheckVersion2 unionCompatibilityCheckVersion2 = create(createArrayVersion2()); - final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = writeReadVersion2( - unionCompatibilityCheckVersion2); + final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = + writeReadVersion2(unionCompatibilityCheckVersion2); assertEquals(unionCompatibilityCheckVersion2, readUnionCompatibilityCheckVersion2); } @@ -67,8 +68,8 @@ public void writeVersion2ReadVersion2() throws IOException public void writeVersion1ReadVersion1File() throws IOException { final UnionCompatibilityCheckVersion1 unionCompatibilityCheckVersion1 = create(createArrayVersion1()); - final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = writeReadVersion1File( - unionCompatibilityCheckVersion1, "version1_version1"); + final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = + writeReadVersion1File(unionCompatibilityCheckVersion1, "version1_version1"); assertEquals(unionCompatibilityCheckVersion1, readUnionCompatibilityCheckVersion1); } @@ -76,8 +77,8 @@ public void writeVersion1ReadVersion1File() throws IOException public void writeVersion1ReadVersion2File() throws IOException { final UnionCompatibilityCheckVersion1 unionCompatibilityCheckVersion1 = create(createArrayVersion1()); - final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = writeReadVersion2File( - unionCompatibilityCheckVersion1, "version1_version2"); + final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = + writeReadVersion2File(unionCompatibilityCheckVersion1, "version1_version2"); final UnionVersion2[] expectedArrayVersion2 = createArrayVersion2WithVersion1Fields(); assertArrayEquals(expectedArrayVersion2, readUnionCompatibilityCheckVersion2.getArray()); @@ -89,8 +90,8 @@ public void writeVersion2ReadVersion1File() throws IOException { final UnionCompatibilityCheckVersion2 unionCompatibilityCheckVersion2 = create(createArrayVersion2WithVersion1Fields()); - final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = writeReadVersion1File( - unionCompatibilityCheckVersion2, "version2_version1"); + final UnionCompatibilityCheckVersion1 readUnionCompatibilityCheckVersion1 = + writeReadVersion1File(unionCompatibilityCheckVersion2, "version2_version1"); final UnionVersion1[] expectedArrayVersion1 = createArrayVersion1(); assertArrayEquals(expectedArrayVersion1, readUnionCompatibilityCheckVersion1.getArray()); @@ -101,8 +102,8 @@ public void writeVersion2ReadVersion1File() throws IOException public void writeVersion2ReadVersion2File() throws IOException { final UnionCompatibilityCheckVersion2 unionCompatibilityCheckVersion2 = create(createArrayVersion2()); - final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = writeReadVersion2File( - unionCompatibilityCheckVersion2, "version2_version2"); + final UnionCompatibilityCheckVersion2 readUnionCompatibilityCheckVersion2 = + writeReadVersion2File(unionCompatibilityCheckVersion2, "version2_version2"); assertEquals(unionCompatibilityCheckVersion2, readUnionCompatibilityCheckVersion2); } @@ -119,35 +120,21 @@ private UnionCompatibilityCheckVersion2 create(UnionVersion2 array[]) private UnionVersion1[] createArrayVersion1() { return new UnionVersion1[] { - createUnionVersion1(0), - createUnionVersion1(1), - createUnionVersion1(2), - createUnionVersion1(3) - }; + createUnionVersion1(0), createUnionVersion1(1), createUnionVersion1(2), createUnionVersion1(3)}; } private UnionVersion2[] createArrayVersion2WithVersion1Fields() { return new UnionVersion2[] { - createUnionVersion2(0), - createUnionVersion2(1), - createUnionVersion2(2), - createUnionVersion2(3) - }; + createUnionVersion2(0), createUnionVersion2(1), createUnionVersion2(2), createUnionVersion2(3)}; } private UnionVersion2[] createArrayVersion2() { final UnionVersion2[] arrayVersion2WithVersion1Fields = createArrayVersion2WithVersion1Fields(); - return new UnionVersion2[] { - arrayVersion2WithVersion1Fields[0], - arrayVersion2WithVersion1Fields[1], - arrayVersion2WithVersion1Fields[2], - arrayVersion2WithVersion1Fields[3], - createUnionCoordXYZ(4), - createUnionCoordXYZ(5), - createUnionCoordXYZ(6) - }; + return new UnionVersion2[] {arrayVersion2WithVersion1Fields[0], arrayVersion2WithVersion1Fields[1], + arrayVersion2WithVersion1Fields[2], arrayVersion2WithVersion1Fields[3], createUnionCoordXYZ(4), + createUnionCoordXYZ(5), createUnionCoordXYZ(6)}; } private UnionVersion1 createUnionVersion1(int index) @@ -179,27 +166,25 @@ private UnionVersion2 createUnionCoordXYZ(int index) return union; } - private UnionCompatibilityCheckVersion1 writeReadVersion1( - Writer unionCompatibilityCheck) throws IOException + private UnionCompatibilityCheckVersion1 writeReadVersion1(Writer unionCompatibilityCheck) throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); unionCompatibilityCheck.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UnionCompatibilityCheckVersion1 readUnion = new UnionCompatibilityCheckVersion1(reader); return readUnion; } - private UnionCompatibilityCheckVersion2 writeReadVersion2( - Writer unionCompatibilityCheck) throws IOException + private UnionCompatibilityCheckVersion2 writeReadVersion2(Writer unionCompatibilityCheck) throws IOException { final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); unionCompatibilityCheck.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final UnionCompatibilityCheckVersion2 readUnion = new UnionCompatibilityCheckVersion2(reader); return readUnion; @@ -212,8 +197,8 @@ private UnionCompatibilityCheckVersion1 writeReadVersion1File( SerializeUtil.serializeToFile(unionCompatibilityCheck, file); - final UnionCompatibilityCheckVersion1 readUnion = SerializeUtil.deserializeFromFile( - UnionCompatibilityCheckVersion1.class, file); + final UnionCompatibilityCheckVersion1 readUnion = + SerializeUtil.deserializeFromFile(UnionCompatibilityCheckVersion1.class, file); return readUnion; } @@ -224,8 +209,8 @@ private UnionCompatibilityCheckVersion2 writeReadVersion2File( SerializeUtil.serializeToFile(unionCompatibilityCheck, file); - final UnionCompatibilityCheckVersion2 readUnion = SerializeUtil.deserializeFromFile( - UnionCompatibilityCheckVersion2.class, file); + final UnionCompatibilityCheckVersion2 readUnion = + SerializeUtil.deserializeFromFile(UnionCompatibilityCheckVersion2.class, file); return readUnion; } diff --git a/test/language/union_types/java/union_types/UnionWithArrayTest.java b/test/language/union_types/java/union_types/UnionWithArrayTest.java index fb14013b1..8086d6771 100644 --- a/test/language/union_types/java/union_types/UnionWithArrayTest.java +++ b/test/language/union_types/java/union_types/UnionWithArrayTest.java @@ -1,15 +1,16 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.SerializeUtil; -import union_types.union_with_array.TestUnion; import union_types.union_with_array.Data8; +import union_types.union_with_array.TestUnion; public class UnionWithArrayTest { @@ -78,12 +79,12 @@ public void hashCodeMethod() private static Data8[] createArray8() { - return new Data8[]{new Data8((byte)-1), new Data8((byte)-2), new Data8((byte)-3), new Data8((byte)-4)}; + return new Data8[] {new Data8((byte)-1), new Data8((byte)-2), new Data8((byte)-3), new Data8((byte)-4)}; } private static short[] createArray16() { - return new short[]{-10, -20, -30, -40, -50}; + return new short[] {-10, -20, -30, -40, -50}; } private static final String BLOB_NAME_BASE = "union_with_array_"; diff --git a/test/language/union_types/java/union_types/UnionWithParameterTest.java b/test/language/union_types/java/union_types/UnionWithParameterTest.java index e0d33c48d..955244069 100644 --- a/test/language/union_types/java/union_types/UnionWithParameterTest.java +++ b/test/language/union_types/java/union_types/UnionWithParameterTest.java @@ -1,17 +1,18 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import union_types.union_with_parameter.TestUnion; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.BitStreamReader; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import union_types.union_with_parameter.TestUnion; + public class UnionWithParameterTest { @Test @@ -24,8 +25,8 @@ public void constructorWithParameter() throws ZserioError, IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testUnion.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); TestUnion readTestUnion = new TestUnion(reader, true); assertEquals(testUnion.getCase1Allowed(), readTestUnion.getCase1Allowed()); assertEquals(testUnion.getCase1Field(), readTestUnion.getCase1Field()); @@ -50,8 +51,8 @@ public void bitStreamReaderConstructor() throws ZserioError, IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testUnion.write(writer); - final BitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final BitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); TestUnion readTestUnion = new TestUnion(reader, true); assertEquals(testUnion.choiceTag(), readTestUnion.choiceTag()); assertEquals(testUnion.getCase3Field(), readTestUnion.getCase3Field()); diff --git a/test/language/union_types/java/union_types/UnionWithParameterizedFieldTest.java b/test/language/union_types/java/union_types/UnionWithParameterizedFieldTest.java index d6fb0ee42..c477b4437 100644 --- a/test/language/union_types/java/union_types/UnionWithParameterizedFieldTest.java +++ b/test/language/union_types/java/union_types/UnionWithParameterizedFieldTest.java @@ -1,17 +1,18 @@ package union_types; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.IOException; -import union_types.union_with_parameterized_field.TestUnion; -import union_types.union_with_parameterized_field.ArrayHolder; +import org.junit.jupiter.api.Test; import zserio.runtime.ZserioError; import zserio.runtime.io.ByteArrayBitStreamReader; import zserio.runtime.io.ByteArrayBitStreamWriter; +import union_types.union_with_parameterized_field.ArrayHolder; +import union_types.union_with_parameterized_field.TestUnion; + public class UnionWithParameterizedFieldTest { @Test @@ -32,8 +33,8 @@ public void readConstructor() throws ZserioError, IOException final ByteArrayBitStreamWriter writer = new ByteArrayBitStreamWriter(); testUnion.write(writer); - final ByteArrayBitStreamReader reader = new ByteArrayBitStreamReader( - writer.toByteArray(), writer.getBitPosition()); + final ByteArrayBitStreamReader reader = + new ByteArrayBitStreamReader(writer.toByteArray(), writer.getBitPosition()); final TestUnion readTestUnion = new TestUnion(reader); assertEquals((short)10, readTestUnion.getArrayHolder().getSize()); } diff --git a/test/others/gif/build.xml b/test/others/gif/build.xml index b299d909c..2c5539888 100644 --- a/test/others/gif/build.xml +++ b/test/others/gif/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/others/gif/java/gif/GifTest.java b/test/others/gif/java/gif/GifTest.java index 2992805e4..72165321e 100644 --- a/test/others/gif/java/gif/GifTest.java +++ b/test/others/gif/java/gif/GifTest.java @@ -1,13 +1,15 @@ package gif; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; import java.io.IOException; +import org.junit.jupiter.api.Test; + import zserio.runtime.ZserioError; import zserio.runtime.io.SerializeUtil; + import gif.gif_data.*; import gif.rgb_color.RgbColor; import gif.screen_descriptor.ScreenDescriptor; @@ -21,13 +23,13 @@ public void onePixGif() throws ZserioError, IOException final GifFile gifFile = SerializeUtil.deserializeFromFile(GifFile.class, file); final short[] signatureFormat = gifFile.getSignature().getFormat(); - final String fileFormat = String.format("%1$c%2$c%3$c", signatureFormat[0], signatureFormat[1], - signatureFormat[2]); + final String fileFormat = + String.format("%1$c%2$c%3$c", signatureFormat[0], signatureFormat[1], signatureFormat[2]); assertEquals(GIF_FILE_FORMAT, fileFormat); final short[] signatureVersion = gifFile.getSignature().getVersion(); - final String fileVersion = String.format("%1$c%2$c%3$c", signatureVersion[0], signatureVersion[1], - signatureVersion[2]); + final String fileVersion = + String.format("%1$c%2$c%3$c", signatureVersion[0], signatureVersion[1], signatureVersion[2]); assertEquals(GIF_FILE_VERSION, fileVersion); final ScreenDescriptor screenDescriptor = gifFile.getScreen(); @@ -70,23 +72,23 @@ public void dumpGif() throws Exception do { gifTag = gifData.getTag(); - switch(gifTag) + switch (gifTag) { - case EXTENSION_BLOCK: - printExtensionBlock(gifData.getBlock().getExtension()); - break; + case EXTENSION_BLOCK: + printExtensionBlock(gifData.getBlock().getExtension()); + break; - case IMAGE_BLOCK: - printImageBlock(gifData.getBlock().getImages()); - break; + case IMAGE_BLOCK: + printImageBlock(gifData.getBlock().getImages()); + break; - case TERMINATOR_BLOCK: - System.out.println(alignment + "End of file reached."); - break; + case TERMINATOR_BLOCK: + System.out.println(alignment + "End of file reached."); + break; - default: - System.out.println(alignment + "unknown block."); - break; + default: + System.out.println(alignment + "unknown block."); + break; } if (gifTag != BlockType.TERMINATOR_BLOCK) gifData = gifData.getNextBlock(); @@ -106,10 +108,10 @@ private void printColorMap(RgbColor[] globalColorMap) System.out.print(alignment); for (int i = 0; i < 16; i++, entry++) { - final String sep = (i == 16-1) ? "%n" : ", "; + final String sep = (i == 16 - 1) ? "%n" : ", "; final RgbColor rgbColor = globalColorMap[entry]; - System.out.format("#%1$02X%2$02X%3$02X" + sep, - rgbColor.getRed(), rgbColor.getGreen(), rgbColor.getBlue()); + System.out.format("#%1$02X%2$02X%3$02X" + sep, rgbColor.getRed(), rgbColor.getGreen(), + rgbColor.getBlue()); } } System.out.print(alignment); @@ -117,8 +119,8 @@ private void printColorMap(RgbColor[] globalColorMap) { final String sep = (i == 1) ? "%n" : ", "; final RgbColor rgbColor = globalColorMap[entry]; - System.out.format("#%1$02X%2$02X%3$02X" + sep, - rgbColor.getRed(), rgbColor.getGreen(), rgbColor.getBlue()); + System.out.format( + "#%1$02X%2$02X%3$02X" + sep, rgbColor.getRed(), rgbColor.getGreen(), rgbColor.getBlue()); } decreaseAlignment(); System.out.println(); @@ -153,66 +155,60 @@ private int calcBlockSize(ZippedSubBlock blockData) private void printExtensionBlock(ExtensionBlock extensionBlock) throws IOException { - switch(extensionBlock.getExtensionFunctionCode()) + switch (extensionBlock.getExtensionFunctionCode()) { - case PLAINTEXT_EXTENSION: - { - System.out.println(alignment + "Plain text:"); - increaseAlignment(); - PlainTextExtension plainText = extensionBlock.getExtension().getPlainTextData(); - final short byteCount = plainText.getByteCount(); - if (byteCount > 0) - printComment(plainText.getPlainTextData(), byteCount); - decreaseAlignment(); - break; - } + case PLAINTEXT_EXTENSION: { + System.out.println(alignment + "Plain text:"); + increaseAlignment(); + PlainTextExtension plainText = extensionBlock.getExtension().getPlainTextData(); + final short byteCount = plainText.getByteCount(); + if (byteCount > 0) + printComment(plainText.getPlainTextData(), byteCount); + decreaseAlignment(); + break; + } - case GRAPHICCONTROL_EXTENSION: - { - System.out.println(alignment + "Graphic control extension:"); - break; - } + case GRAPHICCONTROL_EXTENSION: { + System.out.println(alignment + "Graphic control extension:"); + break; + } - case COMMENT_EXTENSION: - { - System.out.print(alignment + "Comment: "); - final CommentExtension comment = extensionBlock.getExtension().getCommentData(); - final short byteCount = comment.getByteCount(); - if (byteCount > 0) - printComment(comment.getCommentData(), byteCount); - System.out.println(); - break; - } + case COMMENT_EXTENSION: { + System.out.print(alignment + "Comment: "); + final CommentExtension comment = extensionBlock.getExtension().getCommentData(); + final short byteCount = comment.getByteCount(); + if (byteCount > 0) + printComment(comment.getCommentData(), byteCount); + System.out.println(); + break; + } - case APPLICATIONEXTENSION: - { - System.out.println(alignment + "Application extension:"); - increaseAlignment(); - final ApplicationExtension appData = extensionBlock.getExtension().getApplicationData(); - - System.out.print(alignment + "Appl-ID: "); - final short[] appID = appData.getApplicationIdentifier(); - for (int i = 0; i < 8; i++) - System.out.print((char)appID[i]); - System.out.println(); - - final short[] applCode = appData.getAuthenticationCode(); - System.out.format(alignment + "Appl-Code: %1$c%2$c%3$c%n", applCode[0], applCode[1], - applCode[2]); - - int applDataSize = 0; - if (appData.getApplDataSize() > 0) - applDataSize = appData.getApplDataSize() + calcBlockSize(appData.getApplicationData()); - System.out.format(alignment + "Appl-Data size: %1$d Bytes%n", applDataSize); - decreaseAlignment(); - break; - } + case APPLICATIONEXTENSION: { + System.out.println(alignment + "Application extension:"); + increaseAlignment(); + final ApplicationExtension appData = extensionBlock.getExtension().getApplicationData(); + + System.out.print(alignment + "Appl-ID: "); + final short[] appID = appData.getApplicationIdentifier(); + for (int i = 0; i < 8; i++) + System.out.print((char)appID[i]); + System.out.println(); + + final short[] applCode = appData.getAuthenticationCode(); + System.out.format(alignment + "Appl-Code: %1$c%2$c%3$c%n", applCode[0], applCode[1], applCode[2]); + + int applDataSize = 0; + if (appData.getApplDataSize() > 0) + applDataSize = appData.getApplDataSize() + calcBlockSize(appData.getApplicationData()); + System.out.format(alignment + "Appl-Data size: %1$d Bytes%n", applDataSize); + decreaseAlignment(); + break; + } - default: - { - System.out.println(alignment + "unknown extension."); - break; - } + default: { + System.out.println(alignment + "unknown extension."); + break; + } } System.out.println(); } @@ -223,8 +219,8 @@ private void printImageDescriptor(ImageDescriptor imgDesc) increaseAlignment(); System.out.format(alignment + "Layer size: %1$d x %2$d%n", imgDesc.getWidth(), imgDesc.getHeight()); System.out.format(alignment + "Layer pos: %1$d, %2$d%n", imgDesc.getTop(), imgDesc.getLeft()); - System.out.format(alignment + "Layer interlaced: %1$s%n", - (imgDesc.getInterlacedFormatted() == 1) ? "yes" : "no"); + System.out.format( + alignment + "Layer interlaced: %1$s%n", (imgDesc.getInterlacedFormatted() == 1) ? "yes" : "no"); System.out.format(alignment + "Layer bits per pixel: %1$d%n", imgDesc.getBitsPerPixel()); if (imgDesc.getLocalColorMapFollows() == 1) { @@ -245,7 +241,7 @@ private void printRasterData(RasterData rasterData) { if (rasterData.getData().getByteCount() > 0) rasterDataSize += rasterData.getData().getByteCount() + - calcBlockSize(rasterData.getData().getDataBytes()); + calcBlockSize(rasterData.getData().getDataBytes()); } System.out.format(alignment + "Raster Data size: %1$d Bytes%n", rasterDataSize); } @@ -277,9 +273,9 @@ private void decreaseAlignment() private static final String GIF_FILE_FORMAT = "GIF"; private static final String GIF_FILE_VERSION = "89a"; - private static final int GIF_SCREEN_WIDTH = 256; - private static final int GIF_SCREEN_HEIGHT = 256; - private static final short GIF_SCREEN_BG_COLOR = 255; - private static final byte GIF_SCREEN_BITS_OF_COLOR_RESOLUTION = 7; - private static final byte GIF_SCREEN_BITS_PER_PIXEL = 7; + private static final int GIF_SCREEN_WIDTH = 256; + private static final int GIF_SCREEN_HEIGHT = 256; + private static final short GIF_SCREEN_BG_COLOR = 255; + private static final byte GIF_SCREEN_BITS_OF_COLOR_RESOLUTION = 7; + private static final byte GIF_SCREEN_BITS_PER_PIXEL = 7; } diff --git a/test/utils/java/build.xml b/test/utils/java/build.xml index bf3816be7..cea132ddf 100644 --- a/test/utils/java/build.xml +++ b/test/utils/java/build.xml @@ -6,6 +6,7 @@ The following properties can be set: test_utils.build_dir - Directory where to put generated files. Default is "../../../build/test/java/${ant.java.version}/utils". +clang_format.exe_file - Clang-format executable file. If not set, clang-format is not run. spotbugs.home_dir - Location of the spotbugs tool. If not set, spotbugs is not run. --> @@ -57,7 +58,22 @@ spotbugs.home_dir - Location of the spotbugs tool. If not set, spotbugs is - + + +Command hints to reformat source using clang-format tool: + git clang-format + clang-format --style=file -i [SOURCE] + + + + + + + + + + + readLines(File file) throws IOException { - final InputStreamReader inputStreamReader = - new InputStreamReader(new FileInputStream(file), "UTF-8"); + final InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), "UTF-8"); final BufferedReader bufferReader = new BufferedReader(inputStreamReader); final List lines = new ArrayList(); try diff --git a/test/warnings/array_types_warning/build.xml b/test/warnings/array_types_warning/build.xml index 83425f66d..d087533fe 100644 --- a/test/warnings/array_types_warning/build.xml +++ b/test/warnings/array_types_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/array_types_warning/java/array_types_warning/ArrayTypesWarningTest.java b/test/warnings/array_types_warning/java/array_types_warning/ArrayTypesWarningTest.java index 87237a693..d42d10bda 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/ArrayTypesWarningTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/ArrayTypesWarningTest.java @@ -1,11 +1,12 @@ package array_types_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ArrayTypesWarningTest @@ -19,88 +20,83 @@ public static void readZserioWarnings() throws IOException @Test public void packedArrayChoiceHasNoPackableField() { - final String warning = "packed_array_choice_has_no_packable_field.zs:40:12: " + - "Keyword 'packed' doesn't have any effect. " + - "'ChoiceWithoutPackableField' doesn't contain any packable field."; + final String warning = "packed_array_choice_has_no_packable_field.zs:40:12: " + + "Keyword 'packed' doesn't have any effect. " + + "'ChoiceWithoutPackableField' doesn't contain any packable field."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayStructHasNoPackableField() { - final String warning = "packed_array_struct_has_no_packable_field.zs:48:12: " + - "Keyword 'packed' doesn't have any effect. " + - "'StructWithoutPackable' doesn't contain any packable field."; + final String warning = "packed_array_struct_has_no_packable_field.zs:48:12: " + + "Keyword 'packed' doesn't have any effect. " + + "'StructWithoutPackable' doesn't contain any packable field."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayTemplateHasNoPackableField() { - final String warnings1[] = - { - "packed_array_template_has_no_packable_field.zs:22:13: " - + " In instantiation of 'Template' required from here", - "packed_array_template_has_no_packable_field.zs:5:12: " + - "Keyword 'packed' doesn't have any effect. 'string' is not packable element type." - }; + final String warnings1[] = {"packed_array_template_has_no_packable_field.zs:22:13: " + + " In instantiation of 'Template' required from here", + "packed_array_template_has_no_packable_field.zs:5:12: " + + "Keyword 'packed' doesn't have any effect. 'string' is not packable element type."}; assertTrue(zserioWarnings.isPresent(warnings1)); - final String warnings2[] = - { - "packed_array_template_has_no_packable_field.zs:24:13: " + - " In instantiation of 'Template' required from here", - "packed_array_template_has_no_packable_field.zs:5:12: " + - "Keyword 'packed' doesn't have any effect. 'Unpackable' doesn't contain any packable field." - }; + final String warnings2[] = {"packed_array_template_has_no_packable_field.zs:24:13: " + + " In instantiation of 'Template' required from here", + "packed_array_template_has_no_packable_field.zs:5:12: " + + + "Keyword 'packed' doesn't have any effect. 'Unpackable' doesn't contain any packable field."}; assertTrue(zserioWarnings.isPresent(warnings2)); } @Test public void packedArrayUnionHasNoPackableField() { - final String warning = "packed_array_union_has_no_packable_field.zs:25:12: " + - "Union 'UnionWithoutPackableField' doesn't contain any packable field."; + final String warning = "packed_array_union_has_no_packable_field.zs:25:12: " + + "Union 'UnionWithoutPackableField' doesn't contain any packable field."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayUnpackableBoolElement() { - final String warning = "packed_array_unpackable_bool_element.zs:23:12: " + - "Keyword 'packed' doesn't have any effect. 'bool' is not packable element type."; + final String warning = "packed_array_unpackable_bool_element.zs:23:12: " + + "Keyword 'packed' doesn't have any effect. 'bool' is not packable element type."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayUnpackableBytesElement() { - final String warning = "packed_array_unpackable_bytes_element.zs:6:12: " + - "Keyword 'packed' doesn't have any effect. 'bytes' is not packable element type."; + final String warning = "packed_array_unpackable_bytes_element.zs:6:12: " + + "Keyword 'packed' doesn't have any effect. 'bytes' is not packable element type."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayUnpackableExternElement() { - final String warning = "packed_array_unpackable_extern_element.zs:6:12: " + - "Keyword 'packed' doesn't have any effect. 'extern' is not packable element type."; + final String warning = "packed_array_unpackable_extern_element.zs:6:12: " + + "Keyword 'packed' doesn't have any effect. 'extern' is not packable element type."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayUnpackableFloatElement() { - final String warning = "packed_array_unpackable_float_element.zs:6:12: " + - "Keyword 'packed' doesn't have any effect. 'float64' is not packable element type."; + final String warning = "packed_array_unpackable_float_element.zs:6:12: " + + "Keyword 'packed' doesn't have any effect. 'float64' is not packable element type."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packedArrayUnpackableStringElement() { - final String warning = "packed_array_unpackable_string_element.zs:6:12: " + - "Keyword 'packed' doesn't have any effect. 'string' is not packable element type."; + final String warning = "packed_array_unpackable_string_element.zs:6:12: " + + "Keyword 'packed' doesn't have any effect. 'string' is not packable element type."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayChoiceHasNoPackableFieldTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayChoiceHasNoPackableFieldTest.java index 21ac67773..3782d556b 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayChoiceHasNoPackableFieldTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayChoiceHasNoPackableFieldTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_choice_has_no_packable_field; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; @@ -11,29 +12,25 @@ public class PackedArrayChoiceHasNoPackableFieldTest public void writeRead() { final StructWithPackable array1[] = { - new StructWithPackable("A", 65), - new StructWithPackable("B", 66), - new StructWithPackable("C", 67), + new StructWithPackable("A", 65), + new StructWithPackable("B", 66), + new StructWithPackable("C", 67), }; final UnionWithPackableField array2[] = new UnionWithPackableField[] { - new UnionWithPackableField(), new UnionWithPackableField(), new UnionWithPackableField() - }; + new UnionWithPackableField(), new UnionWithPackableField(), new UnionWithPackableField()}; array2[0].setField2(TestEnum.ONE); array2[1].setField2(TestEnum.TWO); array2[2].setField2(TestEnum.ONE); final StructWithPackableArray array3[] = { - new StructWithPackableArray("ABC", new int[] { 65, 66, 67 }), - new StructWithPackableArray("DEF", new int[] { 68, 69, 70 }), - new StructWithPackableArray("GHI", new int[] { 71, 72, 73 }), + new StructWithPackableArray("ABC", new int[] {65, 66, 67}), + new StructWithPackableArray("DEF", new int[] {68, 69, 70}), + new StructWithPackableArray("GHI", new int[] {71, 72, 73}), }; - final ChoiceWithoutPackableField array4[] = { - new ChoiceWithoutPackableField(true), - new ChoiceWithoutPackableField(true), - new ChoiceWithoutPackableField(true) - }; + final ChoiceWithoutPackableField array4[] = {new ChoiceWithoutPackableField(true), + new ChoiceWithoutPackableField(true), new ChoiceWithoutPackableField(true)}; array4[0].setField1(4.0f); array4[1].setField1(1.0f); array4[2].setField1(0.0f); diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayStructHasNoPackableFieldTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayStructHasNoPackableFieldTest.java index 8b4d55ee1..eacde02fe 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayStructHasNoPackableFieldTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayStructHasNoPackableFieldTest.java @@ -1,10 +1,11 @@ package array_types_warning.packed_array_struct_has_no_packable_field; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; -import zserio.runtime.io.SerializeUtil; import zserio.runtime.io.BitBuffer; +import zserio.runtime.io.SerializeUtil; public class PackedArrayStructHasNoPackableFieldTest { @@ -12,34 +13,32 @@ public class PackedArrayStructHasNoPackableFieldTest public void writeRead() { final StructWithPackable array1[] = { - new StructWithPackable("A", 65), - new StructWithPackable("B", 66), - new StructWithPackable("C", 67), + new StructWithPackable("A", 65), + new StructWithPackable("B", 66), + new StructWithPackable("C", 67), }; final UnionWithPackableField array2[] = new UnionWithPackableField[] { - new UnionWithPackableField(), new UnionWithPackableField(), new UnionWithPackableField() - }; + new UnionWithPackableField(), new UnionWithPackableField(), new UnionWithPackableField()}; array2[0].setField2(TestEnum.ONE); array2[1].setField2(TestEnum.TWO); array2[2].setField2(TestEnum.ONE); final StructWithPackableArray array3[] = { - new StructWithPackableArray("ABC", new int[] { 65, 66, 67 }), - new StructWithPackableArray("DEF", new int[] { 68, 69, 70 }), - new StructWithPackableArray("GHI", new int[] { 71, 72, 73 }), + new StructWithPackableArray("ABC", new int[] {65, 66, 67}), + new StructWithPackableArray("DEF", new int[] {68, 69, 70}), + new StructWithPackableArray("GHI", new int[] {71, 72, 73}), }; final StructWithoutPackable array4[] = { - new StructWithoutPackable(4.0f, new BitBuffer(new byte[] {(byte)0xf0}, 5), 0, "A", - new long[] {0, 0, 0}, new boolean[] {true, false, true}), - new StructWithoutPackable(1.0f, new BitBuffer(new byte[] {(byte)0xe0}, 5), 0, "B", - new long[] {0, 0, 0}, new boolean[] {true, false, true}), - new StructWithoutPackable(0.0f, new BitBuffer(new byte[] {(byte)0xd0}, 5), 0, "C", - new long[] {0, 0, 0}, new boolean[] {true, false, true}) - }; - - final EmptyStruct array5[] = { new EmptyStruct(), new EmptyStruct(), new EmptyStruct() }; + new StructWithoutPackable(4.0f, new BitBuffer(new byte[] {(byte)0xf0}, 5), 0, "A", + new long[] {0, 0, 0}, new boolean[] {true, false, true}), + new StructWithoutPackable(1.0f, new BitBuffer(new byte[] {(byte)0xe0}, 5), 0, "B", + new long[] {0, 0, 0}, new boolean[] {true, false, true}), + new StructWithoutPackable(0.0f, new BitBuffer(new byte[] {(byte)0xd0}, 5), 0, "C", + new long[] {0, 0, 0}, new boolean[] {true, false, true})}; + + final EmptyStruct array5[] = {new EmptyStruct(), new EmptyStruct(), new EmptyStruct()}; final PackedArrayStructHasNoPackableField packedArrayStructHasNoPackableField = new PackedArrayStructHasNoPackableField(array1, array2, array3, array4, array5); diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayTemplateHasNoPackableFieldTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayTemplateHasNoPackableFieldTest.java index e25098f9a..33415e290 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayTemplateHasNoPackableFieldTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayTemplateHasNoPackableFieldTest.java @@ -1,10 +1,11 @@ package array_types_warning.packed_array_template_has_no_packable_field; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.Test; import java.io.File; +import org.junit.jupiter.api.Test; + import zserio.runtime.io.SerializeUtil; public class PackedArrayTemplateHasNoPackableFieldTest @@ -35,9 +36,9 @@ public void writeReadStr() public void writeReadPackable() { final T_packable packable = new T_packable(new Packable[] { - new Packable(0, 4.0, "A"), - new Packable(1, 1.0, "B"), - new Packable(2, 0.0, "C"), + new Packable(0, 4.0, "A"), + new Packable(1, 1.0, "B"), + new Packable(2, 0.0, "C"), }); final File file = new File(BLOB_NAME_BASE + "_packable.blob"); @@ -50,9 +51,9 @@ public void writeReadPackable() public void writeReadUnpackable() { final T_unpackable unpackable = new T_unpackable(new Unpackable[] { - new Unpackable(4.0, "A"), - new Unpackable(1.0, "B"), - new Unpackable(0.0, "C"), + new Unpackable(4.0, "A"), + new Unpackable(1.0, "B"), + new Unpackable(0.0, "C"), }); final File file = new File(BLOB_NAME_BASE + "_unpackable.blob"); diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnionHasNoPackableFieldTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnionHasNoPackableFieldTest.java index 6bb4e91ed..9347e94dd 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnionHasNoPackableFieldTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnionHasNoPackableFieldTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_union_has_no_packable_field; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; @@ -11,20 +12,20 @@ public class PackedArrayUnionHasNoPackableFieldTest public void writeRead() { final StructWithPackable array1[] = { - new StructWithPackable("A", 65), - new StructWithPackable("B", 66), - new StructWithPackable("C", 67), + new StructWithPackable("A", 65), + new StructWithPackable("B", 66), + new StructWithPackable("C", 67), }; final StructWithPackableArray array2[] = { - new StructWithPackableArray("ABC", new int[] { 65, 66, 67 }), - new StructWithPackableArray("DEF", new int[] { 68, 69, 70 }), - new StructWithPackableArray("GHI", new int[] { 71, 72, 73 }), + new StructWithPackableArray("ABC", new int[] {65, 66, 67}), + new StructWithPackableArray("DEF", new int[] {68, 69, 70}), + new StructWithPackableArray("GHI", new int[] {71, 72, 73}), }; final UnionWithoutPackableField array3[] = new UnionWithoutPackableField[] { - new UnionWithoutPackableField(), new UnionWithoutPackableField(), new UnionWithoutPackableField() - }; + new UnionWithoutPackableField(), new UnionWithoutPackableField(), + new UnionWithoutPackableField()}; array3[0].setField1(4.0f); array3[1].setField1(1.0f); array3[2].setField1(0.0f); diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBoolElementTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBoolElementTest.java index 40f5180e3..22151ed61 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBoolElementTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBoolElementTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_unpackable_bool_element; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; @@ -11,17 +12,12 @@ public class PackedArrayUnpackableBoolElementTest public void writeRead() { final PackedArrayUnpackableBoolElement packedArrayUnpackableBoolElement = - new PackedArrayUnpackableBoolElement( - new long[] {0, 1, 2}, + new PackedArrayUnpackableBoolElement(new long[] {0, 1, 2}, new TestEnum[] {TestEnum.ONE, TestEnum.TWO, TestEnum.ONE}, new TestBitmask[] { - TestBitmask.Values.BLACK, TestBitmask.Values.BLACK, TestBitmask.Values.BLACK - }, - new byte[] {(byte)0, (byte)1, (byte)2}, - (short)5, - new long[] {0, -1, -2}, - new boolean[] {true, false, true} - ); + TestBitmask.Values.BLACK, TestBitmask.Values.BLACK, TestBitmask.Values.BLACK}, + new byte[] {(byte)0, (byte)1, (byte)2}, (short)5, new long[] {0, -1, -2}, + new boolean[] {true, false, true}); SerializeUtil.serializeToFile(packedArrayUnpackableBoolElement, BLOB_NAME); final PackedArrayUnpackableBoolElement readPackedArrayUnpackableBoolElement = diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBytesElementTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBytesElementTest.java index d9d059eac..4ad1c8d0d 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBytesElementTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableBytesElementTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_unpackable_bytes_element; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; @@ -12,9 +13,7 @@ public void writeRead() { final PackedArrayUnpackableBytesElement packedArrayUnpackableBytesElement = new PackedArrayUnpackableBytesElement( - new long[] {10, 11, 12}, - new byte[][] {{0, 1, 2}, {11, 12, 13}, {100, 101, 102}} - ); + new long[] {10, 11, 12}, new byte[][] {{0, 1, 2}, {11, 12, 13}, {100, 101, 102}}); SerializeUtil.serializeToFile(packedArrayUnpackableBytesElement, BLOB_NAME); final PackedArrayUnpackableBytesElement readPackedArrayUnpackableBytesElement = diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableExternElementTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableExternElementTest.java index 605bd24f1..de3e2b300 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableExternElementTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableExternElementTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_unpackable_extern_element; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.BitBuffer; @@ -12,14 +13,10 @@ public class PackedArrayUnpackableExternElementTest public void writeRead() { final PackedArrayUnpackableExternElement packedArrayUnpackableExternElement = - new PackedArrayUnpackableExternElement( - new long[] {10, 11, 12}, - new BitBuffer[] { - new BitBuffer(new byte[] {(byte)0xff, (byte)0xc0}, 10), + new PackedArrayUnpackableExternElement(new long[] {10, 11, 12}, + new BitBuffer[] {new BitBuffer(new byte[] {(byte)0xff, (byte)0xc0}, 10), new BitBuffer(new byte[] {(byte)0xff, (byte)0x80}, 10), - new BitBuffer(new byte[] {(byte)0xff, (byte)0x40}, 10) - } - ); + new BitBuffer(new byte[] {(byte)0xff, (byte)0x40}, 10)}); SerializeUtil.serializeToFile(packedArrayUnpackableExternElement, BLOB_NAME); final PackedArrayUnpackableExternElement readPackedArrayUnpackableExternElement = diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableFloatElementTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableFloatElementTest.java index 9ff485712..aa334bdb0 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableFloatElementTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableFloatElementTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_unpackable_float_element; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; @@ -11,10 +12,7 @@ public class PackedArrayUnpackableFloatElementTest public void writeRead() { final PackedArrayUnpackableFloatElement packedArrayUnpackableFloatElement = - new PackedArrayUnpackableFloatElement( - new long[] {10, 11, 12}, - new double[] {4.0, 1.0, 0.0} - ); + new PackedArrayUnpackableFloatElement(new long[] {10, 11, 12}, new double[] {4.0, 1.0, 0.0}); SerializeUtil.serializeToFile(packedArrayUnpackableFloatElement, BLOB_NAME); final PackedArrayUnpackableFloatElement readPackedArrayUnpackableFloatElement = diff --git a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableStringElementTest.java b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableStringElementTest.java index 62bc829e1..0552557ae 100644 --- a/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableStringElementTest.java +++ b/test/warnings/array_types_warning/java/array_types_warning/PackedArrayUnpackableStringElementTest.java @@ -1,6 +1,7 @@ package array_types_warning.packed_array_unpackable_string_element; import static org.junit.jupiter.api.Assertions.*; + import org.junit.jupiter.api.Test; import zserio.runtime.io.SerializeUtil; @@ -11,10 +12,7 @@ public class PackedArrayUnpackableStringElementTest public void writeRead() { final PackedArrayUnpackableStringElement packedArrayUnpackableStringElement = - new PackedArrayUnpackableStringElement( - new long[] {10, 11, 12}, - new String[] {"A", "B", "C"} - ); + new PackedArrayUnpackableStringElement(new long[] {10, 11, 12}, new String[] {"A", "B", "C"}); SerializeUtil.serializeToFile(packedArrayUnpackableStringElement, BLOB_NAME); final PackedArrayUnpackableStringElement readPackedArrayUnpackableStringElement = diff --git a/test/warnings/choice_types_warning/build.xml b/test/warnings/choice_types_warning/build.xml index 3454b9283..fdbf81646 100644 --- a/test/warnings/choice_types_warning/build.xml +++ b/test/warnings/choice_types_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/choice_types_warning/java/choice_types_warning/ChoiceTypesWarningTest.java b/test/warnings/choice_types_warning/java/choice_types_warning/ChoiceTypesWarningTest.java index d5c844f81..97ff912b4 100644 --- a/test/warnings/choice_types_warning/java/choice_types_warning/ChoiceTypesWarningTest.java +++ b/test/warnings/choice_types_warning/java/choice_types_warning/ChoiceTypesWarningTest.java @@ -1,11 +1,12 @@ package choice_types_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class ChoiceTypesWarningTest @@ -19,8 +20,8 @@ public static void readZserioWarnings() throws IOException @Test public void optionalReferencesInSelector() { - final String warning = "optional_references_in_selector.zs:8:41: Choice 'TestChoice' selector " + - "contains reference to optional field 'numBits'."; + final String warning = "optional_references_in_selector.zs:8:41: Choice 'TestChoice' selector " + + "contains reference to optional field 'numBits'."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/comments_warning/build.xml b/test/warnings/comments_warning/build.xml index eee462098..55e954ffd 100644 --- a/test/warnings/comments_warning/build.xml +++ b/test/warnings/comments_warning/build.xml @@ -27,7 +27,11 @@ - + + + + + diff --git a/test/warnings/comments_warning/java/comments_warning/CommentsWarningTest.java b/test/warnings/comments_warning/java/comments_warning/CommentsWarningTest.java index 3facafc9b..4e7c80f7b 100644 --- a/test/warnings/comments_warning/java/comments_warning/CommentsWarningTest.java +++ b/test/warnings/comments_warning/java/comments_warning/CommentsWarningTest.java @@ -1,11 +1,12 @@ package comments_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class CommentsWarningTest @@ -19,89 +20,88 @@ public static void readZserioWarnings() throws IOException @Test public void docCommentFormat() { - assertTrue(zserioWarnings.isPresent("doc_comment_format.zs:4:4: " + - "Documentation: no viable alternative at input")); // '\\n * /**' won't work under Windows + assertTrue(zserioWarnings.isPresent("doc_comment_format.zs:4:4: " + + "Documentation: no viable alternative at input")); // '\\n * /**' won't work under Windows } @Test public void markdownCommentWithWrongTerminator() { - assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:3:1: " + - "Markdown documentation comment should be terminated by '!*/'.")); + assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:3:1: " + + "Markdown documentation comment should be terminated by '!*/'.")); - assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:7:1: " + - "Markdown documentation comment should be terminated by '!*/'.")); + assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:7:1: " + + "Markdown documentation comment should be terminated by '!*/'.")); - assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:21:1: " + - "Markdown documentation comment should be terminated by '!*/'.")); + assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:21:1: " + + "Markdown documentation comment should be terminated by '!*/'.")); - assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:26:5: " + - "Markdown documentation comment should be terminated by '!*/'.")); + assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:26:5: " + + "Markdown documentation comment should be terminated by '!*/'.")); - assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:38:5: " + - "Markdown documentation comment should be terminated by '!*/'.")); + assertTrue(zserioWarnings.isPresent("markdown_comment_with_wrong_terminator.zs:38:5: " + + "Markdown documentation comment should be terminated by '!*/'.")); } @Test public void unresolvedMarkdownSeeTagReference() { - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:7:5: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:7:5: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:14:41: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:14:41: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:22:34: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:22:34: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:27:23: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:27:23: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:33:6: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:33:6: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:38:20: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:38:20: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown'!")); - assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:42:46: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_markdown_see_tag_reference.zs:42:46: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unknown.Unknown'!")); } @Test public void unresolvedSeeTagInTemplatedStruct() { - assertTrue(zserioWarnings.isPresent("unresolved_see_tag_in_templated_struct.zs:3:5: " + - "Documentation: Unresolved referenced symbol 'unknown'!")); + assertTrue(zserioWarnings.isPresent("unresolved_see_tag_in_templated_struct.zs:3:5: " + + "Documentation: Unresolved referenced symbol 'unknown'!")); } @Test public void unresolvedSeeTagReference() { - assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:8:4: " + - "Documentation: Unresolved referenced symbol 'Unexisting'!")); - - assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:9:4: " + - "Documentation: Unresolved referenced symbol 'comments_warning.unexisting_package'!")); + assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:8:4: " + + "Documentation: Unresolved referenced symbol 'Unexisting'!")); - assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:16:4: " + - "Documentation: Unresolved referenced symbol 'unexisting' for type 'Table'!")); + assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:9:4: " + + "Documentation: Unresolved referenced symbol 'comments_warning.unexisting_package'!")); - assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:17:4: " + - "Documentation: Unresolved referenced symbol 'unexisting' for type 'Table'!")); + assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:16:4: " + + "Documentation: Unresolved referenced symbol 'unexisting' for type 'Table'!")); + assertTrue(zserioWarnings.isPresent("unresolved_see_tag_reference.zs:17:4: " + + "Documentation: Unresolved referenced symbol 'unexisting' for type 'Table'!")); } @Test public void unusedFieldComments() { - assertTrue(zserioWarnings.isPresent( - "unused_field_comments.zs:11:11: Documentation comment is not used.")); + assertTrue( + zserioWarnings.isPresent("unused_field_comments.zs:11:11: Documentation comment is not used.")); - assertTrue(zserioWarnings.isPresent( - "unused_field_comments.zs:55:45: Documentation comment is not used.")); + assertTrue( + zserioWarnings.isPresent("unused_field_comments.zs:55:45: Documentation comment is not used.")); - assertTrue(zserioWarnings.isPresent( - "unused_field_comments.zs:61:45: Documentation comment is not used.")); + assertTrue( + zserioWarnings.isPresent("unused_field_comments.zs:61:45: Documentation comment is not used.")); } @Test diff --git a/test/warnings/comments_warning/java/comments_warning/DocCommentMissingWarningTest.java b/test/warnings/comments_warning/java/comments_warning/DocCommentMissingWarningTest.java index de1b14d52..54aad7474 100644 --- a/test/warnings/comments_warning/java/comments_warning/DocCommentMissingWarningTest.java +++ b/test/warnings/comments_warning/java/comments_warning/DocCommentMissingWarningTest.java @@ -1,11 +1,12 @@ package comments_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class DocCommentMissingWarningTest @@ -19,201 +20,200 @@ public static void readZserioWarnings() throws IOException @Test public void compatibilityVersion() { - assertTrue(zserioWarnings.isPresent("doc_comment_missing_warning.zs:3:30: " + - "Missing documentation comment for compatibility version.")); + assertTrue(zserioWarnings.isPresent("doc_comment_missing_warning.zs:3:30: " + + "Missing documentation comment for compatibility version.")); } @Test public void packageNode() { - assertTrue(zserioWarnings.isPresent("doc_comment_missing_warning.zs:5:9: " + - "Missing documentation comment for package.")); - assertTrue(zserioWarnings.isPresent("all_nodes.zs:1:9: " + - "Missing documentation comment for package.")); + assertTrue(zserioWarnings.isPresent("doc_comment_missing_warning.zs:5:9: " + + "Missing documentation comment for package.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:1:9: " + + "Missing documentation comment for package.")); } @Test public void importNode() { - assertTrue(zserioWarnings.isPresent("doc_comment_missing_warning.zs:7:8: " + - "Missing documentation comment for import.")); + assertTrue(zserioWarnings.isPresent("doc_comment_missing_warning.zs:7:8: " + + "Missing documentation comment for import.")); } @Test public void constant() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:13:14: " + - "Missing documentation comment for constant 'CONSTANT'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:13:14: " + + "Missing documentation comment for constant 'CONSTANT'.")); } @Test public void subtype() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:23:16: " + - "Missing documentation comment for subtype 'Subtype'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:23:16: " + + "Missing documentation comment for subtype 'Subtype'.")); } @Test public void instantiateType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:20:35: " + - "Missing documentation comment for instantiate type 'StructureTypeU32'.")); - assertTrue(zserioWarnings.isPresent("all_nodes.zs:21:35: " + - "Missing documentation comment for instantiate type 'StructureTypeSTR'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:20:35: " + + "Missing documentation comment for instantiate type 'StructureTypeU32'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:21:35: " + + "Missing documentation comment for instantiate type 'StructureTypeSTR'.")); } @Test public void bitmaskType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:3:15: " + - "Missing documentation comment for bitmask 'BitmaskType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:3:15: " + + "Missing documentation comment for bitmask 'BitmaskType'.")); } @Test public void bitmaskValue() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:5:5: " + - "Missing documentation comment for bitmask value 'BITMASK_VALUE'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:5:5: " + + "Missing documentation comment for bitmask value 'BITMASK_VALUE'.")); } @Test public void enumType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:8:12: " + - "Missing documentation comment for enumeration 'EnumType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:8:12: " + + "Missing documentation comment for enumeration 'EnumType'.")); } @Test public void enumItem() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:10:5: " + - "Missing documentation comment for enum item 'ENUM_ITEM'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:10:5: " + + "Missing documentation comment for enum item 'ENUM_ITEM'.")); } @Test public void structureType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:15:8: " + - "Missing documentation comment for structure 'StructureType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:15:8: " + + "Missing documentation comment for structure 'StructureType'.")); } @Test public void choiceType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:25:8: " + - "Missing documentation comment for choice 'ChoiceType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:25:8: " + + "Missing documentation comment for choice 'ChoiceType'.")); } @Test public void unionType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:38:7: " + - "Missing documentation comment for union 'UnionType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:38:7: " + + "Missing documentation comment for union 'UnionType'.")); } @Test public void field() { // structure field - assertTrue(zserioWarnings.isPresent("all_nodes.zs:17:7: " + - "Missing documentation comment for field 'field'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:17:7: " + + "Missing documentation comment for field 'field'.")); // choice field - assertTrue(zserioWarnings.isPresent("all_nodes.zs:28:16: " + - "Missing documentation comment for field 'field'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:28:16: " + + "Missing documentation comment for field 'field'.")); // union field - assertTrue(zserioWarnings.isPresent("all_nodes.zs:40:12: " + - "Missing documentation comment for field 'fieldU32'.")); - assertTrue(zserioWarnings.isPresent("all_nodes.zs:41:12: " + - "Missing documentation comment for field 'fieldSTR'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:40:12: " + + "Missing documentation comment for field 'fieldU32'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:41:12: " + + "Missing documentation comment for field 'fieldSTR'.")); // sql table field - assertTrue(zserioWarnings.isPresent("all_nodes.zs:46:12: " + - "Missing documentation comment for field 'id'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:46:12: " + + "Missing documentation comment for field 'id'.")); // sql database field - assertTrue(zserioWarnings.isPresent("all_nodes.zs:51:18: " + - "Missing documentation comment for field 'sqlTable'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:51:18: " + + "Missing documentation comment for field 'sqlTable'.")); } @Test public void function() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:32:21: " + - "Missing documentation comment for function 'getField'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:32:21: " + + "Missing documentation comment for function 'getField'.")); } @Test public void choiceCaseExpression() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:27:5: " + - "Missing documentation comment for choice case expression.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:27:5: " + + "Missing documentation comment for choice case expression.")); } @Test public void choiceDefault() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:29:5: " + - "Missing documentation comment for choice default.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:29:5: " + + "Missing documentation comment for choice default.")); } @Test public void sqlTable() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:44:11: " + - "Missing documentation comment for SQL table 'SqlTableType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:44:11: " + + "Missing documentation comment for SQL table 'SqlTableType'.")); } @Test public void sqlDatabase() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:49:14: " + - "Missing documentation comment for SQL database 'SqlDatabaseType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:49:14: " + + "Missing documentation comment for SQL database 'SqlDatabaseType'.")); } @Test public void ruleGroup() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:54:12: " + - "Missing documentation comment for rule group 'Rules'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:54:12: " + + "Missing documentation comment for rule group 'Rules'.")); } @Test public void rule() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:56:10: " + - "Missing documentation comment for rule 'test-rule'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:56:10: " + + "Missing documentation comment for rule 'test-rule'.")); } @Test public void serviceType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:59:9: " + - "Missing documentation comment for service 'ServiceType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:59:9: " + + "Missing documentation comment for service 'ServiceType'.")); } @Test public void serviceMethod() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:61:22: " + - "Missing documentation comment for method 'serviceMethod'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:61:22: " + + "Missing documentation comment for method 'serviceMethod'.")); } @Test public void pubsubType() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:64:8: " + - "Missing documentation comment for pubsub 'PubsubType'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:64:8: " + + "Missing documentation comment for pubsub 'PubsubType'.")); } @Test public void pubsubMessage() { - assertTrue(zserioWarnings.isPresent("all_nodes.zs:66:46: " + - "Missing documentation comment for message 'pubsubMessage'.")); + assertTrue(zserioWarnings.isPresent("all_nodes.zs:66:46: " + + "Missing documentation comment for message 'pubsubMessage'.")); } - private static ZserioErrorOutput zserioWarnings; }; diff --git a/test/warnings/compatibility_warning/build.xml b/test/warnings/compatibility_warning/build.xml index bb1df868a..c23181150 100644 --- a/test/warnings/compatibility_warning/build.xml +++ b/test/warnings/compatibility_warning/build.xml @@ -29,7 +29,11 @@ - + + + + + diff --git a/test/warnings/compatibility_warning/java/compatibility_warning/CompatibilityWarningTest.java b/test/warnings/compatibility_warning/java/compatibility_warning/CompatibilityWarningTest.java index 78ec96244..32a186e78 100644 --- a/test/warnings/compatibility_warning/java/compatibility_warning/CompatibilityWarningTest.java +++ b/test/warnings/compatibility_warning/java/compatibility_warning/CompatibilityWarningTest.java @@ -1,11 +1,12 @@ package compatibility_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class CompatibilityWarningTest @@ -19,16 +20,16 @@ public static void readZserioWarnings() throws IOException @Test public void rootWithoutCompatibility() { - final String warning = "subpackage.zs:1:30: " + - "Package compatibility version '2.4.2' doesn't match to '2.5.0' specified in root package!"; + final String warning = "subpackage.zs:1:30: " + + "Package compatibility version '2.4.2' doesn't match to '2.5.0' specified in root package!"; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void rootWithDiffCompatibility() { - final String warning = "subpackage.zs:1:30: " + - "Package specifies compatibility version '2.4.2' while root package specifies nothing!"; + final String warning = "subpackage.zs:1:30: " + + "Package specifies compatibility version '2.4.2' while root package specifies nothing!"; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/file_encoding_warning/build.xml b/test/warnings/file_encoding_warning/build.xml index 3c3f8bc51..94cf160bf 100644 --- a/test/warnings/file_encoding_warning/build.xml +++ b/test/warnings/file_encoding_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/file_encoding_warning/java/file_encoding_warning/FileEncodingWarningTest.java b/test/warnings/file_encoding_warning/java/file_encoding_warning/FileEncodingWarningTest.java index ea43dd056..e3d264c70 100644 --- a/test/warnings/file_encoding_warning/java/file_encoding_warning/FileEncodingWarningTest.java +++ b/test/warnings/file_encoding_warning/java/file_encoding_warning/FileEncodingWarningTest.java @@ -1,11 +1,12 @@ package file_encoding_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class FileEncodingWarningTest diff --git a/test/warnings/functions_warning/build.xml b/test/warnings/functions_warning/build.xml index a4a75f8a6..61418fcec 100644 --- a/test/warnings/functions_warning/build.xml +++ b/test/warnings/functions_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/functions_warning/java/functions_warning/FunctionsWarningTest.java b/test/warnings/functions_warning/java/functions_warning/FunctionsWarningTest.java index c43fc71bc..9dd1e664f 100644 --- a/test/warnings/functions_warning/java/functions_warning/FunctionsWarningTest.java +++ b/test/warnings/functions_warning/java/functions_warning/FunctionsWarningTest.java @@ -1,11 +1,12 @@ package functions_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class FunctionsWarningTest @@ -19,12 +20,12 @@ public static void readZserioWarnings() throws IOException @Test public void optionalReferencesInFunction() { - String warning = "optional_references_in_function.zs:11:16: Function " + - "'suspicionFunction' contains reference to optional field 'additionalValue'."; + String warning = "optional_references_in_function.zs:11:16: Function " + + "'suspicionFunction' contains reference to optional field 'additionalValue'."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_function.zs:16:16: Function " + - "'autoSuspicionFunction' contains reference to optional field 'autoAdditionalValue'."; + warning = "optional_references_in_function.zs:16:16: Function " + + "'autoSuspicionFunction' contains reference to optional field 'autoAdditionalValue'."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/not_handled_warning/build.xml b/test/warnings/not_handled_warning/build.xml index de118e20f..2ade534bf 100644 --- a/test/warnings/not_handled_warning/build.xml +++ b/test/warnings/not_handled_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/not_handled_warning/java/not_handled_warning/NotHandledWarningTest.java b/test/warnings/not_handled_warning/java/not_handled_warning/NotHandledWarningTest.java index 93f17c0c2..5bb4dd0a8 100644 --- a/test/warnings/not_handled_warning/java/not_handled_warning/NotHandledWarningTest.java +++ b/test/warnings/not_handled_warning/java/not_handled_warning/NotHandledWarningTest.java @@ -1,11 +1,12 @@ package not_handled_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class NotHandledWarningTest @@ -19,16 +20,16 @@ public static void readZserioWarnings() throws IOException @Test public void notHandledWhite() { - final String warning = "not_handled_warning.zs:15:8: " + - "Enumeration item 'WHITE' is not handled in choice 'EnumParamChoice'."; + final String warning = "not_handled_warning.zs:15:8: " + + "Enumeration item 'WHITE' is not handled in choice 'EnumParamChoice'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void notHandledRed() { - final String warning = "not_handled_warning.zs:15:8: " + - "Enumeration item 'RED' is not handled in choice 'EnumParamChoice'."; + final String warning = "not_handled_warning.zs:15:8: " + + "Enumeration item 'RED' is not handled in choice 'EnumParamChoice'."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/optional_members_warning/build.xml b/test/warnings/optional_members_warning/build.xml index 527a2600d..e3452aeaa 100644 --- a/test/warnings/optional_members_warning/build.xml +++ b/test/warnings/optional_members_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/optional_members_warning/java/optional_members_warning/OptionalMembersWarningTest.java b/test/warnings/optional_members_warning/java/optional_members_warning/OptionalMembersWarningTest.java index ffa0120d2..a337a439e 100644 --- a/test/warnings/optional_members_warning/java/optional_members_warning/OptionalMembersWarningTest.java +++ b/test/warnings/optional_members_warning/java/optional_members_warning/OptionalMembersWarningTest.java @@ -1,11 +1,12 @@ package optional_members_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class OptionalMembersWarningTest @@ -19,75 +20,72 @@ public static void readZserioWarnings() throws IOException @Test public void optionalReferencesInArrayLength() { - String warning = - "optional_references_in_array_length.zs:9:11: Field 'array2' is not optional " + - "and contains reference to optional field 'arrayLength' in array length."; + String warning = "optional_references_in_array_length.zs:9:11: Field 'array2' is not optional " + + "and contains reference to optional field 'arrayLength' in array length."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_array_length.zs:10:20: Field 'array3' is not optional " + - "and contains reference to optional field 'arrayLength' in array length."; + warning = "optional_references_in_array_length.zs:10:20: Field 'array3' is not optional " + + "and contains reference to optional field 'arrayLength' in array length."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void optionalReferencesInBitfieldLength() { - String warning = - "optional_references_in_bitfield_length.zs:9:18: Field 'bitfield2' is not optional " + - "and contains reference to optional field 'numBits' in dynamic bitfield length."; + String warning = "optional_references_in_bitfield_length.zs:9:18: Field 'bitfield2' is not optional " + + "and contains reference to optional field 'numBits' in dynamic bitfield length."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_bitfield_length.zs:10:27: Field 'bitfield3' is not optional " + - "and contains reference to optional field 'numBits' in dynamic bitfield length."; + warning = "optional_references_in_bitfield_length.zs:10:27: Field 'bitfield3' is not optional " + + "and contains reference to optional field 'numBits' in dynamic bitfield length."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void optionalReferencesInConstraint() { - String warning = - "optional_references_in_constraint.zs:9:11: Field 'value3' is not optional " + - "and contains reference to optional field 'value1' in constraint."; + String warning = "optional_references_in_constraint.zs:9:11: Field 'value3' is not optional " + + "and contains reference to optional field 'value1' in constraint."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_constraint.zs:10:20: Field 'value4' is not optional " + - "and contains reference to optional field 'value1' in constraint."; + warning = "optional_references_in_constraint.zs:10:20: Field 'value4' is not optional " + + "and contains reference to optional field 'value1' in constraint."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_constraint.zs:15:11: Field 'anotherValue' has different optional " + - "condition than field 'anotherValue' referenced in constraint."; + warning = "optional_references_in_constraint.zs:15:11: Field 'anotherValue' has different optional " + + "condition than field 'anotherValue' referenced in constraint."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void optionalReferencesInOffset() { - String warning = "optional_references_in_offset.zs:22:11: Field 'value2' is not optional " + - "and contains reference to optional field 'optionalOffset' in offset."; + String warning = "optional_references_in_offset.zs:22:11: Field 'value2' is not optional " + + "and contains reference to optional field 'optionalOffset' in offset."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_offset.zs:26:11: Field 'value3' is not optional " + - "and contains reference to optional field 'offsetHolder' in offset."; + warning = "optional_references_in_offset.zs:26:11: Field 'value3' is not optional " + + "and contains reference to optional field 'offsetHolder' in offset."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_offset.zs:30:11: Field 'value4' is not optional " + - "and contains reference to optional field 'offset' in offset."; + warning = "optional_references_in_offset.zs:30:11: Field 'value4' is not optional " + + "and contains reference to optional field 'offset' in offset."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void optionalReferencesInOptionalClause() { - String warning = "optional_references_in_optional_clause.zs:14:11: Field 'value7' does not have left " + - "'and' condition of optional field 'value1' referenced in optional clause."; + String warning = "optional_references_in_optional_clause.zs:14:11: Field 'value7' does not have left " + + "'and' condition of optional field 'value1' referenced in optional clause."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_optional_clause.zs:15:11: Field 'value8' does not have left " + - "'and' condition of optional field 'value1' referenced in optional clause."; + warning = "optional_references_in_optional_clause.zs:15:11: Field 'value8' does not have left " + + "'and' condition of optional field 'value1' referenced in optional clause."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_optional_clause.zs:16:11: Field 'value9' does not have left " + - "'and' condition of optional field 'value1' referenced in optional clause."; + warning = "optional_references_in_optional_clause.zs:16:11: Field 'value9' does not have left " + + "'and' condition of optional field 'value1' referenced in optional clause."; assertTrue(zserioWarnings.isPresent(warning)); } @@ -95,50 +93,51 @@ public void optionalReferencesInOptionalClause() public void optionalReferencesInTypeArguments() { String warning = - "optional_references_in_type_arguments.zs:34:31: Field 'blackTonesArray1' is not optional " + - "and contains reference to optional field 'numBlackTones' in type arguments."; + "optional_references_in_type_arguments.zs:34:31: Field 'blackTonesArray1' is not optional " + + "and contains reference to optional field 'numBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:35:39: Field 'blackTonesArray2' is not optional " + - "and contains reference to optional field 'numBlackTones' in type arguments."; + warning = "optional_references_in_type_arguments.zs:35:39: Field 'blackTonesArray2' is not optional " + + "and contains reference to optional field 'numBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:37:31: Field 'blackTones1' is not optional " + - "and contains reference to optional field 'numBlackTones' in type arguments."; + warning = "optional_references_in_type_arguments.zs:37:31: Field 'blackTones1' is not optional " + + "and contains reference to optional field 'numBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:38:39: Field 'blackTones2' is not optional " + - "and contains reference to optional field 'numBlackTones' in type arguments."; + warning = "optional_references_in_type_arguments.zs:38:39: Field 'blackTones2' is not optional " + + "and contains reference to optional field 'numBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:40:35: Field 'autoBlackTonesArray1' is not " + - "optional and contains reference to optional field 'autoNumBlackTones' in " + - "type arguments."; + warning = "optional_references_in_type_arguments.zs:40:35: Field 'autoBlackTonesArray1' is not " + + "optional and contains reference to optional field 'autoNumBlackTones' in " + + "type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:41:43: Field 'autoBlackTonesArray2' is not " + - "optional and contains reference to optional field 'autoNumBlackTones' in " + - "type arguments."; + warning = "optional_references_in_type_arguments.zs:41:43: Field 'autoBlackTonesArray2' is not " + + "optional and contains reference to optional field 'autoNumBlackTones' in " + + "type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:43:35: Field 'autoBlackTones1' is not optional " + - "and contains reference to optional field 'autoNumBlackTones' in type arguments."; + warning = "optional_references_in_type_arguments.zs:43:35: Field 'autoBlackTones1' is not optional " + + "and contains reference to optional field 'autoNumBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:44:43: Field 'autoBlackTones2' is not optional " + - "and contains reference to optional field 'autoNumBlackTones' in type arguments."; + warning = "optional_references_in_type_arguments.zs:44:43: Field 'autoBlackTones2' is not optional " + + "and contains reference to optional field 'autoNumBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:46:47: Field 'blackAndWhiteTones' " + - "has different optional condition than field 'numWhiteTones' referenced in type arguments."; + warning = "optional_references_in_type_arguments.zs:46:47: Field 'blackAndWhiteTones' " + + "has different optional condition than field 'numWhiteTones' referenced in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:47:51: Field 'mixedTones' " + + warning = "optional_references_in_type_arguments.zs:47:51: Field 'mixedTones' " + + "has different optional condition than field 'autoNumBlackTones' referenced in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); - warning = "optional_references_in_type_arguments.zs:48:44: Field 'mixedTonesArray' is not optional " + - "and contains reference to optional field 'autoNumBlackTones' in type arguments."; + warning = "optional_references_in_type_arguments.zs:48:44: Field 'mixedTonesArray' is not optional " + + "and contains reference to optional field 'autoNumBlackTones' in type arguments."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/packages_warning/build.xml b/test/warnings/packages_warning/build.xml index 54cb60cd9..1738b3461 100644 --- a/test/warnings/packages_warning/build.xml +++ b/test/warnings/packages_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/packages_warning/java/packages_warning/PackagesWarningTest.java b/test/warnings/packages_warning/java/packages_warning/PackagesWarningTest.java index e64defd38..3aed85357 100644 --- a/test/warnings/packages_warning/java/packages_warning/PackagesWarningTest.java +++ b/test/warnings/packages_warning/java/packages_warning/PackagesWarningTest.java @@ -1,11 +1,12 @@ package packages_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class PackagesWarningTest @@ -19,34 +20,34 @@ public static void readZserioWarnings() throws IOException @Test public void duplicatedPackageImport() { - final String warning = "duplicated_package_import_warning.zs:6:8: " + - "Duplicated import of package 'packages_warning.simple_database'."; + final String warning = "duplicated_package_import_warning.zs:6:8: " + + "Duplicated import of package 'packages_warning.simple_database'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void duplicatedSingleTypeImport() { - final String warning = "duplicated_single_type_import_warning.zs:6:8: " + - "Duplicated import of 'packages_warning.simple_database.SimpleTable'."; + final String warning = "duplicated_single_type_import_warning.zs:6:8: " + + "Duplicated import of 'packages_warning.simple_database.SimpleTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void packageImportOverwrite() { - final String warning = "package_import_overwrite_warning.zs:6:8: " + - "Import of package 'packages_warning.simple_database' overwrites single import of " + - "'packages_warning.simple_database.SimpleTable'."; + final String warning = "package_import_overwrite_warning.zs:6:8: " + + "Import of package 'packages_warning.simple_database' overwrites single import of " + + "'packages_warning.simple_database.SimpleTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void singleTypeAlreadyImported() { - final String warning = "single_type_already_imported_warning.zs:6:8: " + - "Single import of 'packages_warning.simple_database.SimpleTable' " + - "already covered by package import."; + final String warning = "single_type_already_imported_warning.zs:6:8: " + + "Single import of 'packages_warning.simple_database.SimpleTable' " + + "already covered by package import."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/sql_tables_warning/build.xml b/test/warnings/sql_tables_warning/build.xml index 70d211f9f..6e0fbe14e 100644 --- a/test/warnings/sql_tables_warning/build.xml +++ b/test/warnings/sql_tables_warning/build.xml @@ -22,7 +22,11 @@ - + + + + + diff --git a/test/warnings/sql_tables_warning/java/sql_tables_warning/SqlTablesWarningTest.java b/test/warnings/sql_tables_warning/java/sql_tables_warning/SqlTablesWarningTest.java index 1ac7c1f97..27b617aaa 100644 --- a/test/warnings/sql_tables_warning/java/sql_tables_warning/SqlTablesWarningTest.java +++ b/test/warnings/sql_tables_warning/java/sql_tables_warning/SqlTablesWarningTest.java @@ -1,11 +1,12 @@ package sql_tables_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlTablesWarningTest @@ -19,52 +20,52 @@ public static void readZserioWarnings() throws IOException @Test public void badOrderedPrimaryKey() { - final String warning = "bad_ordered_primary_key_warning.zs:9:9: " + - "Primary key column 'classId' is in bad order in sql table 'BadOrderedPrimaryKeyTable'."; + final String warning = "bad_ordered_primary_key_warning.zs:9:9: " + + "Primary key column 'classId' is in bad order in sql table 'BadOrderedPrimaryKeyTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void duplicatedPrimaryKey() { - final String warning = "duplicated_primary_key_warning.zs:6:33: " + - "Duplicated primary key column 'classId' in sql table 'DuplicatedPrimaryKeyTable'."; + final String warning = "duplicated_primary_key_warning.zs:6:33: " + + "Duplicated primary key column 'classId' in sql table 'DuplicatedPrimaryKeyTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void multiplePrimaryKeys() { - final String warning = "multiple_primary_keys_warning.zs:9:9: " + - "Multiple primary keys in sql table 'MultiplePrimaryKeysTable'."; + final String warning = "multiple_primary_keys_warning.zs:9:9: " + + "Multiple primary keys in sql table 'MultiplePrimaryKeysTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void noPrimaryKey() { - final String warning = "no_primary_key_warning.zs:3:11: " + - "No primary key in sql table 'NoPrimaryKeyTable'."; + final String warning = "no_primary_key_warning.zs:3:11: " + + "No primary key in sql table 'NoPrimaryKeyTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void notFirstPrimaryKey() { - final String warning = "not_first_primary_key_warning.zs:6:29: " + - "Primary key column 'classId' is not the first one in sql table 'NotFirstPrimaryKeyTable'."; + final String warning = "not_first_primary_key_warning.zs:6:29: " + + "Primary key column 'classId' is not the first one in sql table 'NotFirstPrimaryKeyTable'."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void notNullPrimaryKey() { - final String warning1 = "not_null_primary_key_warning.zs:5:17: " + - "Primary key column 'schoolId' can contain NULL in sql table 'NotNullPrimaryKeyTable1'."; + final String warning1 = "not_null_primary_key_warning.zs:5:17: " + + "Primary key column 'schoolId' can contain NULL in sql table 'NotNullPrimaryKeyTable1'."; assertTrue(zserioWarnings.isPresent(warning1)); - final String warning2 = "not_null_primary_key_warning.zs:14:17: " + - "Primary key column 'schoolId' can contain NULL in sql table 'NotNullPrimaryKeyTable2'."; + final String warning2 = "not_null_primary_key_warning.zs:14:17: " + + "Primary key column 'schoolId' can contain NULL in sql table 'NotNullPrimaryKeyTable2'."; assertTrue(zserioWarnings.isPresent(warning2)); } diff --git a/test/warnings/sql_without_rowid_tables_warning/build.xml b/test/warnings/sql_without_rowid_tables_warning/build.xml index 332865686..5ed8d03ba 100644 --- a/test/warnings/sql_without_rowid_tables_warning/build.xml +++ b/test/warnings/sql_without_rowid_tables_warning/build.xml @@ -23,7 +23,11 @@ - + + + + + diff --git a/test/warnings/sql_without_rowid_tables_warning/java/sql_without_rowid_tables_warning/SqlWithoutRowIdTablesWarningTest.java b/test/warnings/sql_without_rowid_tables_warning/java/sql_without_rowid_tables_warning/SqlWithoutRowIdTablesWarningTest.java index fda6d047a..f623eb8cd 100644 --- a/test/warnings/sql_without_rowid_tables_warning/java/sql_without_rowid_tables_warning/SqlWithoutRowIdTablesWarningTest.java +++ b/test/warnings/sql_without_rowid_tables_warning/java/sql_without_rowid_tables_warning/SqlWithoutRowIdTablesWarningTest.java @@ -1,11 +1,12 @@ package sql_without_rowid_tables_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class SqlWithoutRowIdTablesWarningTest @@ -19,9 +20,9 @@ public static void readZserioWarnings() throws IOException @Test public void integerPrimaryKey() { - final String warning = "integer_primary_key_warning.zs:3:11: " + - "Single integer primary key in without rowid table 'WithoutRowIdTable' " + - "brings performance drop."; + final String warning = "integer_primary_key_warning.zs:3:11: " + + "Single integer primary key in without rowid table 'WithoutRowIdTable' " + + "brings performance drop."; assertTrue(zserioWarnings.isPresent(warning)); } diff --git a/test/warnings/templates_warning/build.xml b/test/warnings/templates_warning/build.xml index 14111cc35..b6d7d67cb 100644 --- a/test/warnings/templates_warning/build.xml +++ b/test/warnings/templates_warning/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/warnings/templates_warning/java/choice_types_warning/TemplatesWarningTest.java b/test/warnings/templates_warning/java/choice_types_warning/TemplatesWarningTest.java index eb28662f9..2bee2f1f8 100644 --- a/test/warnings/templates_warning/java/choice_types_warning/TemplatesWarningTest.java +++ b/test/warnings/templates_warning/java/choice_types_warning/TemplatesWarningTest.java @@ -1,11 +1,12 @@ package choice_types_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class TemplatesWarningTest @@ -19,25 +20,23 @@ public static void readZserioWarnings() throws IOException @Test public void defaultInstantiation() { - final String warning1 = "default_instantiation_warning.zs:15:5: " + - "Default instantiation of 'Template' as 'Template_uint32."; + final String warning1 = "default_instantiation_warning.zs:15:5: " + + "Default instantiation of 'Template' as 'Template_uint32."; assertTrue(zserioWarnings.isPresent(warning1)); - final String warning2 = "default_instantiation_warning.zs:17:5: " + - "Default instantiation of 'Subpackage1Template' as 'Subpackage1Template_string."; + final String warning2 = "default_instantiation_warning.zs:17:5: " + + "Default instantiation of 'Subpackage1Template' as 'Subpackage1Template_string."; assertTrue(zserioWarnings.isPresent(warning2)); - final String warning3 = "default_instantiation_warning.zs:19:5: " + - "Default instantiation of 'Subpackage2Template' as 'Subpackage2Template_string."; + final String warning3 = "default_instantiation_warning.zs:19:5: " + + "Default instantiation of 'Subpackage2Template' as 'Subpackage2Template_string."; assertTrue(zserioWarnings.isPresent(warning3)); - final String warnings4[] = - { - "default_instantiation_warning.zs:20:5: " + - " In instantiation of 'Subpackage3Template' required from here", - "default_instantiation_subpackage3.zs:10:5: " + - "Default instantiation of 'Subpackage3InnerTemplate' as 'Subpackage3InnerTemplate_uint32." - }; + final String warnings4[] = {"default_instantiation_warning.zs:20:5: " + + " In instantiation of 'Subpackage3Template' required from here", + "default_instantiation_subpackage3.zs:10:5: " + + + "Default instantiation of 'Subpackage3InnerTemplate' as 'Subpackage3InnerTemplate_uint32."}; assertTrue(zserioWarnings.isPresent(warnings4)); } diff --git a/test/warnings/unused_type_warning/build.xml b/test/warnings/unused_type_warning/build.xml index 3dabb8d8c..c88ef74c3 100644 --- a/test/warnings/unused_type_warning/build.xml +++ b/test/warnings/unused_type_warning/build.xml @@ -24,7 +24,11 @@ - + + + + + diff --git a/test/warnings/unused_type_warning/java/unused_type_warning/UnusedTypeWarningTest.java b/test/warnings/unused_type_warning/java/unused_type_warning/UnusedTypeWarningTest.java index ba578b5b7..09bc1f7d9 100644 --- a/test/warnings/unused_type_warning/java/unused_type_warning/UnusedTypeWarningTest.java +++ b/test/warnings/unused_type_warning/java/unused_type_warning/UnusedTypeWarningTest.java @@ -1,11 +1,12 @@ package unused_type_warning; import static org.junit.jupiter.api.Assertions.*; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; import java.io.IOException; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + import test_utils.ZserioErrorOutput; public class UnusedTypeWarningTest @@ -19,48 +20,48 @@ public static void readZserioWarnings() throws IOException @Test public void unusedEnumeration() { - final String warning = "unused_type_warning.zs:4:12: " + - "Type 'unused_type_warning.UnusedEnumeration' is not used."; + final String warning = "unused_type_warning.zs:4:12: " + + "Type 'unused_type_warning.UnusedEnumeration' is not used."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void unusedSubtype() { - final String warning = "unused_type_warning.zs:18:15: " + - "Type 'unused_type_warning.UnusedSubtype' is not used."; + final String warning = "unused_type_warning.zs:18:15: " + + "Type 'unused_type_warning.UnusedSubtype' is not used."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void unusedChoice() { - final String warning = "unused_type_warning.zs:28:8: " + - "Type 'unused_type_warning.UnusedChoice' is not used."; + final String warning = "unused_type_warning.zs:28:8: " + + "Type 'unused_type_warning.UnusedChoice' is not used."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void unusedUnion() { - final String warning = "unused_type_warning.zs:48:7: " + - "Type 'unused_type_warning.UnusedUnion' is not used."; + final String warning = "unused_type_warning.zs:48:7: " + + "Type 'unused_type_warning.UnusedUnion' is not used."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void unusedStructure() { - final String warning = "unused_type_warning.zs:62:8: " + - "Type 'unused_type_warning.UnusedStructure' is not used."; + final String warning = "unused_type_warning.zs:62:8: " + + "Type 'unused_type_warning.UnusedStructure' is not used."; assertTrue(zserioWarnings.isPresent(warning)); } @Test public void unusedTable() { - final String warning = "unused_type_warning.zs:76:11: " + - "Type 'unused_type_warning.UnusedTable' is not used."; + final String warning = "unused_type_warning.zs:76:11: " + + "Type 'unused_type_warning.UnusedTable' is not used."; assertTrue(zserioWarnings.isPresent(warning)); }