Skip to content

Commit

Permalink
Fix pmd issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NatashaAlker committed Dec 13, 2024
1 parent 8e44293 commit 09319eb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
import uk.gov.hmcts.reform.pip.account.management.utils.FunctionalTestBase;
import uk.gov.hmcts.reform.pip.account.management.utils.OAuthClient;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.UUID;
Expand All @@ -44,15 +45,16 @@ void startUp() throws IOException {
bearer = Map.of(HttpHeaders.AUTHORIZATION, BEARER + accessToken);
issuerId = Map.of(ISSUER_ID, USER_ID);

StringBuilder csvContent = new StringBuilder("email,firstName,surname\n");
StringBuilder csvContent = new StringBuilder(400);
csvContent.append("email,firstName,surname\n");

for (int i = 0; i < 5; i++) {
String email = generateTestEmail();
csvContent.append(email).append(",testBulkFirstName,testBulkSurname\n");
}

var mockFilePath = Files.createTempFile("mock-bulk-upload", ".csv");
try (FileWriter writer = new FileWriter(mockFilePath.toFile())) {
Path mockFilePath = Files.createTempFile("mock-bulk-upload", ".csv");
try (BufferedWriter writer = Files.newBufferedWriter(mockFilePath)) {
writer.write(csvContent.toString());
}

Expand Down Expand Up @@ -81,7 +83,7 @@ public void teardown() throws IOException {
}

@Test
public void createAccountsInBulk() {
void createAccountsInBulk() {
File mockFile = new File(System.getProperty(MOCK_FILE));

Response response = doPostMultipartForBulk(BULK_UPLOAD_URL, bearer, issuerId, mockFile);
Expand All @@ -92,7 +94,7 @@ public void createAccountsInBulk() {
}

@Test
public void shouldReturnOkButNotCreateAccountsForDuplicates() {
void shouldReturnOkButNotCreateAccountsForDuplicates() {
File mockFile = new File(System.getProperty(MOCK_FILE));

Response response = doPostMultipartForBulk(BULK_UPLOAD_URL, bearer, issuerId, mockFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void teardown() {
}

@Test
public void createSystemAdminAccount() {
void createSystemAdminAccount() {
String requestBody = """
{
"email": "%s",
Expand All @@ -62,7 +62,7 @@ public void createSystemAdminAccount() {
}

@Test
public void shouldFailToCreateSystemAdminAccountWithoutEmail() {
void shouldFailToCreateSystemAdminAccountWithoutEmail() {
String requestBody = """
{
"provenanceUserId": "%s"
Expand All @@ -75,7 +75,7 @@ public void shouldFailToCreateSystemAdminAccountWithoutEmail() {
}

@Test
public void shouldFailToCreateSystemAdminAccountWithoutProvenanceUserId() {
void shouldFailToCreateSystemAdminAccountWithoutProvenanceUserId() {
String requestBody = """
{
"email": "%s"
Expand All @@ -87,5 +87,4 @@ public void shouldFailToCreateSystemAdminAccountWithoutProvenanceUserId() {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST.value());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void teardown() {
}

@Test
public void createSystemAdminB2CAccount() {
void createSystemAdminB2CAccount() {
String requestBody = """
{
"email": "%s",
Expand All @@ -70,7 +70,7 @@ public void createSystemAdminB2CAccount() {
}

@Test
public void shouldCreateSystemAdminB2CAccountWithoutProvenanceUserId() {
void shouldCreateSystemAdminB2CAccountWithoutProvenanceUserId() {
String requestBody = """
{
"email": "%s"
Expand All @@ -85,7 +85,7 @@ public void shouldCreateSystemAdminB2CAccountWithoutProvenanceUserId() {
}

@Test
public void shouldFailToCreateSystemAdminB2CAccountWithoutEmail() {
void shouldFailToCreateSystemAdminB2CAccountWithoutEmail() {
String requestBody = """
{
"provenanceUserId": "%s"
Expand All @@ -98,7 +98,7 @@ public void shouldFailToCreateSystemAdminB2CAccountWithoutEmail() {
}

@Test
public void shouldFailToCreateSystemAdminB2CAccountWithoutIssuerId() {
void shouldFailToCreateSystemAdminB2CAccountWithoutIssuerId() {
String requestBody = """
{
"email": "%s",
Expand Down

0 comments on commit 09319eb

Please sign in to comment.