From ad4a2da2c3f085898df9af2fc5a20758c61b6a81 Mon Sep 17 00:00:00 2001 From: ThibaultBee Date: Tue, 5 Dec 2023 15:34:34 +0000 Subject: [PATCH] fix(java): fix unit test on captions due to regression --- .../api/client/api/clients/CaptionsApiTest.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/test/java/video/api/client/api/clients/CaptionsApiTest.java b/src/test/java/video/api/client/api/clients/CaptionsApiTest.java index 5000742..3d14973 100644 --- a/src/test/java/video/api/client/api/clients/CaptionsApiTest.java +++ b/src/test/java/video/api/client/api/clients/CaptionsApiTest.java @@ -88,9 +88,11 @@ public void responseWithStatus200Test() throws ApiException { assertThat(res.getItems()).containsExactlyInAnyOrder( new Caption().src("https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt") - .uri("/videos/vi3N6cDinStg3oBbN79GklWS/captions/en").srclang("en")._default(false), + .uri("/videos/vi3N6cDinStg3oBbN79GklWS/captions/en").srclang("en").languageName("English") + ._default(false), new Caption().src("https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/fr.vtt") - .uri("/videos/vi3N6cDinStg3oBbN79GklWS/captions/fr").srclang("fr")._default(false)); + .uri("/videos/vi3N6cDinStg3oBbN79GklWS/captions/fr").srclang("fr").languageName("Française") + ._default(false)); } @Test @@ -132,6 +134,7 @@ public void responseWithStatus200Test() throws ApiException { assertThat(res.getUri()).isEqualTo("/videos/vi3N6cDinStg3oBbN79GklWS/captions/en"); assertThat(res.getSrc()).isEqualTo("https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt"); assertThat(res.getSrclang()).isEqualTo("en"); + assertThat(res.getLanguageName()).isEqualTo("English"); assertThat(res.getDefault()).isEqualTo(false); } @@ -180,18 +183,19 @@ public void responseWithStatus200Test() throws ApiException { assertThat(res.getUri()).isEqualTo("/videos/vi3N6cDinStg3oBbN79GklWS/captions/en"); assertThat(res.getSrc()).isEqualTo("https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt"); assertThat(res.getSrclang()).isEqualTo("en"); + assertThat(res.getLanguageName()).isEqualTo("English"); assertThat(res.getDefault()).isEqualTo(true); } @Test - @DisplayName("400 response") + @DisplayName("400-0 response") public void responseWithStatus400Test() throws ApiException { - answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400.json")); + answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400-0.json")); - assertThatThrownBy(() -> api.update("vi4k0jvEUuaTdRAEjQ4Prklg", "en", new CaptionsUpdatePayload())) + assertThatThrownBy(() -> api.update("vi4k0jvEUuaTdRAEjQ4Prklg", "en_", new CaptionsUpdatePayload())) .isInstanceOf(ApiException.class) .satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(400)) - .hasMessage("string (required)"); + .hasMessage("An attribute is invalid."); } @Test @@ -238,6 +242,7 @@ public void responseWithStatus200Test() throws ApiException { assertThat(res.getUri()).isEqualTo("/videos/vi3N6cDinStg3oBbN79GklWS/captions/en"); assertThat(res.getSrc()).isEqualTo("https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt"); assertThat(res.getSrclang()).isEqualTo("en"); + assertThat(res.getLanguageName()).isEqualTo("English"); assertThat(res.getDefault()).isEqualTo(false); }