From ec590a2585552db28dcd52b73f18115cab7828c0 Mon Sep 17 00:00:00 2001 From: Cara Fisher Date: Wed, 22 Nov 2023 09:47:20 +0000 Subject: [PATCH] SLVUU: Revert aggressive auto-formatting --- .../integration/LayoutIntegrationTest.java | 319 +++++++++--------- 1 file changed, 155 insertions(+), 164 deletions(-) diff --git a/layout-server/src/test/java/org/finos/vuu/layoutserver/integration/LayoutIntegrationTest.java b/layout-server/src/test/java/org/finos/vuu/layoutserver/integration/LayoutIntegrationTest.java index 65e8459f92..93d4c5c016 100644 --- a/layout-server/src/test/java/org/finos/vuu/layoutserver/integration/LayoutIntegrationTest.java +++ b/layout-server/src/test/java/org/finos/vuu/layoutserver/integration/LayoutIntegrationTest.java @@ -45,8 +45,7 @@ public class LayoutIntegrationTest { private static final String DEFAULT_LAYOUT_GROUP = "Default layout group"; private static final String DEFAULT_LAYOUT_SCREENSHOT = "Default layout screenshot"; private static final String DEFAULT_LAYOUT_USER = "Default layout user"; - private static final UUID DEFAULT_LAYOUT_ID = UUID.fromString( - "00000000-0000-0000-0000-000000000000"); + private static final UUID DEFAULT_LAYOUT_ID = UUID.fromString("00000000-0000-0000-0000-000000000000"); private final ObjectMapper objectMapper = new ObjectMapper(); private static final ObjectNodeConverter objectNodeConverter = new ObjectNodeConverter(); @@ -69,21 +68,20 @@ void getLayout_validIDAndLayoutExists_returns200WithLayout() throws Exception { Layout layout = createDefaultLayoutInDatabase(); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); - Map definition = objectMapper.convertValue(layout.getDefinition(), - Map.class); + Map definition = objectMapper.convertValue(layout.getDefinition(), Map.class); mockMvc.perform(get("/layouts/{id}", layout.getId())) - .andExpect(status().isOk()) - .andExpect(jsonPath("$.definition", - is(definition))) - .andExpect(jsonPath("$.metadata.name", - is(layout.getMetadata().getBaseMetadata().getName()))) - .andExpect(jsonPath("$.metadata.group", - is(layout.getMetadata().getBaseMetadata().getGroup()))) - .andExpect(jsonPath("$.metadata.screenshot", - is(layout.getMetadata().getBaseMetadata().getScreenshot()))) - .andExpect(jsonPath("$.metadata.user", - is(layout.getMetadata().getBaseMetadata().getUser()))); + .andExpect(status().isOk()) + .andExpect(jsonPath("$.definition", + is(definition))) + .andExpect(jsonPath("$.metadata.name", + is(layout.getMetadata().getBaseMetadata().getName()))) + .andExpect(jsonPath("$.metadata.group", + is(layout.getMetadata().getBaseMetadata().getGroup()))) + .andExpect(jsonPath("$.metadata.screenshot", + is(layout.getMetadata().getBaseMetadata().getScreenshot()))) + .andExpect(jsonPath("$.metadata.user", + is(layout.getMetadata().getBaseMetadata().getUser()))); } @Test @@ -98,13 +96,12 @@ void getLayout_invalidId_returns400() throws Exception { String layoutID = "invalidUUID"; mockMvc.perform(get("/layouts/{id}", layoutID)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", - contains( - "Failed to convert value of type 'java.lang.String' to required type 'java.util" - + ".UUID'; nested exception is java.lang.IllegalArgumentException: Invalid " - + "UUID string: invalidUUID"))); + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", + contains("Failed to convert value of type 'java.lang.String' to required type 'java.util" + + ".UUID'; nested exception is java.lang.IllegalArgumentException: Invalid " + + "UUID string: invalidUUID"))); } @Test @@ -113,15 +110,15 @@ void getMetadata_singleMetadataExists_returnsMetadata() throws Exception { assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); mockMvc.perform(get("/layouts/metadata")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$[0].name", - is(layout.getMetadata().getBaseMetadata().getName()))) - .andExpect(jsonPath("$[0].group", - is(layout.getMetadata().getBaseMetadata().getGroup()))) - .andExpect(jsonPath("$[0].screenshot", - is(layout.getMetadata().getBaseMetadata().getScreenshot()))) - .andExpect(jsonPath("$[0].user", - is(layout.getMetadata().getBaseMetadata().getUser()))); + .andExpect(status().isOk()) + .andExpect(jsonPath("$[0].name", + is(layout.getMetadata().getBaseMetadata().getName()))) + .andExpect(jsonPath("$[0].group", + is(layout.getMetadata().getBaseMetadata().getGroup()))) + .andExpect(jsonPath("$[0].screenshot", + is(layout.getMetadata().getBaseMetadata().getScreenshot()))) + .andExpect(jsonPath("$[0].user", + is(layout.getMetadata().getBaseMetadata().getUser()))); } @Test @@ -130,8 +127,7 @@ void getMetadata_multipleMetadataExists_returnsAllMetadata() throws Exception { UUID layout2Id = UUID.randomUUID(); Layout layout1 = createLayoutWithIdInDatabase(layout1Id); Layout layout2 = createLayoutWithIdInDatabase(layout2Id); - layout2.setDefinition( - objectNodeConverter.convertToEntityAttribute(UPDATED_LAYOUT_DEFINITION_STRING)); + layout2.setDefinition(objectNodeConverter.convertToEntityAttribute(UPDATED_LAYOUT_DEFINITION_STRING)); layout2.getMetadata().getBaseMetadata().setName("Different name"); layout2.getMetadata().getBaseMetadata().setGroup("Different group"); layout2.getMetadata().getBaseMetadata().setScreenshot("Different screenshot"); @@ -142,61 +138,60 @@ void getMetadata_multipleMetadataExists_returnsAllMetadata() throws Exception { assertThat(layoutRepository.findById(layout2.getId()).orElseThrow()).isEqualTo(layout2); mockMvc.perform(get("/layouts/metadata")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$[0].name", - is(layout1.getMetadata().getBaseMetadata().getName()))) - .andExpect(jsonPath("$[0].group", - is(layout1.getMetadata().getBaseMetadata().getGroup()))) - .andExpect(jsonPath("$[0].screenshot", - is(layout1.getMetadata().getBaseMetadata().getScreenshot()))) - .andExpect(jsonPath("$[0].user", - is(layout1.getMetadata().getBaseMetadata().getUser()))) - .andExpect(jsonPath("$[1].name", - is(layout2.getMetadata().getBaseMetadata().getName()))) - .andExpect(jsonPath("$[1].group", - is(layout2.getMetadata().getBaseMetadata().getGroup()))) - .andExpect(jsonPath("$[1].screenshot", - is(layout2.getMetadata().getBaseMetadata().getScreenshot()))) - .andExpect(jsonPath("$[1].user", - is(layout2.getMetadata().getBaseMetadata().getUser()))); + .andExpect(status().isOk()) + .andExpect(jsonPath("$[0].name", + is(layout1.getMetadata().getBaseMetadata().getName()))) + .andExpect(jsonPath("$[0].group", + is(layout1.getMetadata().getBaseMetadata().getGroup()))) + .andExpect(jsonPath("$[0].screenshot", + is(layout1.getMetadata().getBaseMetadata().getScreenshot()))) + .andExpect(jsonPath("$[0].user", + is(layout1.getMetadata().getBaseMetadata().getUser()))) + .andExpect(jsonPath("$[1].name", + is(layout2.getMetadata().getBaseMetadata().getName()))) + .andExpect(jsonPath("$[1].group", + is(layout2.getMetadata().getBaseMetadata().getGroup()))) + .andExpect(jsonPath("$[1].screenshot", + is(layout2.getMetadata().getBaseMetadata().getScreenshot()))) + .andExpect(jsonPath("$[1].user", + is(layout2.getMetadata().getBaseMetadata().getUser()))); } @Test void getMetadata_metadataDoesNotExist_returnsEmptyList() throws Exception { mockMvc.perform(get("/layouts/metadata")) - .andExpect(status().isOk()) - .andExpect(jsonPath("$").isEmpty()); + .andExpect(status().isOk()) + .andExpect(jsonPath("$").isEmpty()); } @Test void createLayout_validRequest_returnsCreatedLayoutAndLayoutIsPersisted() - throws Exception { + throws Exception { LayoutRequestDto layoutRequest = createValidLayoutRequest(); - Map definition = objectMapper.convertValue(layoutRequest.getDefinition(), - Map.class); + Map definition = objectMapper.convertValue(layoutRequest.getDefinition(), Map.class); MvcResult result = mockMvc.perform(post("/layouts") - .content(objectMapper.writeValueAsString(layoutRequest)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isCreated()) - .andExpect(jsonPath("$.id").isNotEmpty()) - .andExpect(jsonPath("$.definition", is(definition))) - .andExpect(jsonPath("$.metadata.name", - is(layoutRequest.getMetadata().getBaseMetadata().getName()))) - .andExpect(jsonPath("$.metadata.group", - is(layoutRequest.getMetadata().getBaseMetadata().getGroup()))) - .andExpect(jsonPath("$.metadata.screenshot", - is(layoutRequest.getMetadata().getBaseMetadata().getScreenshot()))) - .andExpect(jsonPath("$.metadata.user", - is(layoutRequest.getMetadata().getBaseMetadata().getUser()))) - .andReturn(); + .content(objectMapper.writeValueAsString(layoutRequest)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()) + .andExpect(jsonPath("$.id").isNotEmpty()) + .andExpect(jsonPath("$.definition", is(definition))) + .andExpect(jsonPath("$.metadata.name", + is(layoutRequest.getMetadata().getBaseMetadata().getName()))) + .andExpect(jsonPath("$.metadata.group", + is(layoutRequest.getMetadata().getBaseMetadata().getGroup()))) + .andExpect(jsonPath("$.metadata.screenshot", + is(layoutRequest.getMetadata().getBaseMetadata().getScreenshot()))) + .andExpect(jsonPath("$.metadata.user", + is(layoutRequest.getMetadata().getBaseMetadata().getUser()))) + .andReturn(); UUID createdLayoutId = UUID.fromString( - JsonPath.read(result.getResponse().getContentAsString(), "$.id")); + JsonPath.read(result.getResponse().getContentAsString(), "$.id")); Layout createdLayout = layoutRepository.findById(createdLayoutId).orElseThrow(); Metadata createdMetadata = metadataRepository.findById(createdLayout.getMetadata().getId()) - .orElseThrow(); + .orElseThrow(); // Check that the one-to-one relationship isn't causing duplicate/unexpected entries in // the DB @@ -204,29 +199,29 @@ void createLayout_validRequest_returnsCreatedLayoutAndLayoutIsPersisted() assertThat(metadataRepository.findAll()).containsExactly(createdMetadata); assertThat(createdLayout.getDefinition()) - .isEqualTo(layoutRequest.getDefinition()); + .isEqualTo(layoutRequest.getDefinition()); assertThat(createdMetadata.getBaseMetadata().getName()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getName()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getName()); assertThat(createdMetadata.getBaseMetadata().getGroup()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getGroup()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getGroup()); assertThat(createdMetadata.getBaseMetadata().getScreenshot()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getScreenshot()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getScreenshot()); assertThat(createdMetadata.getBaseMetadata().getUser()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getUser()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getUser()); } @Test void createLayout_invalidRequestBodyDefinitionsIsNull_returns400AndDoesNotCreateLayout() - throws Exception { + throws Exception { LayoutRequestDto layoutRequest = createValidLayoutRequest(); layoutRequest.setDefinition(null); mockMvc.perform(post("/layouts") - .content(objectMapper.writeValueAsString(layoutRequest)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains("definition: Definition must not be null"))); + .content(objectMapper.writeValueAsString(layoutRequest)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains("definition: Definition must not be null"))); assertThat(layoutRepository.findAll()).isEmpty(); assertThat(metadataRepository.findAll()).isEmpty(); @@ -265,16 +260,16 @@ void createLayout_invalidRequestBodyDefinitionIsNotValidJSON_returns400AndDoesNo @Test void createLayout_invalidRequestBodyMetadataIsNull_returns400AndDoesNotCreateLayout() - throws Exception { + throws Exception { LayoutRequestDto layoutRequest = createValidLayoutRequest(); layoutRequest.setMetadata(null); mockMvc.perform(post("/layouts") - .content(objectMapper.writeValueAsString(layoutRequest)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains("metadata: Metadata must not be null"))); + .content(objectMapper.writeValueAsString(layoutRequest)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains("metadata: Metadata must not be null"))); assertThat(layoutRepository.findAll()).isEmpty(); assertThat(metadataRepository.findAll()).isEmpty(); @@ -286,59 +281,58 @@ void createLayout_invalidRequestBodyUnexpectedFormat_returns400() throws Excepti String invalidLayout = "invalidLayout"; mockMvc.perform(post("/layouts") - .content(invalidLayout) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains( - "JSON parse error: Unrecognized token 'invalidLayout': was expecting (JSON " - + "String, Number, Array, Object or token 'null', 'true' or 'false'); nested " - + "exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized " - + "token 'invalidLayout': was expecting (JSON String, Number, Array, Object " - + "or token 'null', 'true' or 'false')\n" - + " at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream);" - + " line: 1, column: 14]"))); + .content(invalidLayout) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains( + "JSON parse error: Unrecognized token 'invalidLayout': was expecting (JSON " + + "String, Number, Array, Object or token 'null', 'true' or 'false'); nested " + + "exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized " + + "token 'invalidLayout': was expecting (JSON String, Number, Array, Object " + + "or token 'null', 'true' or 'false')\n" + + " at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream);" + + " line: 1, column: 14]"))); } @Test void updateLayout_validIdAndValidRequest_returns204AndLayoutHasChanged() throws Exception { Layout initialLayout = createDefaultLayoutInDatabase(); assertThat(layoutRepository.findById(initialLayout.getId()).orElseThrow()).isEqualTo( - initialLayout); + initialLayout); LayoutRequestDto layoutRequest = createValidLayoutRequest(); - layoutRequest.setDefinition( - objectNodeConverter.convertToEntityAttribute(UPDATED_LAYOUT_DEFINITION_STRING)); + layoutRequest.setDefinition(objectNodeConverter.convertToEntityAttribute(UPDATED_LAYOUT_DEFINITION_STRING)); layoutRequest.getMetadata().getBaseMetadata().setName("Updated name"); layoutRequest.getMetadata().getBaseMetadata().setGroup("Updated group"); layoutRequest.getMetadata().getBaseMetadata().setScreenshot("Updated screenshot"); layoutRequest.getMetadata().getBaseMetadata().setUser("Updated user"); mockMvc.perform(put("/layouts/{id}", initialLayout.getId()) - .content(objectMapper.writeValueAsString(layoutRequest)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isNoContent()) - .andExpect(jsonPath("$").doesNotExist()); + .content(objectMapper.writeValueAsString(layoutRequest)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()) + .andExpect(jsonPath("$").doesNotExist()); Layout updatedLayout = layoutRepository.findById(initialLayout.getId()).orElseThrow(); assertThat(updatedLayout.getDefinition()) - .isEqualTo(layoutRequest.getDefinition()); + .isEqualTo(layoutRequest.getDefinition()); assertThat(updatedLayout.getMetadata().getBaseMetadata().getName()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getName()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getName()); assertThat(updatedLayout.getMetadata().getBaseMetadata().getGroup()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getGroup()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getGroup()); assertThat(updatedLayout.getMetadata().getBaseMetadata().getScreenshot()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getScreenshot()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getScreenshot()); assertThat(updatedLayout.getMetadata().getBaseMetadata().getUser()) - .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getUser()); + .isEqualTo(layoutRequest.getMetadata().getBaseMetadata().getUser()); assertThat(updatedLayout).isNotEqualTo(initialLayout); } @Test void updateLayout_invalidRequestBodyDefinitionIsNull_returns400AndLayoutDoesNotChange() - throws Exception { + throws Exception { Layout layout = createDefaultLayoutInDatabase(); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); @@ -346,11 +340,11 @@ void updateLayout_invalidRequestBodyDefinitionIsNull_returns400AndLayoutDoesNotC request.setDefinition(null); mockMvc.perform(put("/layouts/{id}", layout.getId()) - .content(objectMapper.writeValueAsString(request)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains("definition: Definition must not be null"))); + .content(objectMapper.writeValueAsString(request)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains("definition: Definition must not be null"))); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); } @@ -387,7 +381,7 @@ void updateLayout_invalidRequestBodyDefinitionIsNotValidJSON_returns400AndDoesNo @Test void updateLayout_invalidRequestBodyMetadataIsNull_returns400AndLayoutDoesNotChange() - throws Exception { + throws Exception { Layout layout = createDefaultLayoutInDatabase(); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); @@ -395,42 +389,42 @@ void updateLayout_invalidRequestBodyMetadataIsNull_returns400AndLayoutDoesNotCha request.setMetadata(null); mockMvc.perform(put("/layouts/{id}", layout.getId()) - .content(objectMapper.writeValueAsString(request)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains("metadata: Metadata must not be null"))); + .content(objectMapper.writeValueAsString(request)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains("metadata: Metadata must not be null"))); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); } @Test void updateLayout_invalidRequestBodyUnexpectedFormat_returns400AndLayoutDoesNotChange() - throws Exception { + throws Exception { Layout layout = createDefaultLayoutInDatabase(); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo(layout); String request = "invalidRequest"; mockMvc.perform(put("/layouts/{id}", layout.getId()) - .content(objectMapper.writeValueAsString(request)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains( - "JSON parse error: Cannot construct instance of `org.finos.vuu.layoutserver.dto" - + ".request.LayoutRequestDto` (although at least one Creator exists): no " - + "String-argument constructor/factory method to deserialize from String " - + "value ('invalidRequest'); nested exception is com.fasterxml.jackson" - + ".databind.exc.MismatchedInputException: Cannot construct instance of `org" - + ".finos.vuu.layoutserver.dto.request.LayoutRequestDto` (although at least " - + "one Creator exists): no String-argument constructor/factory method to " - + "deserialize from String value ('invalidRequest')\n" - + " at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream);" - + " line: 1, column: 1]"))); + .content(objectMapper.writeValueAsString(request)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains( + "JSON parse error: Cannot construct instance of `org.finos.vuu.layoutserver.dto" + + ".request.LayoutRequestDto` (although at least one Creator exists): no " + + "String-argument constructor/factory method to deserialize from String " + + "value ('invalidRequest'); nested exception is com.fasterxml.jackson" + + ".databind.exc.MismatchedInputException: Cannot construct instance of `org" + + ".finos.vuu.layoutserver.dto.request.LayoutRequestDto` (although at least " + + "one Creator exists): no String-argument constructor/factory method to " + + "deserialize from String value ('invalidRequest')\n" + + " at [Source: (org.springframework.util.StreamUtils$NonClosingInputStream);" + + " line: 1, column: 1]"))); assertThat(layoutRepository.findById(layout.getId()).orElseThrow()).isEqualTo( - layout); + layout); } @Test @@ -439,9 +433,9 @@ void updateLayout_validIdButLayoutDoesNotExist_returnsNotFound() throws Exceptio LayoutRequestDto layoutRequest = createValidLayoutRequest(); mockMvc.perform(put("/layouts/{id}", layoutID) - .content(objectMapper.writeValueAsString(layoutRequest)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isNotFound()); + .content(objectMapper.writeValueAsString(layoutRequest)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNotFound()); } @Test @@ -450,14 +444,14 @@ void updateLayout_invalidId_returns400() throws Exception { LayoutRequestDto layoutRequest = createValidLayoutRequest(); mockMvc.perform(put("/layouts/{id}", layoutID) - .content(objectMapper.writeValueAsString(layoutRequest)) - .contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains( - "Failed to convert value of type 'java.lang.String' to required type 'java.util" - + ".UUID'; nested exception is java.lang.IllegalArgumentException: Invalid " - + "UUID string: invalidUUID"))); + .content(objectMapper.writeValueAsString(layoutRequest)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains( + "Failed to convert value of type 'java.lang.String' to required type 'java.util" + + ".UUID'; nested exception is java.lang.IllegalArgumentException: Invalid " + + "UUID string: invalidUUID"))); } @Test @@ -482,12 +476,12 @@ void deleteLayout_invalidId_returns400() throws Exception { String layoutID = "invalidUUID"; mockMvc.perform(delete("/layouts/{id}", layoutID)) - .andExpect(status().isBadRequest()) - .andExpect(jsonPath("$.messages", iterableWithSize(1))) - .andExpect(jsonPath("$.messages", contains( - "Failed to convert value of type 'java.lang.String' to required type 'java.util" - + ".UUID'; nested exception is java.lang.IllegalArgumentException: Invalid " - + "UUID string: invalidUUID"))); + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.messages", iterableWithSize(1))) + .andExpect(jsonPath("$.messages", contains( + "Failed to convert value of type 'java.lang.String' to required type 'java.util" + + ".UUID'; nested exception is java.lang.IllegalArgumentException: Invalid " + + "UUID string: invalidUUID"))); } private Layout createDefaultLayoutInDatabase() { @@ -502,8 +496,7 @@ private Layout createDefaultLayoutInDatabase() { metadata.setBaseMetadata(baseMetadata); - layout.setDefinition( - objectNodeConverter.convertToEntityAttribute(DEFAULT_LAYOUT_DEFINITION_STRING)); + layout.setDefinition(objectNodeConverter.convertToEntityAttribute(DEFAULT_LAYOUT_DEFINITION_STRING)); layout.setMetadata(metadata); layout.setId(DEFAULT_LAYOUT_ID); @@ -522,8 +515,7 @@ private Layout createLayoutWithIdInDatabase(UUID id) { metadata.setBaseMetadata(baseMetadata); - layout.setDefinition( - objectNodeConverter.convertToEntityAttribute(DEFAULT_LAYOUT_DEFINITION_STRING)); + layout.setDefinition(objectNodeConverter.convertToEntityAttribute(DEFAULT_LAYOUT_DEFINITION_STRING)); layout.setMetadata(metadata); layout.setId(id); @@ -541,8 +533,7 @@ private LayoutRequestDto createValidLayoutRequest() { metadataRequest.setBaseMetadata(baseMetadata); LayoutRequestDto layoutRequest = new LayoutRequestDto(); - layoutRequest.setDefinition( - objectNodeConverter.convertToEntityAttribute(DEFAULT_LAYOUT_DEFINITION_STRING)); + layoutRequest.setDefinition(objectNodeConverter.convertToEntityAttribute(DEFAULT_LAYOUT_DEFINITION_STRING)); layoutRequest.setMetadata(metadataRequest); return layoutRequest;