From 80fec34e2789622fb0a5a0ff8bb08a9369856c46 Mon Sep 17 00:00:00 2001 From: Steve Chaloner Date: Fri, 3 May 2024 10:17:14 +0200 Subject: [PATCH] Update tests for new error messages Reflects changes in more detailed error messages from the server --- src/test/java/seatsio/ErrorHandlingTest.java | 6 ++++-- src/test/java/seatsio/charts/ManageCategoriesTest.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/java/seatsio/ErrorHandlingTest.java b/src/test/java/seatsio/ErrorHandlingTest.java index 6fc9a25..dcd37bf 100644 --- a/src/test/java/seatsio/ErrorHandlingTest.java +++ b/src/test/java/seatsio/ErrorHandlingTest.java @@ -12,8 +12,10 @@ public class ErrorHandlingTest extends SeatsioClientTest { @Test public void test400() { SeatsioException e = assertThrows(SeatsioException.class, () -> client.charts.retrieve("unexistingChart")); - assertThat(e.getMessage()).contains("Chart not found: unexistingChart"); - assertThat(e.errors).containsExactly(new ApiError("CHART_NOT_FOUND", "Chart not found: unexistingChart")); + assertThat(e.getMessage()).contains("Chart not found: unexistingChart was not found in workspace"); + assertThat(e.errors).hasSize(1); + assertThat(e.errors.get(0).getCode()).isEqualTo("CHART_NOT_FOUND"); + assertThat(e.errors.get(0).getMessage()).startsWith("Chart not found: unexistingChart was not found in workspace"); } @Test diff --git a/src/test/java/seatsio/charts/ManageCategoriesTest.java b/src/test/java/seatsio/charts/ManageCategoriesTest.java index 3524fd6..f1951ce 100644 --- a/src/test/java/seatsio/charts/ManageCategoriesTest.java +++ b/src/test/java/seatsio/charts/ManageCategoriesTest.java @@ -134,7 +134,7 @@ public void updateCategory_doNotChangeAnything() { public void updateCategory_unknownChart() { SeatsioException e = assertThrows(SeatsioException.class, () -> client.charts.updateCategory("unknownChart", CategoryKey.of("cat2"), new CategoryUpdateParams("New label", "#cccccc", false))); - assertThat(e.getMessage()).isEqualTo("Chart not found: unknownChart"); + assertThat(e.getMessage()).startsWith("Chart not found: unknownChart was not found in workspace"); } @Test