@@ -133,6 +133,44 @@ void testDuplicateParams() throws Exception {
133
133
assertThat (networkVisualizationParamRepository .existsById (duplicatedParams .id ())).isTrue ();
134
134
}
135
135
136
+ @ Test
137
+ void testUpdatePositionsConfigUuidParameter () throws Exception {
138
+ NetworkVisualizationParamInfos paramsToUpdate = createDto ();
139
+ UUID paramsUuid = saveAndReturnId (paramsToUpdate );
140
+ UUID updatedPositionsConfigUuid = UUID .randomUUID ();
141
+ mockMvc .perform (put (URI_NETWORK_VISUALIZATION_PARAM_BASE + "/" + paramsUuid + "/positions-config-uuid" )
142
+ .content ("\" " + updatedPositionsConfigUuid + "\" " )
143
+ .contentType (MediaType .APPLICATION_JSON ))
144
+ .andExpect (status ().isNoContent ());
145
+
146
+ NetworkVisualizationParamInfos retrievedParams = getParams (paramsUuid );
147
+ assertThat (retrievedParams .networkAreaDiagramParameters ().positionsConfigUuid ())
148
+ .isEqualTo (updatedPositionsConfigUuid );
149
+ }
150
+
151
+ @ Test
152
+ void testUpdateWithInvalidPositionsConfigUuidParameter () throws Exception {
153
+ NetworkVisualizationParamInfos paramsToUpdate = createDto ();
154
+ UUID paramsUuid = saveAndReturnId (paramsToUpdate );
155
+ String invalidUuid = "\" not-a-valid-uuid\" " ;
156
+ mockMvc .perform (put (URI_NETWORK_VISUALIZATION_PARAM_BASE + "/" + paramsUuid + "/positions-config-uuid" )
157
+ .content (invalidUuid )
158
+ .contentType (MediaType .APPLICATION_JSON ))
159
+ .andExpect (status ().isBadRequest ());
160
+ }
161
+
162
+ @ Test
163
+ void testUpdateNotFoundPositionsConfigUuidParameter () throws Exception {
164
+ NetworkVisualizationParamInfos paramsToUpdate = createDto ();
165
+ saveAndReturnId (paramsToUpdate );
166
+ UUID nonExistentId = UUID .randomUUID ();
167
+ UUID updatedPositionsConfigUuid = UUID .randomUUID ();
168
+ mockMvc .perform (put (URI_NETWORK_VISUALIZATION_PARAM_BASE + "/" + nonExistentId + "/positions-config-uuid" )
169
+ .content ("\" " + updatedPositionsConfigUuid + "\" " )
170
+ .contentType (MediaType .APPLICATION_JSON ))
171
+ .andExpect (status ().isNotFound ());
172
+ }
173
+
136
174
private NetworkVisualizationParamInfos getParams (UUID paramsUuid ) throws Exception {
137
175
MvcResult mvcGetResult = mockMvc .perform (get (URI_NETWORK_VISUALIZATION_PARAM_BASE + "/" + paramsUuid ))
138
176
.andExpect (status ().isOk ())
0 commit comments