use of org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest in project haikudepotserver by haiku.
the class MiscelaneousApiIT method testGetAllUserRatingStabilities.
@Test
public void testGetAllUserRatingStabilities() {
// ------------------------------------
GetAllUserRatingStabilitiesResult result = miscellaneousApi.getAllUserRatingStabilities(new GetAllUserRatingStabilitiesRequest());
// ------------------------------------
ObjectContext objectContext = serverRuntime.newContext();
List<UserRatingStability> userRatingStabilities = UserRatingStability.getAll(objectContext);
Assertions.assertThat(userRatingStabilities.size()).isEqualTo(result.userRatingStabilities.size());
for (int i = 0; i < userRatingStabilities.size(); i++) {
UserRatingStability userRatingStability = userRatingStabilities.get(i);
GetAllUserRatingStabilitiesResult.UserRatingStability apiUserRatingStability = result.userRatingStabilities.get(i);
Assertions.assertThat(userRatingStability.getCode()).isEqualTo(apiUserRatingStability.code);
Assertions.assertThat(userRatingStability.getName()).isEqualTo(apiUserRatingStability.name);
}
}
use of org.haiku.haikudepotserver.api1.model.miscellaneous.GetAllUserRatingStabilitiesRequest in project haikudepotserver by haiku.
the class MiscelaneousApiIT method testGetAllUserRatingStabilities_de.
@Test
public void testGetAllUserRatingStabilities_de() {
GetAllUserRatingStabilitiesRequest request = new GetAllUserRatingStabilitiesRequest();
request.naturalLanguageCode = NaturalLanguage.CODE_GERMAN;
// ------------------------------------
GetAllUserRatingStabilitiesResult result = miscellaneousApi.getAllUserRatingStabilities(request);
// ------------------------------------
Optional<GetAllUserRatingStabilitiesResult.UserRatingStability> userRatingStabilityOptional = result.userRatingStabilities.stream().filter(urs -> urs.code.equals("mostlystable")).findFirst();
Assertions.assertThat(userRatingStabilityOptional.isPresent()).isTrue();
Assertions.assertThat(userRatingStabilityOptional.get().name).isEqualTo("Ziemlich stabil");
}
Aggregations