Skip to content

Commit

Permalink
Fix indentation issue in testGeneratedFileNewlines test
Browse files Browse the repository at this point in the history
Co-authored-by: Danesh Kuruppu <[email protected]>
  • Loading branch information
randilt and daneshk authored Jan 8, 2025
1 parent d23f62d commit 5202704
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ public void testImportsWithEnums() {
@Test
public void testGeneratedFileNewlines() {
try {
Files.createDirectories(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_newline_test"));
Files.createDirectories(Paths.get(GENERATED_SOURCES_DIRECTORY, "tool_test_newline_test"));
} catch (IOException e) {
Assert.fail("Could not create target directories", e);
Assert.fail("Could not create target directories", e);
}

Path protoFilePath = Paths.get(RESOURCE_DIRECTORY.toString(), PROTO_FILE_DIRECTORY, "data-types",
Expand All @@ -365,21 +365,21 @@ public void testGeneratedFileNewlines() {
Assert.assertTrue(Files.exists(generatedFile), "Generated file does not exist");

try {
String content = Files.readString(generatedFile);
int newlineCount = 0;
int index = content.length() - 1;
String content = Files.readString(generatedFile);
int newlineCount = 0;
int index = content.length() - 1;

// check for newlines at the end of the file
while (index >= 0 && content.charAt(index) == '\n') {
// check for newlines at the end of the file
while (index >= 0 && content.charAt(index) == '\n') {
newlineCount++;
index--;
}
}

//if the newline count is not 1, fail the test
Assert.assertEquals(newlineCount, 1,
// if the newline count is not 1, fail the test
Assert.assertEquals(newlineCount, 1,
"Generated file should have exactly one newline at the end, found " + newlineCount);
} catch (IOException e) {
Assert.fail("Failed to read generated file", e);
Assert.fail("Failed to read generated file", e);
}
}
}

0 comments on commit 5202704

Please sign in to comment.