Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<pluginManagement>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/mycompany/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public App() {}

public static void main(String[] args) {
System.out.println(new App().getMessage());
for (int i = 1; i <= 10; i++) {
System.out.println(i);
}
}

private final String getMessage() {
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/com/mycompany/app/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ public void testAppMain()
{
App.main(null);
try {
assertEquals("Hello World!" + System.getProperty("line.separator"), outContent.toString());
String expectedOutput = "Hello World!" + System.getProperty("line.separator");
for (int i = 1; i <= 10; i++) {
expectedOutput += i + System.getProperty("line.separator");
}
assertEquals(expectedOutput, outContent.toString());
} catch (AssertionError e) {
fail("\"message\" is not \"Hello World!\"");
fail("Output does not match expected format with loop from 1 to 10");
}
}

Expand Down