use of org.hisp.dhis.webapi.json.domain.JsonTranslation in project dhis2-core by dhis2.
the class AbstractCrudControllerTest method replaceTranslationsOk.
@Test
public void replaceTranslationsOk() {
String id = assertStatus(HttpStatus.CREATED, POST("/dataSets/", "{'name':'My data set', 'periodType':'Monthly'}"));
JsonArray translations = GET("/dataSets/{id}/translations", id).content().getArray("translations");
assertTrue(translations.isEmpty());
PUT("/dataSets/" + id + "/translations", "{'translations': [{'locale':'sv', 'property':'name', 'value':'name sv'}]}").content(HttpStatus.NO_CONTENT);
JsonResponse content = GET("/dataSets/{id}", id).content();
translations = GET("/dataSets/{id}/translations", id).content().getArray("translations");
assertEquals(1, translations.size());
JsonTranslation translation = translations.get(0, JsonTranslation.class);
assertEquals("sv", translation.getLocale());
assertEquals("name", translation.getProperty());
assertEquals("name sv", translation.getValue());
}
Aggregations