pom, ut method names
This commit is contained in:
parent
ccd3e5b728
commit
63d20dc1b1
|
@ -15,6 +15,8 @@
|
|||
|
||||
<properties>
|
||||
<dep.ver.metrics>3.1.0</dep.ver.metrics>
|
||||
<dep.ver.servlet>3.1.0</dep.ver.servlet>
|
||||
<dep.ver.junit>4.12</dep.ver.junit>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -41,12 +43,13 @@
|
|||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<version>${dep.ver.servlet}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<version>${dep.ver.junit}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -5,6 +5,6 @@ import com.codahale.metrics.health.HealthCheck;
|
|||
public class DatabaseHealthCheck extends HealthCheck {
|
||||
@Override
|
||||
protected Result check() throws Exception {
|
||||
return HealthCheck.Result.healthy();
|
||||
return Result.healthy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.codahale.metrics.*;
|
|||
|
||||
public class MetricsTest {
|
||||
@Test
|
||||
public void testMeter() throws InterruptedException {
|
||||
public void whenMarkMeter_thenCorrectRates() throws InterruptedException {
|
||||
Meter meter = new Meter();
|
||||
|
||||
long initCount = meter.getCount();
|
||||
|
@ -38,13 +38,13 @@ public class MetricsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testRatioGauge() {
|
||||
public void whenInitRatioGauge_thenCorrectRatio() {
|
||||
Gauge<Double> ratioGauge = new AttendanceRatioGauge(15, 20);
|
||||
assertThat(ratioGauge.getValue(), equalTo(0.75));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCacheGauge() {
|
||||
public void whenUseCacheGauge_thenCorrectGauge() {
|
||||
Gauge<List<Long>> activeUsersGauge = new ActiveUsersGauge(15, TimeUnit.MINUTES);
|
||||
List<Long> expected = new ArrayList<Long>();
|
||||
expected.add(12L);
|
||||
|
@ -52,14 +52,14 @@ public class MetricsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testDerivativeGauge() {
|
||||
public void whenUseDerivativeGauge_thenCorrectGaugeFromBase() {
|
||||
Gauge<List<Long>> activeUsersGauge = new ActiveUsersGauge(15, TimeUnit.MINUTES);
|
||||
Gauge<Integer> activeUserCountGauge = new ActiveUserCountGauge(activeUsersGauge);
|
||||
assertThat(activeUserCountGauge.getValue(), equalTo(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCounter() {
|
||||
public void whenIncDecCounter_thenCorrectCount() {
|
||||
Counter counter = new Counter();
|
||||
|
||||
long initCount = counter.getCount();
|
||||
|
@ -79,7 +79,7 @@ public class MetricsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testHistogram() {
|
||||
public void whenUpdateHistogram_thenCorrectDistributionData() {
|
||||
Histogram histogram = new Histogram(new UniformReservoir());
|
||||
|
||||
histogram.update(5);
|
||||
|
@ -119,7 +119,7 @@ public class MetricsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testTimer() throws InterruptedException {
|
||||
public void whenUseTimer_thenCorrectTimerContexts() throws InterruptedException {
|
||||
Timer timer = new Timer();
|
||||
|
||||
Timer.Context context1 = timer.time();
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.codahale.metrics.*;
|
|||
|
||||
public class ReporterTest {
|
||||
@Test
|
||||
public void testConsoleReporter() {
|
||||
public void whenConsoleReporter_thenOutputReport() {
|
||||
MetricRegistry metricRegistry = new MetricRegistry();
|
||||
|
||||
Meter meter = metricRegistry.meter("meter");
|
||||
|
|
|
@ -12,7 +12,7 @@ import com.codahale.metrics.health.HealthCheckRegistry;
|
|||
|
||||
public class HealthCheckTest {
|
||||
@Test
|
||||
public void testHealthCheck() {
|
||||
public void whenUseHealthCheck_thenHealthChecked() {
|
||||
HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry();
|
||||
|
||||
healthCheckRegistry.register("db", new DatabaseHealthCheck());
|
||||
|
|
Loading…
Reference in New Issue