Skip to content

Commit

Permalink
Improve diagnostics in PublicMetricsAutoConfigurationTests
Browse files Browse the repository at this point in the history
multipleCacheManagers fails on the CI server but does not fail
locally. This commit updates assertMetrics to include information
about the actual metrics so it's clear why the expectation was not
met.
  • Loading branch information
wilkinsona committed Apr 14, 2015
1 parent dcd0eb7 commit 834276a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@

import com.zaxxer.hikari.HikariDataSource;

import static org.hamcrest.Matchers.hasKey;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -236,7 +237,7 @@ private void assertMetrics(Collection<Metric<?>> metrics, String... keys) {
content.put(metric.getName(), metric.getValue());
}
for (String key : keys) {
assertTrue("Key '" + key + "' was not found", content.containsKey(key));
assertThat(content, hasKey(key));
}
}

Expand Down

0 comments on commit 834276a

Please sign in to comment.