Skip to content
Merged
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/
!.idea/
.idea/*
!.idea/google-java-format.xml
!.idea/codeStyles/
.idea/codeStyles/*
!.idea/codeStyles/codeStyleConfig.xml
*.iml
*.ipr
*.iws
Expand Down
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/google-java-format.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dependencies {

testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation("io.github.hakky54:logcaptor:2.12.7")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

Expand Down
2 changes: 2 additions & 0 deletions config/pmd/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<rule ref="category/java/bestpractices.xml">
<!-- slf4j's parameterized logging ({}) makes isDebugEnabled()-style guards unnecessary. -->
<exclude name="GuardLogStatement"/>
<exclude name="UnitTestContainsTooManyAsserts"/>
<exclude name="UnitTestAssertionsShouldIncludeMessage"/>
</rule>
<rule ref="category/java/errorprone.xml"/>
<rule ref="category/java/design.xml">
Expand Down
17 changes: 17 additions & 0 deletions src/int-test/java/com/example/app/AppIntegrationTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
package com.example.app;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import nl.altindag.log.LogCaptor;
import org.junit.jupiter.api.Test;

class AppIntegrationTest {

private final LogCaptor logCaptor = LogCaptor.forClass(App.class);

@Test
void mainRunsWithoutThrowing() {
assertDoesNotThrow(() -> App.main(new String[] {}));
}

@Test
void mainLogsGreeting() {
App.main(new String[] {});
assertEquals("Hello, world!", logCaptor.getInfoLogs().getFirst());
}

@Test
void mainNoErrorMessages() {
App.main(new String[] {});
assertTrue(logCaptor.getErrorLogs().isEmpty());
}
}
Loading