From 2c188b23f80aade6a20ed0c4ce352095a4f386dc Mon Sep 17 00:00:00 2001 From: "milan.horvath" Date: Wed, 3 Apr 2024 08:35:22 +0200 Subject: [PATCH] fix: test coverage --- .../bff/rs/controllers/WorkspaceConfigRestController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/tkit/onecx/shell/bff/rs/controllers/WorkspaceConfigRestController.java b/src/main/java/org/tkit/onecx/shell/bff/rs/controllers/WorkspaceConfigRestController.java index a38630f..b3033c2 100644 --- a/src/main/java/org/tkit/onecx/shell/bff/rs/controllers/WorkspaceConfigRestController.java +++ b/src/main/java/org/tkit/onecx/shell/bff/rs/controllers/WorkspaceConfigRestController.java @@ -61,6 +61,7 @@ public Response getWorkspaceConfig(GetWorkspaceConfigRequestDTO getWorkspaceConf //get base workspace info try (Response response = workspaceClient.searchWorkspaces(mapper.map(getWorkspaceConfigRequestDTO))) { + Response.ResponseBuilder responseBuilder = null; if (!response.readEntity(WorkspacePageResult.class).getStream().isEmpty()) { var workspaceInfo = response.readEntity(WorkspacePageResult.class).getStream().get(0); responseDTO.setWorkspace(mapper.map(workspaceInfo, getWorkspaceConfigRequestDTO)); @@ -90,11 +91,12 @@ public Response getWorkspaceConfig(GetWorkspaceConfigRequestDTO getWorkspaceConf } //call remoteComponent Mocks => should be removed after implementation responseDTO = mockRemoteComponents(responseDTO); - return Response.status(Response.Status.OK).entity(responseDTO).build(); + responseBuilder = Response.status(Response.Status.OK).entity(responseDTO); } else { - return Response.status(Response.Status.NOT_FOUND.getStatusCode(), - "No workspace with matching url found").build(); + responseBuilder = Response.status(Response.Status.NOT_FOUND.getStatusCode(), + "No workspace with matching url found"); } + return responseBuilder.build(); } }