Skip to content

Commit

Permalink
fix(java): fix unit test on captions due to regression
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee authored Dec 5, 2023
1 parent d8e1efe commit ad4a2da
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/test/java/video/api/client/api/clients/CaptionsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit ad4a2da

Please sign in to comment.