use of services.StringService in project helidon by oracle.
the class MetricsTest method shouldHaveTimerMetric.
/**
* Verify that the StringService split method has the timer metric.
*/
@Test
public void shouldHaveTimerMetric() {
JsonObject json = getMetrics();
JsonObject timer = json.getJsonObject(StringService.class.getName() + ".split");
assertThat(timer, is(notNullValue()));
int count = timer.getInt("count");
int min = timer.getInt("min");
assertThat(count, is(0));
assertThat(min, is(0));
Iterator<StringMessage> iterator = stringStub.split(StringMessage.newBuilder().setText("A B C").build());
while (iterator.hasNext()) {
iterator.next();
}
json = getMetrics();
timer = json.getJsonObject(StringService.class.getName() + ".split");
assertThat(timer, is(notNullValue()));
count = timer.getInt("count");
min = timer.getInt("min");
assertThat(count, is(1));
assertThat(min, is(not(0)));
}
use of services.StringService in project helidon by oracle.
the class MetricsTest method shouldHaveCounterMetric.
/**
* Verify that the StringService upper method has the counter metric.
*/
@Test
public void shouldHaveCounterMetric() {
JsonObject json = getMetrics();
int count = json.getInt(StringService.class.getName() + ".upper");
assertThat(count, is(0));
stringStub.upper(StringMessage.newBuilder().setText("foo").build());
json = getMetrics();
count = json.getInt(StringService.class.getName() + ".upper");
assertThat(count, is(1));
}
Aggregations