Remove unnecessary type specifications

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179585680
This commit is contained in:
mcilwain 2017-12-19 12:03:43 -08:00 committed by Ben McIlwain
parent f1ae66d148
commit ed0670b614
52 changed files with 193 additions and 221 deletions

View file

@ -26,11 +26,11 @@ import org.junit.runners.JUnit4;
/** Tests for {@link CustomFitter}. */
@RunWith(JUnit4.class)
public class CustomFitterTest {
@Test
public void testCreateCustomFitter_emptyBounds_throwsException() throws Exception {
IllegalArgumentException thrown =
expectThrows(
IllegalArgumentException.class, () -> CustomFitter.create(ImmutableSet.<Double>of()));
expectThrows(IllegalArgumentException.class, () -> CustomFitter.create(ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("boundaries must not be empty");
}
@ -45,7 +45,6 @@ public class CustomFitterTest {
@Test
public void testCreateCustomFitter_hasGivenBounds() {
CustomFitter fitter = CustomFitter.create(ImmutableSortedSet.of(1.0, 2.0));
assertThat(fitter.boundaries()).containsExactly(1.0, 2.0).inOrder();
}
}

View file

@ -43,20 +43,19 @@ public class MetricReporterTest {
@Test
public void testRunOneIteration_enqueuesBatch() throws Exception {
Metric<?> metric =
new Counter("/name", "description", "vdn", ImmutableSet.<LabelDescriptor>of());
Metric<?> metric = new Counter("/name", "description", "vdn", ImmutableSet.of());
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of(metric, metric));
MetricReporter reporter = new MetricReporter(writer, 10L, threadFactory, registry, writeQueue);
reporter.runOneIteration();
verify(writeQueue).offer(Optional.of(ImmutableList.<MetricPoint<?>>of()));
verify(writeQueue).offer(Optional.of(ImmutableList.of()));
}
@Test
public void testShutDown_enqueuesBatchAndPoisonPill() throws Exception {
// Set up a registry with no metrics.
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.<Metric<?>>of());
when(registry.getRegisteredMetrics()).thenReturn(ImmutableList.of());
MetricReporter reporter =
spy(new MetricReporter(writer, 10L, threadFactory, registry, writeQueue));
@ -64,7 +63,7 @@ public class MetricReporterTest {
verify(reporter).runOneIteration();
InOrder interactions = Mockito.inOrder(writeQueue);
interactions.verify(writeQueue).offer(Optional.of(ImmutableList.<MetricPoint<?>>of()));
interactions.verify(writeQueue).offer(Optional.<ImmutableList<MetricPoint<?>>>empty());
interactions.verify(writeQueue).offer(Optional.of(ImmutableList.of()));
interactions.verify(writeQueue).offer(Optional.empty());
}
}

View file

@ -38,7 +38,7 @@ public class MetricSchemaTest {
"description",
"valueDisplayName",
Kind.GAUGE,
ImmutableSet.<LabelDescriptor>of()));
ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("Name must not be blank");
}
@ -49,11 +49,7 @@ public class MetricSchemaTest {
IllegalArgumentException.class,
() ->
MetricSchema.create(
"/name",
"",
"valueDisplayName",
Kind.GAUGE,
ImmutableSet.<LabelDescriptor>of()));
"/name", "", "valueDisplayName", Kind.GAUGE, ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("Description must not be blank");
}
@ -62,9 +58,7 @@ public class MetricSchemaTest {
IllegalArgumentException thrown =
expectThrows(
IllegalArgumentException.class,
() ->
MetricSchema.create(
"/name", "description", "", Kind.GAUGE, ImmutableSet.<LabelDescriptor>of()));
() -> MetricSchema.create("/name", "description", "", Kind.GAUGE, ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("Value Display Name must not be empty");
}
@ -75,11 +69,7 @@ public class MetricSchemaTest {
IllegalArgumentException.class,
() ->
MetricSchema.create(
"foo",
"description",
"valueDisplayName",
Kind.GAUGE,
ImmutableSet.<LabelDescriptor>of()));
"foo", "description", "valueDisplayName", Kind.GAUGE, ImmutableSet.of()));
assertThat(thrown).hasMessageThat().contains("Name must be URL-like and start with a '/'");
}
}

View file

@ -31,8 +31,7 @@ public class StoredMetricTest {
@Test
public void testGetCardinality_reflectsCurrentCardinality() {
StoredMetric<Boolean> smallMetric =
new StoredMetric<>(
"/metric", "description", "vdn", ImmutableSet.<LabelDescriptor>of(), Boolean.class);
new StoredMetric<>("/metric", "description", "vdn", ImmutableSet.of(), Boolean.class);
assertThat(smallMetric.getCardinality()).isEqualTo(0);
smallMetric.set(true);

View file

@ -113,7 +113,7 @@ public final class SheepCounterExample {
"/is_sleeping",
"Tracks sleep state.",
"Sleeping?",
ImmutableSet.<LabelDescriptor>of(),
ImmutableSet.of(),
Boolean.class);
/**
@ -128,8 +128,8 @@ public final class SheepCounterExample {
"/sleep_quality",
"Quality of the sleep.",
"Quality",
ImmutableSet.<LabelDescriptor>of(),
() -> ImmutableMap.of(ImmutableList.<String>of(), new Random().nextDouble()),
ImmutableSet.of(),
() -> ImmutableMap.of(ImmutableList.of(), new Random().nextDouble()),
Double.class);
/**