Improve diagnostics in PublicMetricsAutoConfigurationTests

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.
This commit is contained in:
Andy Wilkinson
2015-04-14 17:15:35 +01:00
parent dcd0eb7895
commit 834276aa2b

View File

@@ -56,9 +56,10 @@ import org.springframework.util.SocketUtils;
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;
@@ -236,7 +237,7 @@ public class PublicMetricsAutoConfigurationTests {
content.put(metric.getName(), metric.getValue());
}
for (String key : keys) {
assertTrue("Key '" + key + "' was not found", content.containsKey(key));
assertThat(content, hasKey(key));
}
}