mirror of
https://github.com/google/nomulus.git
synced 2025-07-09 04:33:28 +02:00
Run automatic Java 8 conversion over codebase
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171174380
This commit is contained in:
parent
44df5da771
commit
5edb7935ed
190 changed files with 2312 additions and 3096 deletions
|
@ -67,15 +67,11 @@ abstract class AbstractMetricSubject<T, S extends AbstractMetricSubject<T, S>>
|
|||
* Function to convert a metric point to a nice string representation for use in error messages.
|
||||
*/
|
||||
protected final Function<MetricPoint<T>, String> metricPointConverter =
|
||||
new Function<MetricPoint<T>, String>() {
|
||||
@Override
|
||||
public String apply(MetricPoint<T> metricPoint) {
|
||||
return String.format(
|
||||
metricPoint ->
|
||||
String.format(
|
||||
"%s => %s",
|
||||
Joiner.on(':').join(metricPoint.labelValues()),
|
||||
getMessageRepresentation(metricPoint.value()));
|
||||
}
|
||||
};
|
||||
|
||||
protected AbstractMetricSubject(FailureMetadata metadata, Metric<T> actual) {
|
||||
super(metadata, checkNotNull(actual));
|
||||
|
|
|
@ -19,7 +19,6 @@ import static com.google.common.truth.Truth.assertAbout;
|
|||
import com.google.common.collect.BoundType;
|
||||
import com.google.common.collect.Range;
|
||||
import com.google.common.truth.FailureMetadata;
|
||||
import com.google.common.truth.Subject;
|
||||
import google.registry.monitoring.metrics.Distribution;
|
||||
import google.registry.monitoring.metrics.Metric;
|
||||
import google.registry.monitoring.metrics.MetricPoint;
|
||||
|
@ -48,15 +47,9 @@ public final class DistributionMetricSubject
|
|||
extends AbstractMetricSubject<Distribution, DistributionMetricSubject> {
|
||||
|
||||
/** {@link Subject.Factory} for assertions about {@link Metric<Distribution>} objects. */
|
||||
private static final Subject.Factory<DistributionMetricSubject, Metric<Distribution>>
|
||||
SUBJECT_FACTORY =
|
||||
// The Truth extensibility documentation indicates that the target should be nullable.
|
||||
(FailureMetadata failureMetadata, @Nullable Metric<Distribution> target) ->
|
||||
new DistributionMetricSubject(failureMetadata, target);
|
||||
|
||||
/** Static assertThat({@link Metric<Distribution>}) shortcut method. */
|
||||
public static DistributionMetricSubject assertThat(@Nullable Metric<Distribution> metric) {
|
||||
return assertAbout(SUBJECT_FACTORY).that(metric);
|
||||
return assertAbout(DistributionMetricSubject::new).that(metric);
|
||||
}
|
||||
|
||||
private DistributionMetricSubject(FailureMetadata metadata, Metric<Distribution> actual) {
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.monitoring.metrics.contrib;
|
|||
import static com.google.common.truth.Truth.assertAbout;
|
||||
|
||||
import com.google.common.truth.FailureMetadata;
|
||||
import com.google.common.truth.Subject;
|
||||
import google.registry.monitoring.metrics.Metric;
|
||||
import google.registry.monitoring.metrics.MetricPoint;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -45,14 +44,9 @@ import javax.annotation.Nullable;
|
|||
public final class LongMetricSubject extends AbstractMetricSubject<Long, LongMetricSubject> {
|
||||
|
||||
/** {@link Subject.Factory} for assertions about {@link Metric<Long>} objects. */
|
||||
private static final Subject.Factory<LongMetricSubject, Metric<Long>> SUBJECT_FACTORY =
|
||||
// The Truth extensibility documentation indicates that the target should be nullable.
|
||||
(FailureMetadata failureMetadata, @Nullable Metric<Long> target) ->
|
||||
new LongMetricSubject(failureMetadata, target);
|
||||
|
||||
/** Static assertThat({@link Metric<Long>}) shortcut method. */
|
||||
public static LongMetricSubject assertThat(@Nullable Metric<Long> metric) {
|
||||
return assertAbout(SUBJECT_FACTORY).that(metric);
|
||||
return assertAbout(LongMetricSubject::new).that(metric);
|
||||
}
|
||||
|
||||
private LongMetricSubject(FailureMetadata metadata, Metric<Long> actual) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue