Refector metrics truth subject

The concrete implementation of a Metric is not of importance when asserting on the values it contains. Therefore this CL removes Metric<T> as a type parameter of AbstractMetricSubject. As a result the two implementations of the abstract subject can be used on any Metric<Long> and Metric<Distribution>, respectively.

Also migrate to Subject.Factory from deprecated SubjectFactory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171012012
This commit is contained in:
jianglai 2017-10-04 08:23:05 -07:00 committed by Ben McIlwain
parent a9ecccf672
commit 9d8e48cf24
7 changed files with 60 additions and 74 deletions

View file

@ -15,7 +15,7 @@
package google.registry.monitoring.metrics.contrib;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.monitoring.metrics.contrib.EventMetricSubject.assertThat;
import static google.registry.monitoring.metrics.contrib.DistributionMetricSubject.assertThat;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableSet;
@ -28,7 +28,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class EventMetricSubjectTest {
public class DistributionMetricSubjectTest {
private static final ImmutableSet<LabelDescriptor> LABEL_DESCRIPTORS =
ImmutableSet.of(

View file

@ -15,7 +15,7 @@
package google.registry.monitoring.metrics.contrib;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.monitoring.metrics.contrib.IncrementableMetricSubject.assertThat;
import static google.registry.monitoring.metrics.contrib.LongMetricSubject.assertThat;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableSet;
@ -28,7 +28,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class IncrementableMetricSubjectTest {
public class LongMetricSubjectTest {
private static final ImmutableSet<LabelDescriptor> LABEL_DESCRIPTORS =
ImmutableSet.of(