66package io .opentelemetry .contrib .jmxscraper .assertions ;
77
88import java .util .Objects ;
9+ import javax .annotation .Nullable ;
910
1011/** Implements functionality of matching data point attributes. */
1112public class AttributeMatcher {
1213 private final String attributeName ;
13- @ Nullable
14- private final String attributeValue ;
14+ @ Nullable private final String attributeValue ;
1515
1616 /**
1717 * Create instance used to match data point attribute with any value.
1818 *
1919 * @param attributeName matched attribute name
2020 */
2121 AttributeMatcher (String attributeName ) {
22- this .attributeName = attributeName ;
23- this .attributeValue = null ;
22+ this (attributeName , null );
2423 }
2524
2625 /**
@@ -29,7 +28,7 @@ public class AttributeMatcher {
2928 * @param attributeName attribute name
3029 * @param attributeValue attribute value
3130 */
32- AttributeMatcher (String attributeName , String attributeValue ) {
31+ AttributeMatcher (String attributeName , @ Nullable String attributeValue ) {
3332 this .attributeName = attributeName ;
3433 this .attributeValue = attributeValue ;
3534 }
@@ -76,7 +75,7 @@ public String toString() {
7675 * @return true if this matcher is matching provided value, false otherwise.
7776 */
7877 boolean matchesValue (String value ) {
79- if (( attributeValue == null ) || ( value == null ) ) {
78+ if (attributeValue == null ) {
8079 return true ;
8180 }
8281 return Objects .equals (attributeValue , value );
0 commit comments