Annotation Interface Name


@Target({PARAMETER,FIELD}) @Retention(RUNTIME) public @interface Name

Disambiguating annotation for declarations of type KafkaCluster, Producer etc. when there are multiple KafkaClusters in scope.

For example, consider the following declaration:


 KafkaCluster clusterA;
 KafkaCluster clusterB;
 @Test
 public void myTest(Producer<String, String> producer)
 *

KafkaClusterExtension will fail parameter resolution with AmbiguousKafkaClusterException in this case because it's not clear whether producer should be configured for clusterA or clusterB.

You can disambiguate the code using @Name, like this:


 @Name("A") KafkaCluster clusterA;
 @Name("B") KafkaCluster clusterB;
 @Test
 public void myTest(@Name("A") Producer<String, String> producer)
 *

Where the @Name on the declaration of producer associates it with clusterA.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Value of the name.
  • Element Details

    • value

      String value
      Value of the name.
      Returns:
      the value