From 5085504eb3d7b4e5a62334e427e1eac752a7e775 Mon Sep 17 00:00:00 2001 From: pszumanski Date: Mon, 8 Apr 2024 12:55:52 +0200 Subject: [PATCH 1/2] UsosCourseEdition bugfix Result of the method is not equivalent to declared result in official API --- .../wmsdev/usos4j/model/grades/UsosGradesCourseEdition.java | 2 +- .../src/test/java/pl/wmsdev/UsosGradesAPITest.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/pl/wmsdev/usos4j/model/grades/UsosGradesCourseEdition.java b/core/src/main/java/pl/wmsdev/usos4j/model/grades/UsosGradesCourseEdition.java index 24c187c..ad05b6c 100644 --- a/core/src/main/java/pl/wmsdev/usos4j/model/grades/UsosGradesCourseEdition.java +++ b/core/src/main/java/pl/wmsdev/usos4j/model/grades/UsosGradesCourseEdition.java @@ -4,5 +4,5 @@ import java.util.Map; -public record UsosGradesCourseEdition(UsosGradesExam[] courseGrades, Map courseUnitsGrades) implements UsosObject { +public record UsosGradesCourseEdition(Map[] courseGrades, Map courseUnitsGrades) implements UsosObject { } diff --git a/integration-tests/src/test/java/pl/wmsdev/UsosGradesAPITest.java b/integration-tests/src/test/java/pl/wmsdev/UsosGradesAPITest.java index dc84609..57ac10e 100644 --- a/integration-tests/src/test/java/pl/wmsdev/UsosGradesAPITest.java +++ b/integration-tests/src/test/java/pl/wmsdev/UsosGradesAPITest.java @@ -4,13 +4,17 @@ import org.junit.jupiter.api.Test; import pl.wmsdev.usos4j.model.grades.*; +import java.util.Arrays; + import static org.junit.jupiter.api.Assertions.assertThrows; public class UsosGradesAPITest extends UsosAPIBaseTest { @Test void courseEdition2() { - log(userApi.grades().courseEdition2(UsosGradesCourseEditionParams.builder("W13IST-SI0002G", "2023/24-Z").build())); + var result = userApi.grades().courseEdition2(UsosGradesCourseEditionParams.builder("W13IST-SI0002G", "2023/24-Z").build()); + log("result: " + result); + log("grade: " + Arrays.toString(result.courseGrades())); } @Test From f65730dfcf21c9e40d79846617d913e0d6544877 Mon Sep 17 00:00:00 2001 From: pszumanski Date: Mon, 8 Apr 2024 13:09:09 +0200 Subject: [PATCH 2/2] terms2 return type clarified --- .../main/java/pl/wmsdev/usos4j/api/grades/UsosGradesAPI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/pl/wmsdev/usos4j/api/grades/UsosGradesAPI.java b/core/src/main/java/pl/wmsdev/usos4j/api/grades/UsosGradesAPI.java index 9921cca..cf7c9e0 100644 --- a/core/src/main/java/pl/wmsdev/usos4j/api/grades/UsosGradesAPI.java +++ b/core/src/main/java/pl/wmsdev/usos4j/api/grades/UsosGradesAPI.java @@ -75,7 +75,7 @@ public List latest(UsosLatestParam params) { } @SuppressWarnings("unchecked") - public Map terms2(UsosGradesTermsParam params) { + public Map> terms2(UsosGradesTermsParam params) { return requestWithAccessToken(requestFactory.get( "services/grades/terms2", params, FieldSelector.fromRequest(UsosGrade.class)