Skip to content

MultipleHAMTests - Create tests for Multiple HAMs with qualifiers #33954

@TheoGkoumas

Description

@TheoGkoumas
  • Simple testing strategy as need to test the most likely and applicable scenarios.
  • Create Custom HAM Handler and ensure it is favoured over the in-built one (this is core to testing HAMs with qualifiers as the Jakarta specification states that if at least one HAM is defined with a qualifier, then a Custom HAM handler must be present!).
  • SCENARIO 1: Testing 3 BasicHAMs (two with qualifiers, one without), and a Form HAM (with qualifier) and a CustomForm HAM (with qualifier) - and then, in the Custom HAM handler, ensuring all the HAMs are injected. NOTE: 4 qualifiers in total - Admin, User, Operator and Tester.
  • SCENARIO 2: Testing 1 BasicHAM (without a qualifier) - and then, in the Custom HAM handler, ensuring it is injected using the @default annotation, and the same one can be selected without an annotation.
  • SCENARIO 3: Testing 2 BasicHAMs (both with qualifiers) - and then, in the Custom HAM handler, ensuring the two HAMs are injected in with their qualifiers, and also one of them can be injected with the @default annotation and the same one can be selected without an annotation.
  • Testing log file output to ensure a clear info message showing which HAMHandler was selected (it will be the name of the Custom HAM handler in the application).
  • Testing log file output to make sure no unexpected error messages are output.
  • Negative testing:
    • conditions for raising Exception (including log file message) - this is done by having at least one HAM defined with a qualifier, but not having a Custom HAM Handler within the application.

Test class name: MultipleHAMTests

Implementation

  • For in-built HAMs, @Form.., @CustomForm... and @basic... would be sufficient.
  • Also, define - in four separate Java classes - four annotations: Admin, User, Operator and Tester. Admin is shown below.
  • Lastly, use a user registry for credentials.
@Qualifier
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface Admin {
}

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions