use of com.faforever.client.api.dto.ModVersionReview in project downlords-faf-client by FAForever.
the class FafApiAccessorImplTest method testCreateModVersionReview.
@Test
public void testCreateModVersionReview() {
ModVersionReview modVersionReview = new ModVersionReview();
when(restOperations.postForEntity(eq("/data/modVersion/5/reviews"), eq(modVersionReview), eq(ModVersionReview.class))).thenReturn(new ResponseEntity<>(HttpStatus.OK));
instance.createModVersionReview(modVersionReview.setModVersion(new com.faforever.client.api.dto.ModVersion().setId("5")));
ArgumentCaptor<ModVersionReview> captor = ArgumentCaptor.forClass(ModVersionReview.class);
verify(restOperations).postForEntity(eq("/data/modVersion/5/reviews"), captor.capture(), eq(ModVersionReview.class));
ModVersionReview review = captor.getValue();
assertThat(review, is(modVersionReview));
}
use of com.faforever.client.api.dto.ModVersionReview in project downlords-faf-client by FAForever.
the class FafServiceImpl method saveModVersionReview.
@Override
@Async
public CompletableFuture<Void> saveModVersionReview(Review review, String modVersionId) {
ModVersionReview modVersionReview = (ModVersionReview) new ModVersionReview().setScore(review.getScore().byteValue()).setText(review.getText());
if (review.getId() == null) {
Assert.notNull(review.getPlayer(), "Player ID must be set");
ModVersionReview updatedReview = fafApiAccessor.createModVersionReview((ModVersionReview) modVersionReview.setModVersion(new com.faforever.client.api.dto.ModVersion().setId(String.valueOf(modVersionId))).setId(String.valueOf(review.getId())).setPlayer(new com.faforever.client.api.dto.Player().setId(String.valueOf(review.getPlayer().getId()))));
review.setId(updatedReview.getId());
} else {
fafApiAccessor.updateModVersionReview((ModVersionReview) modVersionReview.setId(String.valueOf(review.getId())));
}
return CompletableFuture.completedFuture(null);
}
use of com.faforever.client.api.dto.ModVersionReview in project downlords-faf-client by FAForever.
the class FafServiceImplTest method createModVersion.
@Test
public void createModVersion() throws Exception {
Review review = createReview(null, "something", 3, 42);
when(fafApiAccessor.createModVersionReview(any())).thenReturn((ModVersionReview) new ModVersionReview().setPlayer(player()).setId("1").setScore((byte) 1));
instance.saveModVersionReview(review, "5");
verify(fafApiAccessor).createModVersionReview(any());
}
Aggregations