From cd22df318e3729d829d057bc5d3fb776c1d4203b Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Mon, 23 Oct 2023 13:28:15 -0600 Subject: [PATCH] Improve error message when test fails --- .../ncss/controller/grid/GridDatasetControllerTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tds/src/test/java/thredds/server/ncss/controller/grid/GridDatasetControllerTest.java b/tds/src/test/java/thredds/server/ncss/controller/grid/GridDatasetControllerTest.java index 777fd5d544..ae1323ced1 100644 --- a/tds/src/test/java/thredds/server/ncss/controller/grid/GridDatasetControllerTest.java +++ b/tds/src/test/java/thredds/server/ncss/controller/grid/GridDatasetControllerTest.java @@ -5,6 +5,7 @@ package thredds.server.ncss.controller.grid; import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assertWithMessage; import static org.junit.Assume.assumeTrue; import java.io.FileNotFoundException; @@ -142,10 +143,11 @@ public void shouldCloseCacheResourcesWhenExceptionIsThrown() throws Exception { final FileCacheIF rafCache = RandomAccessFile.getGlobalFileCache(); rafCache.clearCache(true); - assertThat(rafCache.showCache()).isEmpty(); + assertWithMessage(rafCache.showCache().toString()).that(rafCache.showCache()).isEmpty(); mockMvc.perform(rb); - assertThat(rafCache.showCache().size()).isEqualTo(1); - assertThat(rafCache.showCache().get(0)).startsWith("false"); // file should not be locked + assertWithMessage(rafCache.showCache().toString()).that(rafCache.showCache().size()).isEqualTo(1); + // file should not be locked + assertWithMessage(rafCache.showCache().toString()).that(rafCache.showCache().get(0)).startsWith("false"); } private class FilenameMatcher extends BaseMatcher {