1414
1515public class MetricsTest {
1616 @ Test
17- public void testMeter () throws InterruptedException {
17+ public void whenMarkMeter_thenCorrectRates () throws InterruptedException {
1818 Meter meter = new Meter ();
1919
2020 long initCount = meter .getCount ();
@@ -38,28 +38,28 @@ public void testMeter() throws InterruptedException {
3838 }
3939
4040 @ Test
41- public void testRatioGauge () {
41+ public void whenInitRatioGauge_thenCorrectRatio () {
4242 Gauge <Double > ratioGauge = new AttendanceRatioGauge (15 , 20 );
4343 assertThat (ratioGauge .getValue (), equalTo (0.75 ));
4444 }
4545
4646 @ Test
47- public void testCacheGauge () {
47+ public void whenUseCacheGauge_thenCorrectGauge () {
4848 Gauge <List <Long >> activeUsersGauge = new ActiveUsersGauge (15 , TimeUnit .MINUTES );
4949 List <Long > expected = new ArrayList <Long >();
5050 expected .add (12L );
5151 assertThat (activeUsersGauge .getValue (), equalTo (expected ));
5252 }
5353
5454 @ Test
55- public void testDerivativeGauge () {
55+ public void whenUseDerivativeGauge_thenCorrectGaugeFromBase () {
5656 Gauge <List <Long >> activeUsersGauge = new ActiveUsersGauge (15 , TimeUnit .MINUTES );
5757 Gauge <Integer > activeUserCountGauge = new ActiveUserCountGauge (activeUsersGauge );
5858 assertThat (activeUserCountGauge .getValue (), equalTo (1 ));
5959 }
6060
6161 @ Test
62- public void testCounter () {
62+ public void whenIncDecCounter_thenCorrectCount () {
6363 Counter counter = new Counter ();
6464
6565 long initCount = counter .getCount ();
@@ -79,7 +79,7 @@ public void testCounter() {
7979 }
8080
8181 @ Test
82- public void testHistogram () {
82+ public void whenUpdateHistogram_thenCorrectDistributionData () {
8383 Histogram histogram = new Histogram (new UniformReservoir ());
8484
8585 histogram .update (5 );
@@ -119,7 +119,7 @@ public void testHistogram() {
119119 }
120120
121121 @ Test
122- public void testTimer () throws InterruptedException {
122+ public void whenUseTimer_thenCorrectTimerContexts () throws InterruptedException {
123123 Timer timer = new Timer ();
124124
125125 Timer .Context context1 = timer .time ();
0 commit comments