@Test public void getOrganizationRequestBody() { final String requestBody = createOrganizationBody(invalidCreateOrganizationInputs, DELIMITER); assertEquals(EXPECTED_ORGANIZATION_REQUEST_BODY, requestBody); }
@NotNull public static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter) { String requestBody = EMPTY; ObjectMapper createOrganizationMapper = new ObjectMapper(); CreateOrganizationRequestBody createBody = new CreateOrganizationRequestBody(); CreateOrganizationRequestBody.CreateOrganizationData createOrganizationData = createBody.new CreateOrganizationData(); CreateOrganizationRequestBody.Attributes attributes = createBody.new Attributes(); attributes.setName(createOrganizationInputs.getCommonInputs().getOrganizationName()); attributes.setDescription(createOrganizationInputs.getOrganizationDescription()); attributes.setEmail(createOrganizationInputs.getEmail()); if (!EMPTY.equals(createOrganizationInputs.getSessionTimeout())) { attributes.setSessionTimeout(createOrganizationInputs.getSessionTimeout()); } else { attributes.setSessionTimeout(SESSION_TIMEOUT); } if (!EMPTY.equals(createOrganizationInputs.getSessionRemember())) { attributes.setSessionRemember(createOrganizationInputs.getSessionRemember()); } else { attributes.setSessionRemember(SESSION_REMEMBER); } if (!EMPTY.equals(createOrganizationInputs.getCollaboratorAuthPolicy())){ attributes.setCollaboratorAuthPolicy(createOrganizationInputs.getCollaboratorAuthPolicy()); } else { attributes.setCollaboratorAuthPolicy(COLLABORATOR_AUTH_POLICY); } attributes.setCostEstimationEnabled(Boolean.parseBoolean(createOrganizationInputs.getCostEstimationEnabled())); attributes.setOwnersTeamSamlRoleId(createOrganizationInputs.getOwnersTeamSamlRoleId()); createOrganizationData.setAttributes(attributes); createOrganizationData.setType(ORGANIZATION_TYPE); createBody.setData(createOrganizationData); try { requestBody = createOrganizationMapper.writeValueAsString(createBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }
OrganizationImpl { @NotNull public static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter) { String requestBody = EMPTY; ObjectMapper createOrganizationMapper = new ObjectMapper(); CreateOrganizationRequestBody createBody = new CreateOrganizationRequestBody(); CreateOrganizationRequestBody.CreateOrganizationData createOrganizationData = createBody.new CreateOrganizationData(); CreateOrganizationRequestBody.Attributes attributes = createBody.new Attributes(); attributes.setName(createOrganizationInputs.getCommonInputs().getOrganizationName()); attributes.setDescription(createOrganizationInputs.getOrganizationDescription()); attributes.setEmail(createOrganizationInputs.getEmail()); if (!EMPTY.equals(createOrganizationInputs.getSessionTimeout())) { attributes.setSessionTimeout(createOrganizationInputs.getSessionTimeout()); } else { attributes.setSessionTimeout(SESSION_TIMEOUT); } if (!EMPTY.equals(createOrganizationInputs.getSessionRemember())) { attributes.setSessionRemember(createOrganizationInputs.getSessionRemember()); } else { attributes.setSessionRemember(SESSION_REMEMBER); } if (!EMPTY.equals(createOrganizationInputs.getCollaboratorAuthPolicy())){ attributes.setCollaboratorAuthPolicy(createOrganizationInputs.getCollaboratorAuthPolicy()); } else { attributes.setCollaboratorAuthPolicy(COLLABORATOR_AUTH_POLICY); } attributes.setCostEstimationEnabled(Boolean.parseBoolean(createOrganizationInputs.getCostEstimationEnabled())); attributes.setOwnersTeamSamlRoleId(createOrganizationInputs.getOwnersTeamSamlRoleId()); createOrganizationData.setAttributes(attributes); createOrganizationData.setType(ORGANIZATION_TYPE); createBody.setData(createOrganizationData); try { requestBody = createOrganizationMapper.writeValueAsString(createBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; } }
OrganizationImpl { @NotNull public static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter) { String requestBody = EMPTY; ObjectMapper createOrganizationMapper = new ObjectMapper(); CreateOrganizationRequestBody createBody = new CreateOrganizationRequestBody(); CreateOrganizationRequestBody.CreateOrganizationData createOrganizationData = createBody.new CreateOrganizationData(); CreateOrganizationRequestBody.Attributes attributes = createBody.new Attributes(); attributes.setName(createOrganizationInputs.getCommonInputs().getOrganizationName()); attributes.setDescription(createOrganizationInputs.getOrganizationDescription()); attributes.setEmail(createOrganizationInputs.getEmail()); if (!EMPTY.equals(createOrganizationInputs.getSessionTimeout())) { attributes.setSessionTimeout(createOrganizationInputs.getSessionTimeout()); } else { attributes.setSessionTimeout(SESSION_TIMEOUT); } if (!EMPTY.equals(createOrganizationInputs.getSessionRemember())) { attributes.setSessionRemember(createOrganizationInputs.getSessionRemember()); } else { attributes.setSessionRemember(SESSION_REMEMBER); } if (!EMPTY.equals(createOrganizationInputs.getCollaboratorAuthPolicy())){ attributes.setCollaboratorAuthPolicy(createOrganizationInputs.getCollaboratorAuthPolicy()); } else { attributes.setCollaboratorAuthPolicy(COLLABORATOR_AUTH_POLICY); } attributes.setCostEstimationEnabled(Boolean.parseBoolean(createOrganizationInputs.getCostEstimationEnabled())); attributes.setOwnersTeamSamlRoleId(createOrganizationInputs.getOwnersTeamSamlRoleId()); createOrganizationData.setAttributes(attributes); createOrganizationData.setType(ORGANIZATION_TYPE); createBody.setData(createOrganizationData); try { requestBody = createOrganizationMapper.writeValueAsString(createBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }  }
OrganizationImpl { @NotNull public static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter) { String requestBody = EMPTY; ObjectMapper createOrganizationMapper = new ObjectMapper(); CreateOrganizationRequestBody createBody = new CreateOrganizationRequestBody(); CreateOrganizationRequestBody.CreateOrganizationData createOrganizationData = createBody.new CreateOrganizationData(); CreateOrganizationRequestBody.Attributes attributes = createBody.new Attributes(); attributes.setName(createOrganizationInputs.getCommonInputs().getOrganizationName()); attributes.setDescription(createOrganizationInputs.getOrganizationDescription()); attributes.setEmail(createOrganizationInputs.getEmail()); if (!EMPTY.equals(createOrganizationInputs.getSessionTimeout())) { attributes.setSessionTimeout(createOrganizationInputs.getSessionTimeout()); } else { attributes.setSessionTimeout(SESSION_TIMEOUT); } if (!EMPTY.equals(createOrganizationInputs.getSessionRemember())) { attributes.setSessionRemember(createOrganizationInputs.getSessionRemember()); } else { attributes.setSessionRemember(SESSION_REMEMBER); } if (!EMPTY.equals(createOrganizationInputs.getCollaboratorAuthPolicy())){ attributes.setCollaboratorAuthPolicy(createOrganizationInputs.getCollaboratorAuthPolicy()); } else { attributes.setCollaboratorAuthPolicy(COLLABORATOR_AUTH_POLICY); } attributes.setCostEstimationEnabled(Boolean.parseBoolean(createOrganizationInputs.getCostEstimationEnabled())); attributes.setOwnersTeamSamlRoleId(createOrganizationInputs.getOwnersTeamSamlRoleId()); createOrganizationData.setAttributes(attributes); createOrganizationData.setType(ORGANIZATION_TYPE); createBody.setData(createOrganizationData); try { requestBody = createOrganizationMapper.writeValueAsString(createBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }  @NotNull static Map<String, String> createOrganization(@NotNull final TerraformOrganizationInputs createOrganizationInputs); @NotNull static Map<String, String> updateOrganization(@NotNull final TerraformOrganizationInputs createOrganizationInputs); @NotNull static Map<String, String> deleteOrganization(@NotNull final TerraformOrganizationInputs deleteOrganizationInputs); @NotNull static Map<String, String> listOrganizations(@NotNull final TerraformCommonInputs listOrganizationsInputs); @NotNull static Map<String, String> getOrganizationDetails(@NotNull final TerraformOrganizationInputs
                                                                     getOrganizationDetailsInputs); @NotNull static String getOrganizationPath(@NotNull final String organizationName); @NotNull static String getOrganizationDetailsPath(@NotNull final String organizationName); @NotNull static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter); }
OrganizationImpl { @NotNull public static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter) { String requestBody = EMPTY; ObjectMapper createOrganizationMapper = new ObjectMapper(); CreateOrganizationRequestBody createBody = new CreateOrganizationRequestBody(); CreateOrganizationRequestBody.CreateOrganizationData createOrganizationData = createBody.new CreateOrganizationData(); CreateOrganizationRequestBody.Attributes attributes = createBody.new Attributes(); attributes.setName(createOrganizationInputs.getCommonInputs().getOrganizationName()); attributes.setDescription(createOrganizationInputs.getOrganizationDescription()); attributes.setEmail(createOrganizationInputs.getEmail()); if (!EMPTY.equals(createOrganizationInputs.getSessionTimeout())) { attributes.setSessionTimeout(createOrganizationInputs.getSessionTimeout()); } else { attributes.setSessionTimeout(SESSION_TIMEOUT); } if (!EMPTY.equals(createOrganizationInputs.getSessionRemember())) { attributes.setSessionRemember(createOrganizationInputs.getSessionRemember()); } else { attributes.setSessionRemember(SESSION_REMEMBER); } if (!EMPTY.equals(createOrganizationInputs.getCollaboratorAuthPolicy())){ attributes.setCollaboratorAuthPolicy(createOrganizationInputs.getCollaboratorAuthPolicy()); } else { attributes.setCollaboratorAuthPolicy(COLLABORATOR_AUTH_POLICY); } attributes.setCostEstimationEnabled(Boolean.parseBoolean(createOrganizationInputs.getCostEstimationEnabled())); attributes.setOwnersTeamSamlRoleId(createOrganizationInputs.getOwnersTeamSamlRoleId()); createOrganizationData.setAttributes(attributes); createOrganizationData.setType(ORGANIZATION_TYPE); createBody.setData(createOrganizationData); try { requestBody = createOrganizationMapper.writeValueAsString(createBody); } catch (JsonProcessingException e) { e.printStackTrace(); } return requestBody; }  @NotNull static Map<String, String> createOrganization(@NotNull final TerraformOrganizationInputs createOrganizationInputs); @NotNull static Map<String, String> updateOrganization(@NotNull final TerraformOrganizationInputs createOrganizationInputs); @NotNull static Map<String, String> deleteOrganization(@NotNull final TerraformOrganizationInputs deleteOrganizationInputs); @NotNull static Map<String, String> listOrganizations(@NotNull final TerraformCommonInputs listOrganizationsInputs); @NotNull static Map<String, String> getOrganizationDetails(@NotNull final TerraformOrganizationInputs
                                                                     getOrganizationDetailsInputs); @NotNull static String getOrganizationPath(@NotNull final String organizationName); @NotNull static String getOrganizationDetailsPath(@NotNull final String organizationName); @NotNull static String createOrganizationBody(TerraformOrganizationInputs createOrganizationInputs, String delimiter);  }