@SuppressWarnings("unchecked") @Test public void testName() throws Exception { Counter counter = mock(Counter.class); doReturn(counter).when(registry).counter(eq("counterName"), any(Iterable.class)); underTest.increment("road", AUTHENTICATED, AUTHORISED); ArgumentCaptor<Iterable<Tag>> captor = ArgumentCaptor.forClass(Iterable.class); verify(registry).counter(eq("counterName"), captor.capture()); verify(counter).increment(); Iterable<Tag> tags = captor.getValue(); assertThat(tags, hasItems(Tag.of("road", "road"), Tag.of("authentication", "AUTHENTICATED"), Tag.of("authorisation", "AUTHORISED"))); }
public void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome) { ImmutableList<Tag> tags = ImmutableList .<Tag> builder() .add(Tag.of("road", roadName)) .add(Tag.of("authentication", type.name())) .add(Tag.of("authorisation", outcome.name())) .build(); registry.counter(counterName, tags).increment(); }
SecurityMetrics { public void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome) { ImmutableList<Tag> tags = ImmutableList .<Tag> builder() .add(Tag.of("road", roadName)) .add(Tag.of("authentication", type.name())) .add(Tag.of("authorisation", outcome.name())) .build(); registry.counter(counterName, tags).increment(); } }
SecurityMetrics { public void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome) { ImmutableList<Tag> tags = ImmutableList .<Tag> builder() .add(Tag.of("road", roadName)) .add(Tag.of("authentication", type.name())) .add(Tag.of("authorisation", outcome.name())) .build(); registry.counter(counterName, tags).increment(); }  }
SecurityMetrics { public void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome) { ImmutableList<Tag> tags = ImmutableList .<Tag> builder() .add(Tag.of("road", roadName)) .add(Tag.of("authentication", type.name())) .add(Tag.of("authorisation", outcome.name())) .build(); registry.counter(counterName, tags).increment(); }  void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome); }
SecurityMetrics { public void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome) { ImmutableList<Tag> tags = ImmutableList .<Tag> builder() .add(Tag.of("road", roadName)) .add(Tag.of("authentication", type.name())) .add(Tag.of("authorisation", outcome.name())) .build(); registry.counter(counterName, tags).increment(); }  void increment(String roadName, AuthenticationType type, AuthorisationOutcome outcome);  }