Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasJazz committed Feb 14, 2024
1 parent ea65033 commit d96cfd7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
Expand Up @@ -2,6 +2,7 @@
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.metrics.data;

import static java.util.Objects.requireNonNull;
Expand All @@ -11,8 +12,8 @@
import javax.annotation.Nullable;

/**
* A {@link MetricData} which delegates all methods to another {@link MetricData}. Extend this class to
* modify the {@link MetricData} that will be exported.
* A {@link MetricData} which delegates all methods to another {@link MetricData}. Extend this class
* to modify the {@link MetricData} that will be exported.
*/
public abstract class DelegatingMetricData implements MetricData {

Expand Down Expand Up @@ -64,13 +65,13 @@ public boolean equals(@Nullable Object o) {
}
if (o instanceof MetricData) {
MetricData that = (MetricData) o;
return getResource().equals(that.getResource()) &&
getInstrumentationScopeInfo().equals(that.getInstrumentationScopeInfo()) &&
getName().equals(that.getName()) &&
getDescription().equals(that.getDescription()) &&
getUnit().equals(that.getUnit()) &&
getType().equals(that.getType()) &&
getData().equals(that.getData());
return getResource().equals(that.getResource())
&& getInstrumentationScopeInfo().equals(that.getInstrumentationScopeInfo())
&& getName().equals(that.getName())
&& getDescription().equals(that.getDescription())
&& getUnit().equals(that.getUnit())
&& getType().equals(that.getType())
&& getData().equals(that.getData());
}
return false;
}
Expand All @@ -97,14 +98,27 @@ public int hashCode() {

@Override
public String toString() {
return "DelegatingMetricData{" +
"resource=" + getResource() + ", " +
"instrumentationScopeInfo=" + getInstrumentationScopeInfo() + ", " +
"name=" + getName() + ", " +
"description=" + getDescription() + ", " +
"unit=" + getUnit() + ", " +
"type=" + getType() + ", " +
"data=" + getData() +
"}";
return "DelegatingMetricData{"
+ "resource="
+ getResource()
+ ", "
+ "instrumentationScopeInfo="
+ getInstrumentationScopeInfo()
+ ", "
+ "name="
+ getName()
+ ", "
+ "description="
+ getDescription()
+ ", "
+ "unit="
+ getUnit()
+ ", "
+ "type="
+ getType()
+ ", "
+ "data="
+ getData()
+ "}";
}
}
Expand Up @@ -2,6 +2,7 @@
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.metrics.data;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -33,7 +34,6 @@ private MetricDataWithCustomDescription(MetricData delegate) {
public String getDescription() {
return description;
}

}

@Test
Expand All @@ -54,6 +54,7 @@ void overrideDelegate() {

assertThat(withCustomDescription.getDescription()).isEqualTo("test");
}

@Test
void equals() {
MetricData metricData = createBasicMetricBuilder().build();
Expand Down

0 comments on commit d96cfd7

Please sign in to comment.