From c1cee87fdb90f262c9bb91851f3dfe1e71a075b2 Mon Sep 17 00:00:00 2001 From: Stefan Bischof Date: Fri, 7 May 2021 23:37:49 +0200 Subject: [PATCH] AssertJ for Features Signed-off-by: Stefan Bischof --- org.osgi.test.assertj.feature/.project | 23 + .../org.eclipse.core.resources.prefs | 4 + .../.settings/org.eclipse.core.runtime.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 517 ++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 135 +++++ .../.settings/org.eclipse.m2e.core.prefs | 4 + org.osgi.test.assertj.feature/README.md | 3 + org.osgi.test.assertj.feature/logback.xml | 35 ++ org.osgi.test.assertj.feature/pom.xml | 73 +++ .../AbstractFeatureArtifactAssert.java | 47 ++ .../feature/AbstractFeatureAssert.java | 190 +++++++ .../feature/AbstractFeatureBundleAssert.java | 54 ++ .../AbstractFeatureConfigurationAssert.java | 95 ++++ .../AbstractFeatureExtensionAssert.java | 161 ++++++ .../assertj/feature/AbstractIDAssert.java | 105 ++++ .../osgi/test/assertj/feature/Assertions.java | 109 ++++ .../feature/FeatureArtifactAssert.java | 55 ++ .../test/assertj/feature/FeatureAssert.java | 54 ++ .../assertj/feature/FeatureBundleAssert.java | 55 ++ .../feature/FeatureConfigurationAssert.java | 56 ++ .../feature/FeatureExtensionAssert.java | 55 ++ .../assertj/feature/FeaturesConditions.java | 311 +++++++++++ .../osgi/test/assertj/feature/IDAssert.java | 54 ++ .../test/assertj/feature/SoftAssertions.java | 105 ++++ .../test/assertj/feature/package-info.java | 21 + .../test/assertj/feature/ConditionAssert.java | 57 ++ .../test/assertj/feature/ConditionMethod.java | 21 + .../feature/FeaturesConditionsAssertTest.java | 118 ++++ org.osgi.test.assertj.feature/test.bndrun | 57 ++ org.osgi.test.bom/pom.xml | 6 + pom.xml | 19 +- 31 files changed, 2600 insertions(+), 1 deletion(-) create mode 100644 org.osgi.test.assertj.feature/.project create mode 100644 org.osgi.test.assertj.feature/.settings/org.eclipse.core.resources.prefs create mode 100644 org.osgi.test.assertj.feature/.settings/org.eclipse.core.runtime.prefs create mode 100644 org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.ui.prefs create mode 100644 org.osgi.test.assertj.feature/.settings/org.eclipse.m2e.core.prefs create mode 100644 org.osgi.test.assertj.feature/README.md create mode 100644 org.osgi.test.assertj.feature/logback.xml create mode 100644 org.osgi.test.assertj.feature/pom.xml create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureArtifactAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureBundleAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureConfigurationAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureExtensionAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractIDAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/Assertions.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureArtifactAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureBundleAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureConfigurationAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureExtensionAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeaturesConditions.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/IDAssert.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/SoftAssertions.java create mode 100644 org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/package-info.java create mode 100644 org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionAssert.java create mode 100644 org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionMethod.java create mode 100644 org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/FeaturesConditionsAssertTest.java create mode 100644 org.osgi.test.assertj.feature/test.bndrun diff --git a/org.osgi.test.assertj.feature/.project b/org.osgi.test.assertj.feature/.project new file mode 100644 index 00000000..df50dbf5 --- /dev/null +++ b/org.osgi.test.assertj.feature/.project @@ -0,0 +1,23 @@ + + + org.osgi.test.assertj.feature + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/org.osgi.test.assertj.feature/.settings/org.eclipse.core.resources.prefs b/org.osgi.test.assertj.feature/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..f9fe3459 --- /dev/null +++ b/org.osgi.test.assertj.feature/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/org.osgi.test.assertj.feature/.settings/org.eclipse.core.runtime.prefs b/org.osgi.test.assertj.feature/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 00000000..5a0ad22d --- /dev/null +++ b/org.osgi.test.assertj.feature/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n diff --git a/org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.core.prefs b/org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..88a52ef8 --- /dev/null +++ b/org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,517 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=disabled +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=true +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=17 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=81 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=1 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_if_empty +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.ui.prefs b/org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000..6009701c --- /dev/null +++ b/org.osgi.test.assertj.feature/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,135 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=true +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=true +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_modifiers=true +cleanup.remove_redundant_semicolons=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=true +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=false +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_bnd +cleanup_settings_version=2 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_bnd +formatter_settings_version=16 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=true +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/org.osgi.test.assertj.feature/.settings/org.eclipse.m2e.core.prefs b/org.osgi.test.assertj.feature/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/org.osgi.test.assertj.feature/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/org.osgi.test.assertj.feature/README.md b/org.osgi.test.assertj.feature/README.md new file mode 100644 index 00000000..1f34babb --- /dev/null +++ b/org.osgi.test.assertj.feature/README.md @@ -0,0 +1,3 @@ +# org.osgi.test.assertj.feature + +This artifact provides support classes for OSGi testing with [AssertJ](https://github.com/joel-costigliola/assertj-core) including custom assertions for feature. diff --git a/org.osgi.test.assertj.feature/logback.xml b/org.osgi.test.assertj.feature/logback.xml new file mode 100644 index 00000000..1bfb558f --- /dev/null +++ b/org.osgi.test.assertj.feature/logback.xml @@ -0,0 +1,35 @@ + + + + + true + + + + + %-4relative [%.15thread] %-5level %logger{36}:%line - %msg%n + + + + + + + + + diff --git a/org.osgi.test.assertj.feature/pom.xml b/org.osgi.test.assertj.feature/pom.xml new file mode 100644 index 00000000..59015c75 --- /dev/null +++ b/org.osgi.test.assertj.feature/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + + org.osgi + org.osgi.test.parent + ${revision} + ../pom.xml + + + org.osgi.test.assertj.feature + OSGi Testing AssertJ Support for Features + ${project.groupId}:${project.artifactId} + https://www.osgi.org + + https://github.com/osgi/osgi-test + scm:git:https://github.com/osgi/osgi-test.git + scm:git:git@github.com:osgi/osgi-test.git + + + + + org.osgi + org.osgi.test.common + ${revision} + + + org.assertj + assertj-core + compile + + + org.osgi + osgi.core + + + org.osgi + org.osgi.util.feature + + + org.mockito + mockito-core + + + org.junit.jupiter + junit-jupiter-api + + + org.junit.jupiter + junit-jupiter-params + + + diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureArtifactAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureArtifactAssert.java new file mode 100644 index 00000000..2c30a9e9 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureArtifactAssert.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.assertj.core.api.AbstractObjectAssert; +import org.osgi.util.feature.FeatureArtifact; + +/** + * Abstract base class for {@link FeatureArtifact} specific assertions - + * Generated by CustomAssertionGenerator. + */ +public abstract class AbstractFeatureArtifactAssert, A extends FeatureArtifact> + extends AbstractObjectAssert { + + /** + * Creates a new {@link AbstractFeatureArtifactAssert} to make + * assertions on actual FeatureArtifact. + * + * @param actual the FeatureArtifact we want to make assertions on. + */ + protected AbstractFeatureArtifactAssert(A actual, Class selfType) { + super(actual, selfType); + } + + public IDAssert hasIDThat() { + isNotNull(); + return IDAssert.assertThat(actual.getID()) + .as(actual + ".id"); + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureAssert.java new file mode 100644 index 00000000..15f4de49 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureAssert.java @@ -0,0 +1,190 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import java.util.List; +import java.util.Map; + +import org.assertj.core.api.InstanceOfAssertFactories; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.api.ListAssert; +import org.assertj.core.api.MapAssert; +import org.osgi.util.feature.Feature; +import org.osgi.util.feature.FeatureBundle; +import org.osgi.util.feature.FeatureConfiguration; +import org.osgi.util.feature.FeatureExtension; + +/** + * Abstract base class for {@link Feature} specific assertions - Generated by + * CustomAssertionGenerator. + */ +public abstract class AbstractFeatureAssert, A extends Feature> + extends AbstractFeatureArtifactAssert { + + /** + * Creates a new {@link AbstractFeatureAssert} to make + * assertions on actual Feature. + * + * @param actual the Feature we want to make assertions on. + */ + protected AbstractFeatureAssert(A actual, Class selfType) { + super(actual, selfType); + } + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> BUNDLE_LIST = InstanceOfAssertFactories + .list(FeatureBundle.class); + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> CONFIG_MAP = InstanceOfAssertFactories + .map(String.class, FeatureConfiguration.class); + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> EXTENSION_MAP = InstanceOfAssertFactories + .map(String.class, FeatureExtension.class); + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> VARIABLE_MAP = InstanceOfAssertFactories + .map(String.class, String.class); + + public ListAssert hasBundlesThat() { + return isNotNull().extracting(f -> f.getBundles(), BUNDLE_LIST) + .as(actual + ".bundles"); + } + + public MapAssert hasConfigurationsThat() { + return isNotNull().extracting(f -> f.getConfigurations(), CONFIG_MAP) + .as(actual + ".configurations"); + } + + public MapAssert hasExtensionsThat() { + return isNotNull().extracting(f -> f.getExtensions(), EXTENSION_MAP) + .as(actual + ".extensions"); + } + + public MapAssert hasVariablesThat() { + return isNotNull().extracting(f -> f.getVariables(), VARIABLE_MAP) + .as(actual + ".variables"); + } + + /** + * Verifies that the actual Feature is complete. + * + * @return this assertion object. + * @throws AssertionError - if the actual Feature is not complete. + */ + public S isComplete() { + return isNotNull().is(FeaturesConditions.FeatureConditions.complete()); + } + + /** + * Verifies that the actual Feature is not complete. + * + * @return this assertion object. + * @throws AssertionError - if the actual Feature is complete. + */ + public S isNotComplete() { + return isNotNull().isNot(FeaturesConditions.FeatureConditions.complete()); + } + + /** + * Verifies that the actual Feature's description is equal to the given one. + * + * @param description the given description to compare the actual Feature's + * description to. + * @return this assertion object. + * @throws AssertionError - if the actual Feature's description is not equal + * to the given one. + */ + public S hasDescription(String description) { + return isNotNull().has(FeaturesConditions.FeatureConditions.description(description)); + } + + public S hasDescriptionMatching(String pattern) { + return isNotNull().has(FeaturesConditions.FeatureConditions.descriptionMatches(pattern)); + } + + public S isDescriptionNull() { + return isNotNull().is(FeaturesConditions.FeatureConditions.descriptionNull()); + } + + /** + * Verifies that the actual Feature's license is equal to the given one. + * + * @param license the given license to compare the actual Feature's license + * to. + * @return this assertion object. + * @throws AssertionError - if the actual Feature's license is not equal to + * the given one. + */ + public S hasLicense(String license) { + return isNotNull().has(FeaturesConditions.FeatureConditions.license(license)); + } + + public S hasLicenseMatching(String pattern) { + return isNotNull().has(FeaturesConditions.FeatureConditions.licenseMatches(pattern)); + } + + public S isLicenseNull() { + return isNotNull().is(FeaturesConditions.FeatureConditions.licenseNull()); + } + + /** + * Verifies that the actual Feature's name is equal to the given one. + * + * @param name the given name to compare the actual Feature's name to. + * @return this assertion object. + * @throws AssertionError - if the actual Feature's name is not equal to the + * given one. + */ + public S hasName(String name) { + return isNotNull().has(FeaturesConditions.FeatureConditions.name(name)); + } + + public S hasNameMatching(String pattern) { + return isNotNull().has(FeaturesConditions.FeatureConditions.nameMatches(pattern)); + } + + public S hasNameNull() { + return isNotNull().has(FeaturesConditions.FeatureConditions.nameNull()); + } + + /** + * Verifies that the actual Feature's vendor is equal to the given one. + * + * @param vendor the given vendor to compare the actual Feature's vendor to. + * @return this assertion object. + * @throws AssertionError - if the actual Feature's vendor is not equal to + * the given one. + */ + public S hasVendor(String vendor) { + return isNotNull().has(FeaturesConditions.FeatureConditions.vendor(vendor)); + } + + public S hasVendorMatching(String pattern) { + return isNotNull().has(FeaturesConditions.FeatureConditions.vendorMatches(pattern)); + } + + public S isVendorNull() { + return isNotNull().is(FeaturesConditions.FeatureConditions.vendorNull()); + } + + // TODO: categories, copyright, docURL and SCM. + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureBundleAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureBundleAssert.java new file mode 100644 index 00000000..6179e289 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureBundleAssert.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import java.util.Map; + +import org.assertj.core.api.InstanceOfAssertFactories; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.api.MapAssert; +import org.osgi.util.feature.FeatureBundle; + +/** + * Abstract base class for {@link FeatureBundle} specific assertions - Generated + * by CustomAssertionGenerator. + */ +public abstract class AbstractFeatureBundleAssert, A extends FeatureBundle> + extends AbstractFeatureArtifactAssert { + + /** + * Creates a new {@link AbstractFeatureBundleAssert} to make + * assertions on actual FeatureBundle. + * + * @param actual the FeatureBundle we want to make assertions on. + */ + protected AbstractFeatureBundleAssert(A actual, Class selfType) { + super(actual, selfType); + } + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> METADATA_MAP = InstanceOfAssertFactories + .map(String.class, Object.class); + + public MapAssert hasMetadataThat() { + return isNotNull().extracting(f -> f.getMetadata(), METADATA_MAP) + .as(actual + ".metadata"); + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureConfigurationAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureConfigurationAssert.java new file mode 100644 index 00000000..2a5f51df --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureConfigurationAssert.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import java.util.Map; + +import org.assertj.core.api.AbstractObjectAssert; +import org.assertj.core.api.InstanceOfAssertFactories; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.api.MapAssert; +import org.osgi.util.feature.FeatureConfiguration; + +/** + * Abstract base class for {@link FeatureConfiguration} specific assertions - + * Generated by CustomAssertionGenerator. + */ +public abstract class AbstractFeatureConfigurationAssert, A extends FeatureConfiguration> + extends AbstractObjectAssert { + // TODO: is factory + + /** + * Creates a new {@link AbstractFeatureConfigurationAssert} to + * make assertions on actual FeatureConfiguration. + * + * @param actual the FeatureConfiguration we want to make assertions on. + */ + protected AbstractFeatureConfigurationAssert(A actual, Class selfType) { + super(actual, selfType); + } + + /** + * Verifies that the actual FeatureConfiguration's factoryPid is equal to + * the given one. + * + * @param factoryPid the given factoryPid to compare the actual + * FeatureConfiguration's factoryPid to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureConfiguration's factoryPid + * is not equal to the given one. + */ + public S hasFactoryPid(String factoryPid) { + return isNotNull().has(FeaturesConditions.FeatureConfigurationConditions.factoryPid(factoryPid)); + } + + /** + * Verifies that the actual FeatureConfiguration is a factoryConfiguration + * + * @return this assertion object. + * @throws AssertionError - if the actual FeatureConfiguration is not a + * factoryConfiguration. + */ + public S isFactoryConfiguration() { + return isNotNull().is(FeaturesConditions.FeatureConfigurationConditions.factoryConfiguration()); + } + + /** + * Verifies that the actual FeatureConfiguration's pid is equal to the given + * one. + * + * @param pid the given pid to compare the actual FeatureConfiguration's pid + * to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureConfiguration's pid is not + * equal to the given one. + */ + public S hasPid(String pid) { + return isNotNull().has(FeaturesConditions.FeatureConfigurationConditions.pid(pid)); + } + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> VALUES_MAP = InstanceOfAssertFactories + .map(String.class, Object.class); + + public MapAssert hasValuesThat() { + return isNotNull().extracting(f -> f.getValues(), VALUES_MAP) + .as(actual + ".values"); + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureExtensionAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureExtensionAssert.java new file mode 100644 index 00000000..97172da7 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractFeatureExtensionAssert.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import java.util.List; + +import org.assertj.core.api.AbstractObjectAssert; +import org.assertj.core.api.InstanceOfAssertFactories; +import org.assertj.core.api.InstanceOfAssertFactory; +import org.assertj.core.api.ListAssert; +import org.osgi.util.feature.FeatureExtension; +import org.osgi.util.feature.ID; + +/** + * Abstract base class for {@link FeatureExtension} specific assertions - + * Generated by CustomAssertionGenerator. + */ +public abstract class AbstractFeatureExtensionAssert, A extends FeatureExtension> + extends AbstractObjectAssert { + + /** + * Creates a new {@link AbstractFeatureExtensionAssert} to make + * assertions on actual FeatureExtension. + * + * @param actual the FeatureExtension we want to make assertions on. + */ + protected AbstractFeatureExtensionAssert(A actual, Class selfType) { + super(actual, selfType); + } + + @SuppressWarnings("rawtypes") + static InstanceOfAssertFactory> ID_LIST = InstanceOfAssertFactories.list(ID.class); + + public ListAssert hasArtefactsThat() { + return isNotNull().extracting(f -> f.getArtifacts(), ID_LIST) + .as(actual + ".bundles"); + } + + /** + * Verifies that the actual FeatureExtension's jSON is equal to the given + * one. + * + * @param jSON the given jSON to compare the actual FeatureExtension's jSON + * to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureExtension's jSON is not + * equal to the given one. + */ + public S hasJSON(String jSON) { + return has(FeaturesConditions.FeatureExtensionConditions.json(jSON)); + } + + public S hasJSONMatching(String patten) { + return has(FeaturesConditions.FeatureExtensionConditions.jsonMatches(patten)); + } + + /** + * Verifies that the actual FeatureExtension's kind is equal to the given + * one. + * + * @param kind the given kind to compare the actual FeatureExtension's kind + * to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureExtension's kind is not + * equal to the given one. + */ + public S hasKind(FeatureExtension.Kind kind) { + return has(FeaturesConditions.FeatureExtensionConditions.kind(kind)); + } + + public S hasKindMandantory() { + return has(FeaturesConditions.FeatureExtensionConditions.kindMandantory()); + } + + public S hasKindOptional() { + return has(FeaturesConditions.FeatureExtensionConditions.kindOptional()); + } + + public S hasKindTransient() { + return has(FeaturesConditions.FeatureExtensionConditions.kindTransient()); + } + + /** + * Verifies that the actual FeatureExtension's name is equal to the given + * one. + * + * @param name the given name to compare the actual FeatureExtension's name + * to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureExtension's name is not + * equal to the given one. + */ + public S hasName(String name) { + return has(FeaturesConditions.FeatureExtensionConditions.name(name)); + } + + /** + * Verifies that the actual FeatureExtension's text is equal to the given + * one. + * + * @param text the given text to compare the actual FeatureExtension's text + * to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureExtension's text is not + * equal to the given one. + */ + public S hasText(String text) { + return has(FeaturesConditions.FeatureExtensionConditions.text(text)); + } + + public S isTextNull() { + return is(FeaturesConditions.FeatureExtensionConditions.textNull()); + } + + public S hasTextMatching(String pattern) { + return has(FeaturesConditions.FeatureExtensionConditions.textMatches(pattern)); + } + + /** + * Verifies that the actual FeatureExtension's type is equal to the given + * one. + * + * @param type the given type to compare the actual FeatureExtension's type + * to. + * @return this assertion object. + * @throws AssertionError - if the actual FeatureExtension's type is not + * equal to the given one. + */ + public S hasType(FeatureExtension.Type type) { + return has(FeaturesConditions.FeatureExtensionConditions.type(type)); + } + + public S hasTypeArtifacts() { + return has(FeaturesConditions.FeatureExtensionConditions.typeArtifacts()); + } + + public S hasTypeJson() { + return has(FeaturesConditions.FeatureExtensionConditions.typeJson()); + } + + public S hasTypeText() { + return has(FeaturesConditions.FeatureExtensionConditions.typeText()); + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractIDAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractIDAssert.java new file mode 100644 index 00000000..d340e6c7 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/AbstractIDAssert.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.assertj.core.api.AbstractObjectAssert; +import org.osgi.util.feature.ID; + +/** + * Abstract base class for {@link ID} specific assertions - Generated by + * CustomAssertionGenerator. + */ +public abstract class AbstractIDAssert, A extends ID> + extends AbstractObjectAssert { + + /** + * Creates a new {@link AbstractIDAssert} to make assertions on + * actual ID. + * + * @param actual the ID we want to make assertions on. + */ + protected AbstractIDAssert(A actual, Class selfType) { + super(actual, selfType); + } + + /** + * Verifies that the actual ID's artifactId is equal to the given one. + * + * @param artifactId the given artifactId to compare the actual ID's + * artifactId to. + * @return this assertion object. + * @throws AssertionError - if the actual ID's artifactId is not equal to + * the given one. + */ + public S hasArtifactId(String artifactId) { + return isNotNull().has(FeaturesConditions.IDConditions.artifactId(artifactId)); + } + + /** + * Verifies that the actual ID's classifier is equal to the given one. + * + * @param classifier the given classifier to compare the actual ID's + * classifier to. + * @return this assertion object. + * @throws AssertionError - if the actual ID's classifier is not equal to + * the given one. + */ + public S hasClassifier(String classifier) { + + return isNotNull().has(FeaturesConditions.IDConditions.classifier(classifier)); + + } + + /** + * Verifies that the actual ID's groupId is equal to the given one. + * + * @param groupId the given groupId to compare the actual ID's groupId to. + * @return this assertion object. + * @throws AssertionError - if the actual ID's groupId is not equal to the + * given one. + */ + public S hasGroupId(String groupId) { + return isNotNull().has(FeaturesConditions.IDConditions.groupId(groupId)); + } + + /** + * Verifies that the actual ID's type is equal to the given one. + * + * @param type the given type to compare the actual ID's type to. + * @return this assertion object. + * @throws AssertionError - if the actual ID's type is not equal to the + * given one. + */ + public S hasType(String type) { + return isNotNull().has(FeaturesConditions.IDConditions.type(type)); + } + + /** + * Verifies that the actual ID's version is equal to the given one. + * + * @param version the given version to compare the actual ID's version to. + * @return this assertion object. + * @throws AssertionError - if the actual ID's version is not equal to the + * given one. + */ + public S hasVersion(String version) { + return isNotNull().has(FeaturesConditions.IDConditions.version(version)); + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/Assertions.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/Assertions.java new file mode 100644 index 00000000..db59788e --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/Assertions.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +/** + * Entry point for assertions of different data types. Each method in this class + * is a static factory for the type-specific assertion objects. + */ +public class Assertions { + + /** + * Creates a new instance of + * {@link org.osgi.test.assertj.feature.FeatureAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public static org.osgi.test.assertj.feature.FeatureAssert assertThat(org.osgi.util.feature.Feature actual) { + return new org.osgi.test.assertj.feature.FeatureAssert(actual); + } + + /** + * Creates a new instance of + * {@link org.osgi.test.assertj.feature.FeatureArtifactAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public static org.osgi.test.assertj.feature.FeatureArtifactAssert assertThat( + org.osgi.util.feature.FeatureArtifact actual) { + return new org.osgi.test.assertj.feature.FeatureArtifactAssert(actual); + } + + /** + * Creates a new instance of + * {@link org.osgi.test.assertj.feature.FeatureBundleAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public static org.osgi.test.assertj.feature.FeatureBundleAssert assertThat( + org.osgi.util.feature.FeatureBundle actual) { + return new org.osgi.test.assertj.feature.FeatureBundleAssert(actual); + } + + /** + * Creates a new instance of + * {@link org.osgi.test.assertj.feature.FeatureConfigurationAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public static org.osgi.test.assertj.feature.FeatureConfigurationAssert assertThat( + org.osgi.util.feature.FeatureConfiguration actual) { + return new org.osgi.test.assertj.feature.FeatureConfigurationAssert(actual); + } + + /** + * Creates a new instance of + * {@link org.osgi.test.assertj.feature.FeatureExtensionAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public static org.osgi.test.assertj.feature.FeatureExtensionAssert assertThat( + org.osgi.util.feature.FeatureExtension actual) { + return new org.osgi.test.assertj.feature.FeatureExtensionAssert(actual); + } + + /** + * Creates a new instance of + * {@link org.osgi.test.assertj.feature.IDAssert}. + * + * @param actual the actual value. + * @return the created assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public static org.osgi.test.assertj.feature.IDAssert assertThat(org.osgi.util.feature.ID actual) { + return new org.osgi.test.assertj.feature.IDAssert(actual); + } + + /** + * Creates a new {@link Assertions}. + */ + protected Assertions() { + // empty + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureArtifactAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureArtifactAssert.java new file mode 100644 index 00000000..997c3fa3 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureArtifactAssert.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.osgi.util.feature.FeatureArtifact; + +/** + * {@link FeatureArtifact} specific assertions - Generated by + * CustomAssertionGenerator. Although this class is not final to allow Soft + * assertions proxy, if you wish to extend it, extend + * {@link AbstractFeatureArtifactAssert} instead. + */ +public class FeatureArtifactAssert extends AbstractFeatureArtifactAssert { + + /** + * Creates a new {@link FeatureArtifactAssert} to make + * assertions on actual FeatureArtifact. + * + * @param actual the FeatureArtifact we want to make assertions on. + */ + public FeatureArtifactAssert(FeatureArtifact actual) { + super(actual, FeatureArtifactAssert.class); + } + + /** + * An entry point for FeatureArtifactAssert to follow AssertJ standard + * assertThat() statements.
+ * With a static import, one can write directly: + * assertThat(myFeatureArtifact) and get specific assertion + * with code completion. + * + * @param actual the FeatureArtifact we want to make assertions on. + * @return a new {@link FeatureArtifactAssert} + */ + @org.assertj.core.util.CheckReturnValue + public static FeatureArtifactAssert assertThat(FeatureArtifact actual) { + return new FeatureArtifactAssert(actual); + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureAssert.java new file mode 100644 index 00000000..b6a0791f --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureAssert.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.osgi.util.feature.Feature; + +/** + * {@link Feature} specific assertions - Generated by CustomAssertionGenerator. + * Although this class is not final to allow Soft assertions proxy, if you wish + * to extend it, extend {@link AbstractFeatureAssert} instead. + */ +public class FeatureAssert extends AbstractFeatureAssert { + + /** + * Creates a new {@link FeatureAssert} to make assertions on + * actual Feature. + * + * @param actual the Feature we want to make assertions on. + */ + public FeatureAssert(Feature actual) { + super(actual, FeatureAssert.class); + } + + /** + * An entry point for FeatureAssert to follow AssertJ standard + * assertThat() statements.
+ * With a static import, one can write directly: + * assertThat(myFeature) and get specific assertion with code + * completion. + * + * @param actual the Feature we want to make assertions on. + * @return a new {@link FeatureAssert} + */ + @org.assertj.core.util.CheckReturnValue + public static FeatureAssert assertThat(Feature actual) { + return new FeatureAssert(actual); + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureBundleAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureBundleAssert.java new file mode 100644 index 00000000..6cb10738 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureBundleAssert.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.osgi.util.feature.FeatureBundle; + +/** + * {@link FeatureBundle} specific assertions - Generated by + * CustomAssertionGenerator. Although this class is not final to allow Soft + * assertions proxy, if you wish to extend it, extend + * {@link AbstractFeatureBundleAssert} instead. + */ +public class FeatureBundleAssert extends AbstractFeatureBundleAssert { + + /** + * Creates a new {@link FeatureBundleAssert} to make assertions + * on actual FeatureBundle. + * + * @param actual the FeatureBundle we want to make assertions on. + */ + public FeatureBundleAssert(FeatureBundle actual) { + super(actual, FeatureBundleAssert.class); + } + + /** + * An entry point for FeatureBundleAssert to follow AssertJ standard + * assertThat() statements.
+ * With a static import, one can write directly: + * assertThat(myFeatureBundle) and get specific assertion with + * code completion. + * + * @param actual the FeatureBundle we want to make assertions on. + * @return a new {@link FeatureBundleAssert} + */ + @org.assertj.core.util.CheckReturnValue + public static FeatureBundleAssert assertThat(FeatureBundle actual) { + return new FeatureBundleAssert(actual); + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureConfigurationAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureConfigurationAssert.java new file mode 100644 index 00000000..b976ac3f --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureConfigurationAssert.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.osgi.util.feature.FeatureConfiguration; + +/** + * {@link FeatureConfiguration} specific assertions - Generated by + * CustomAssertionGenerator. Although this class is not final to allow Soft + * assertions proxy, if you wish to extend it, extend + * {@link AbstractFeatureConfigurationAssert} instead. + */ +public class FeatureConfigurationAssert + extends AbstractFeatureConfigurationAssert { + + /** + * Creates a new {@link FeatureConfigurationAssert} to make + * assertions on actual FeatureConfiguration. + * + * @param actual the FeatureConfiguration we want to make assertions on. + */ + public FeatureConfigurationAssert(FeatureConfiguration actual) { + super(actual, FeatureConfigurationAssert.class); + } + + /** + * An entry point for FeatureConfigurationAssert to follow AssertJ standard + * assertThat() statements.
+ * With a static import, one can write directly: + * assertThat(myFeatureConfiguration) and get specific + * assertion with code completion. + * + * @param actual the FeatureConfiguration we want to make assertions on. + * @return a new {@link FeatureConfigurationAssert} + */ + @org.assertj.core.util.CheckReturnValue + public static FeatureConfigurationAssert assertThat(FeatureConfiguration actual) { + return new FeatureConfigurationAssert(actual); + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureExtensionAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureExtensionAssert.java new file mode 100644 index 00000000..5a8d752f --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeatureExtensionAssert.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.osgi.util.feature.FeatureExtension; + +/** + * {@link FeatureExtension} specific assertions - Generated by + * CustomAssertionGenerator. Although this class is not final to allow Soft + * assertions proxy, if you wish to extend it, extend + * {@link AbstractFeatureExtensionAssert} instead. + */ +public class FeatureExtensionAssert extends AbstractFeatureExtensionAssert { + + /** + * Creates a new {@link FeatureExtensionAssert} to make + * assertions on actual FeatureExtension. + * + * @param actual the FeatureExtension we want to make assertions on. + */ + public FeatureExtensionAssert(FeatureExtension actual) { + super(actual, FeatureExtensionAssert.class); + } + + /** + * An entry point for FeatureExtensionAssert to follow AssertJ standard + * assertThat() statements.
+ * With a static import, one can write directly: + * assertThat(myFeatureExtension) and get specific assertion + * with code completion. + * + * @param actual the FeatureExtension we want to make assertions on. + * @return a new {@link FeatureExtensionAssert} + */ + @org.assertj.core.util.CheckReturnValue + public static FeatureExtensionAssert assertThat(FeatureExtension actual) { + return new FeatureExtensionAssert(actual); + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeaturesConditions.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeaturesConditions.java new file mode 100644 index 00000000..8de97fd6 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/FeaturesConditions.java @@ -0,0 +1,311 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import static org.assertj.core.api.Assertions.not; + +import java.util.Objects; + +import org.assertj.core.api.Condition; +import org.osgi.util.feature.Feature; +import org.osgi.util.feature.FeatureArtifact; +import org.osgi.util.feature.FeatureBundle; +import org.osgi.util.feature.FeatureConfiguration; +import org.osgi.util.feature.FeatureExtension; +import org.osgi.util.feature.ID; + +public interface FeaturesConditions { + + interface FeatureArtifactConditions { + + static Condition iDNull() { + return new Condition<>(f -> f.getID() == null, "ID "); + } + + } + + interface FeatureBundleConditions { + + static Condition metadataEmpty() { + return new Condition<>(f -> f.getMetadata() + .isEmpty(), "metadata empty"); + } + + static Condition metadataNull() { + return new Condition<>(f -> f.getMetadata() == null, "metadata "); + } + + } + + interface FeatureConditions extends FeatureArtifactConditions { + + static Condition complete() { + return new Condition(Feature::isComplete, "complete"); + } + + static Condition description(String description) { + return new Condition(f -> Objects.equals(f.getDescription(), description), "description <%s>", + description); + } + + static Condition descriptionMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getDescription()) && f.getDescription() + .matches(pattern), "description match <%s>", pattern); + } + + static Condition descriptionNull() { + return new Condition<>(f -> f.getDescription() == null, "description "); + } + + static Condition license(String license) { + return new Condition(f -> Objects.equals(f.getLicense(), license), "license <%s>", license); + } + + static Condition licenseMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getLicense()) && f.getLicense() + .matches(pattern), "license match <%s>", pattern); + } + + static Condition licenseNull() { + return new Condition<>(f -> f.getLicense() == null, "license "); + } + + static Condition name(String name) { + return new Condition(f -> Objects.equals(f.getName(), name), "name <%s>", name); + } + + static Condition nameMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getName()) && f.getName() + .matches(pattern), "name match <%s>", pattern); + } + + static Condition nameNull() { + return new Condition<>(f -> f.getName() == null, "name "); + } + + static Condition notComplete() { + return not(complete()).describedAs("not complete"); + } + + static Condition vendor(String vendor) { + return new Condition(f -> Objects.equals(f.getVendor(), vendor), "vendor <%s>", vendor); + } + + static Condition vendorMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getVendor()) && f.getVendor() + .matches(pattern), "vendor match <%s>", pattern); + } + + static Condition vendorNull() { + return new Condition<>(f -> f.getVendor() == null, "vendor "); + } + + // + // static Condition categoriesNull() { + // return new Condition<>(f -> f.getCategories() == + // null, "categories must be null"); + // } + // + // static Condition categories(String categories) { + // return new Condition(f -> + // f.getCategories() + // ,categories), "categories must be %s", categories); + // } + // + // static Condition categoriesMatches(String pattern) { + // return new Condition(f -> + // f.getCategories() + // .matches(pattern), "categories must match %s", pattern); + // } + + // + // static Condition copyrightNull() { + // return new Condition<>(f -> f.getCopyright() == + // null, "copyright must be null"); + // } + // + // static Condition copyright(String copyright) { + // return new Condition(f -> + // f.getCopyright() + // ,copyright), "copyright must be %s", copyright); + // } + // + // static Condition copyrightMatches(String pattern) { + // return new Condition(f -> + // f.getCopyright() + // .matches(pattern), "copyright must match %s", pattern); + // } + + // + // static Condition docURLNull() { + // return new Condition<>(f -> f.getFocURL() == null, "docURL must be + // null"); + // } + // + // static Condition docURL(String docURL) { + // return new Condition(f -> f.getDocURL() + // ,docURL), "docURL must be %s", docURL); + // } + // + // static Condition docURLMatches(String pattern) { + // return new Condition(f -> f.getDocURL() + // .matches(pattern), "docURL must match %s", pattern); + // } + + // + // static Condition scmNull() { + // return new Condition<>(f -> f.getSCM() == null, + // "scm must be null"); + // } + // + // static Condition scm(String scm) { + // return new Condition(f -> f.getSCM() + // ,scm), "scm must be %s", scm); + // } + // + // static Condition scmMatches(String pattern) { + // return new Condition(f -> f.getSCM() + // .matches(pattern), "scm must match %s", pattern); + // } + } + + interface FeatureConfigurationConditions { + + static Condition factoryConfiguration() { + + return new Condition(f -> Objects.nonNull(f.getFactoryPid()), "factoryConfiguration"); + } + + static Condition factoryPid(String text) { + return new Condition(f -> Objects.equals(f.getFactoryPid(), text), "factoryPid <%s>", + text); + } + + static Condition pid(String text) { + + return new Condition(f -> Objects.equals(f.getPid(), text), "pid <%s>", text); + } + } + + interface FeatureExtensionConditions { + + static Condition json(String json) { + return new Condition(f -> Objects.equals(f.getJSON(), json), "json <%s>", json); + } + + static Condition jsonMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getJSON()) && f.getJSON() + .matches(pattern), "json match <%s>", pattern); + } + + static Condition jsonNull() { + return new Condition<>(f -> f.getJSON() == null, "json "); + } + + static Condition kind(final FeatureExtension.Kind kind) { + return new Condition<>(f -> Objects.equals(f.getKind(), kind), "kind <%s>", kind); + } + + static Condition kindMandantory() { + return kind(FeatureExtension.Kind.MANDATORY); + } + + static Condition kindNull() { + return kind(null); + } + + static Condition kindOptional() { + return kind(FeatureExtension.Kind.OPTIONAL); + } + + static Condition kindTransient() { + return kind(FeatureExtension.Kind.TRANSIENT); + } + + static Condition name(String name) { + return new Condition(f -> Objects.equals(f.getName(), name), "name <%s>", name); + } + + static Condition nameMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getName()) && f.getName() + .matches(pattern), "name match <%s>", pattern); + } + + static Condition nameNull() { + return new Condition<>(f -> f.getName() == null, "name "); + } + + static Condition text(String text) { + return new Condition(f -> Objects.equals(f.getText(), text), "text <%s>", text); + } + + static Condition textMatches(String pattern) { + return new Condition(f -> Objects.nonNull(f.getText()) && f.getText() + .matches(pattern), "text match <%s>", pattern); + } + + static Condition textNull() { + return new Condition<>(f -> f.getText() == null, "json "); + } + + static Condition type(final FeatureExtension.Type type) { + return kind(null); + } + + static Condition typeArtifacts() { + return type(FeatureExtension.Type.ARTIFACTS); + } + + static Condition typeJson() { + return type(FeatureExtension.Type.JSON); + } + + static Condition typeNull() { + return type(null); + } + + static Condition typeText() { + return type(FeatureExtension.Type.TEXT); + } + + } + + interface IDConditions { + static Condition artifactId(String artifactId) { + return new Condition(f -> Objects.equals(f.getArtifactId(), artifactId), "artifactId <%s>", artifactId); + } + + static Condition classifier(String classifier) { + return new Condition(f -> Objects.equals(f.getClassifier(), classifier), "classifier <%s>", classifier); + } + + static Condition groupId(String groupId) { + return new Condition(f -> Objects.equals(f.getGroupId(), groupId), "groupId <%s>", groupId); + } + + static Condition type(String type) { + return new Condition(f -> Objects.equals(f.getType(), type), "type <%s>", type); + } + + static Condition version(String version) { + return new Condition(f -> Objects.equals(f.getVersion(), version), "version <%s>", version); + } + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/IDAssert.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/IDAssert.java new file mode 100644 index 00000000..2575896c --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/IDAssert.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import org.osgi.util.feature.ID; + +/** + * {@link ID} specific assertions - Generated by CustomAssertionGenerator. + * Although this class is not final to allow Soft assertions proxy, if you wish + * to extend it, extend {@link AbstractIDAssert} instead. + */ +public class IDAssert extends AbstractIDAssert { + + /** + * Creates a new {@link IDAssert} to make assertions on actual + * ID. + * + * @param actual the ID we want to make assertions on. + */ + public IDAssert(ID actual) { + super(actual, IDAssert.class); + } + + /** + * An entry point for IDAssert to follow AssertJ standard + * assertThat() statements.
+ * With a static import, one can write directly: + * assertThat(myID) and get specific assertion with code + * completion. + * + * @param actual the ID we want to make assertions on. + * @return a new {@link IDAssert} + */ + @org.assertj.core.util.CheckReturnValue + public static IDAssert assertThat(ID actual) { + return new IDAssert(actual); + } +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/SoftAssertions.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/SoftAssertions.java new file mode 100644 index 00000000..65eeea97 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/SoftAssertions.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +/** + * Entry point for soft assertions of different data types. + */ +public class SoftAssertions extends org.assertj.core.api.SoftAssertions { + + /** + * Creates a new "soft" instance of + * {@link org.osgi.test.assertj.feature.FeatureAssert}. + * + * @param actual the actual value. + * @return the created "soft" assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public org.osgi.test.assertj.feature.FeatureAssert assertThat(org.osgi.util.feature.Feature actual) { + return proxy(org.osgi.test.assertj.feature.FeatureAssert.class, org.osgi.util.feature.Feature.class, actual); + } + + /** + * Creates a new "soft" instance of + * {@link org.osgi.test.assertj.feature.FeatureArtifactAssert}. + * + * @param actual the actual value. + * @return the created "soft" assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public org.osgi.test.assertj.feature.FeatureArtifactAssert assertThat( + org.osgi.util.feature.FeatureArtifact actual) { + return proxy(org.osgi.test.assertj.feature.FeatureArtifactAssert.class, + org.osgi.util.feature.FeatureArtifact.class, actual); + } + + /** + * Creates a new "soft" instance of + * {@link org.osgi.test.assertj.feature.FeatureBundleAssert}. + * + * @param actual the actual value. + * @return the created "soft" assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public org.osgi.test.assertj.feature.FeatureBundleAssert assertThat(org.osgi.util.feature.FeatureBundle actual) { + return proxy(org.osgi.test.assertj.feature.FeatureBundleAssert.class, org.osgi.util.feature.FeatureBundle.class, + actual); + } + + /** + * Creates a new "soft" instance of + * {@link org.osgi.test.assertj.feature.FeatureConfigurationAssert}. + * + * @param actual the actual value. + * @return the created "soft" assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public org.osgi.test.assertj.feature.FeatureConfigurationAssert assertThat( + org.osgi.util.feature.FeatureConfiguration actual) { + return proxy(org.osgi.test.assertj.feature.FeatureConfigurationAssert.class, + org.osgi.util.feature.FeatureConfiguration.class, actual); + } + + /** + * Creates a new "soft" instance of + * {@link org.osgi.test.assertj.feature.FeatureExtensionAssert}. + * + * @param actual the actual value. + * @return the created "soft" assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public org.osgi.test.assertj.feature.FeatureExtensionAssert assertThat( + org.osgi.util.feature.FeatureExtension actual) { + return proxy(org.osgi.test.assertj.feature.FeatureExtensionAssert.class, + org.osgi.util.feature.FeatureExtension.class, actual); + } + + /** + * Creates a new "soft" instance of + * {@link org.osgi.test.assertj.feature.IDAssert}. + * + * @param actual the actual value. + * @return the created "soft" assertion object. + */ + @org.assertj.core.util.CheckReturnValue + public org.osgi.test.assertj.feature.IDAssert assertThat(org.osgi.util.feature.ID actual) { + return proxy(org.osgi.test.assertj.feature.IDAssert.class, org.osgi.util.feature.ID.class, actual); + } + +} diff --git a/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/package-info.java b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/package-info.java new file mode 100644 index 00000000..e7c1ac26 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/main/java/org/osgi/test/assertj/feature/package-info.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +@org.osgi.annotation.bundle.Export +@org.osgi.annotation.versioning.Version("1.0.0") +package org.osgi.test.assertj.feature; diff --git a/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionAssert.java b/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionAssert.java new file mode 100644 index 00000000..b2f3a1c1 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionAssert.java @@ -0,0 +1,57 @@ +package org.osgi.test.assertj.feature; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.util.regex.Pattern; + +import org.assertj.core.api.AbstractThrowableAssert; +import org.assertj.core.api.Condition; +import org.assertj.core.api.ObjectAssertFactory; + +public interface ConditionAssert { + String regex_startWith_Expecting = "(?si).*Expecting.*"; + + default AbstractThrowableAssert failingHas(Condition condition, T actual, String msg, Object... args) { + return failingHas(condition, actual, String.format(msg, args)); + } + + default AbstractThrowableAssert failingHas(Condition condition, T actual, String msg) { + String regex = regex_expecting_X_M_Y(actual, ConditionMethod.Has, msg); + return failingHas(condition, actual).hasMessageMatching(regex); + } + + default AbstractThrowableAssert failingHas(Condition condition, T actual) { + return assertThatThrownBy(() -> passingHas(condition, actual)).isInstanceOf(AssertionError.class); + } + + default AbstractThrowableAssert failingIs(Condition condition, T actual, String msg, Object... args) { + return failingIs(condition, actual, String.format(msg, args)); + } + + default AbstractThrowableAssert failingIs(Condition condition, T actual, String msg) { + String regex = regex_expecting_X_M_Y(actual, ConditionMethod.Is, msg); + return assertThatThrownBy(() -> passingIs(condition, actual)).isInstanceOf(AssertionError.class) + .hasMessageMatching(regex); + } + + default void passingHas(Condition condition, T actual) { + ObjectAssertFactory factory = new ObjectAssertFactory<>(); + factory.createAssert(actual) + .has(condition); + } + + default void passingIs(Condition condition, T actual) { + ObjectAssertFactory factory = new ObjectAssertFactory<>(); + factory.createAssert(actual) + .is(condition); + } + + default String regex_expecting_X_M_Y(Object x, ConditionMethod m, Object y) { + return String.format(regex_startWith_Expecting + "%s.*" + m + ".*%s.*", Pattern.quote(x.toString()), y); + } + + default String rexex_expecting_X_M_Y_Z(Object x, ConditionMethod m, Object y, Object z) { + return regex_expecting_X_M_Y(x, m, String.format("%s.*%s", y, z)); + } + +} diff --git a/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionMethod.java b/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionMethod.java new file mode 100644 index 00000000..63ba6503 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/ConditionMethod.java @@ -0,0 +1,21 @@ +package org.osgi.test.assertj.feature; + +public enum ConditionMethod { + + Has("to have"), + DoesNotHas("not to have"), + Is("to be"), + IsNot("not to be"); + + private String text; + + ConditionMethod(String text) { + this.text = text; + } + + @Override + public String toString() { + + return text; + } +} diff --git a/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/FeaturesConditionsAssertTest.java b/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/FeaturesConditionsAssertTest.java new file mode 100644 index 00000000..2bf556b9 --- /dev/null +++ b/org.osgi.test.assertj.feature/src/test/java/org/osgi/test/assertj/feature/FeaturesConditionsAssertTest.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *******************************************************************************/ + +package org.osgi.test.assertj.feature; + +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.assertj.core.api.junit.jupiter.SoftAssertionsExtension; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.osgi.util.feature.Feature; + +@ExtendWith(SoftAssertionsExtension.class) +public class FeaturesConditionsAssertTest implements ConditionAssert { + + @Nested + class FeatureContitionsTest { + + private String featureName = "theFeature"; + Feature feature = null; + + @BeforeEach + private void beforEach() { + feature = mock(Feature.class, featureName); + } + + @Test + void testComplete() throws Exception { + + when(feature.isComplete()).thenReturn(true); + + // condition pass + passingIs(FeaturesConditions.FeatureConditions.complete(), feature); + + // assertion pass + Assertions.assertThat(feature) + .isComplete(); + + when(feature.isComplete()).thenReturn(false); + + // condition fail + failingIs(FeaturesConditions.FeatureConditions.complete(), feature, "complete"); + + // assertion fail + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> Assertions.assertThat(feature) + .isComplete()) + .withMessage(format("%nExpecting:%n " + featureName + "%nto be complete")); + } + + @Test + void testNotComplete() throws Exception { + + when(feature.isComplete()).thenReturn(false); + + // condition pass + passingIs(FeaturesConditions.FeatureConditions.notComplete(), feature); + + // assertion pass + Assertions.assertThat(feature) + .isNotComplete(); + + when(feature.isComplete()).thenReturn(true); + + // condition fail + failingIs(FeaturesConditions.FeatureConditions.notComplete(), feature, "not complete"); + + // assertion fail + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> Assertions.assertThat(feature) + .isNotComplete()) + .withMessage(format("%nExpecting:%n " + featureName + "%nnot to be complete")); + + } + + @Test + void testNameNull() throws Exception { + + when(feature.getName()).thenReturn(null); + + // condition pass + passingHas(FeaturesConditions.FeatureConditions.nameNull(), feature); + + // assertion pass + Assertions.assertThat(feature) + .hasNameNull(); + + when(feature.getName()).thenReturn("featureName"); + + // condition fail + failingHas(FeaturesConditions.FeatureConditions.nameNull(), feature, "name "); + + // assertion fail + assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> Assertions.assertThat(feature) + .hasNameNull()) + .withMessage(format("%nExpecting:%n " + featureName + "%nto have:%n name ")); + } + } + // TODO: All additional tests after specification is more stable. +} diff --git a/org.osgi.test.assertj.feature/test.bndrun b/org.osgi.test.assertj.feature/test.bndrun new file mode 100644 index 00000000..b17ff53e --- /dev/null +++ b/org.osgi.test.assertj.feature/test.bndrun @@ -0,0 +1,57 @@ +# Copyright (c) OSGi Alliance (2019, 2020). All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +-tester: biz.aQute.tester.junit-platform + +-runvm: ${def;argLine} + +-runfw: org.eclipse.osgi +-resolve.effective: active +-runproperties: \ + logback.configurationFile=${fileuri;${.}/logback.xml},\ + org.apache.felix.http.host=localhost,\ + org.osgi.service.http.port=*,\ + org.osgi.framework.bootdelegation=sun.reflect,\ + osgi.console= + +-runsystempackages: \ + org.slf4j;version=1.7.25,\ + org.slf4j.helpers;version=1.7.25,\ + org.slf4j.spi;version=1.7.25 +-runpath: \ + ch.qos.logback.classic,\ + ch.qos.logback.core,\ + org.apache.felix.logback,\ + slf4j.api +-runrequires: \ + bnd.identity;id='${project.artifactId}-tests',\ + bnd.identity;id='junit-jupiter-engine',\ + bnd.identity;id='junit-platform-launcher' +# This will help us keep -runbundles sorted +-runstartlevel: \ + order=sortbynameversion,\ + begin=-1 +-runbundles: \ + assertj-core;version='[3.19.0,3.19.1)',\ + junit-jupiter-api;version='[5.7.1,5.7.2)',\ + junit-jupiter-engine;version='[5.7.1,5.7.2)',\ + junit-platform-commons;version='[1.7.1,1.7.2)',\ + junit-platform-engine;version='[1.7.1,1.7.2)',\ + junit-platform-launcher;version='[1.7.1,1.7.2)',\ + org.opentest4j;version='[1.2.0,1.2.1)',\ + org.osgi.test.assertj.promise;version='[0.11.0,0.11.1)',\ + org.osgi.test.assertj.promise-tests;version='[0.11.0,0.11.1)',\ + org.osgi.test.common;version='[0.11.0,0.11.1)',\ + org.osgi.util.function;version='[1.0.0,1.0.1)',\ + org.osgi.util.feature;version='[1.0.0,1.0.1)' diff --git a/org.osgi.test.bom/pom.xml b/org.osgi.test.bom/pom.xml index 5ef613af..d8d8b06b 100644 --- a/org.osgi.test.bom/pom.xml +++ b/org.osgi.test.bom/pom.xml @@ -60,6 +60,12 @@ ${project.version} test + + org.osgi + org.osgi.test.assertj.feature + ${project.version} + test + org.osgi org.osgi.test.junit4 diff --git a/pom.xml b/pom.xml index 01c3d531..ca759aec 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,7 @@ org.osgi.test.common + org.osgi.test.assertj.feature org.osgi.test.assertj.framework org.osgi.test.assertj.promise org.osgi.test.junit4 @@ -116,7 +117,17 @@ http://www.eclipse.org/lists/osgi-users - + + + + snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + default + + false + + + @@ -579,6 +590,12 @@ 1.6.0 compile + + org.osgi + org.osgi.util.feature + 1.0.0-SNAPSHOT + compile + org.osgi org.osgi.util.function