Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(java): fix unit test on captions due to regression #359

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public void responseWithStatus200Test() throws ApiException {

assertThat(res.getItems()).containsExactlyElementsIn(Arrays.asList(
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)))
.inOrder();
}

Expand Down Expand Up @@ -137,6 +137,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 @@ -183,17 +184,18 @@ 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")
public void responseWithStatus400Test() throws ApiException {
answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400.json"));
answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400-0.json"));

ApiException e = assertThrows(ApiException.class, () -> api.update("vi4k0jvEUuaTdRAEjQ4Prklg", "en", new CaptionsUpdatePayload()));
ApiException e = assertThrows(ApiException.class, () -> api.update("vi4k0jvEUuaTdRAEjQ4Prklg", "en_", new CaptionsUpdatePayload()));
assertThat(e.getCode()).isEqualTo(400);
assertThat(e).hasMessageThat().contains("string (required)");
assertThat(e).hasMessageThat().contains("An attribute is invalid.");
}

@Test
Expand Down Expand Up @@ -239,6 +241,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
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ 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 +132,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 +181,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 +240,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
Loading