Skip to content

Commit

Permalink
Add unit test suite and update Java test configuration (#7075)
Browse files Browse the repository at this point in the history
* feat(tests): add unit test suite for CIA application utilities

* chore: update Java test configuration and dependencies in POM files
  • Loading branch information
pethers authored Jan 22, 2025
1 parent 049b789 commit 1e5f871
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 30 deletions.
53 changes: 40 additions & 13 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic",
"java.dependency.packagePresentation": "hierarchical",
"maven.workspace.autoReload": true,
"maven.workspace.resolveFolders": true,
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 --add-modules=ALL-SYSTEM --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED",
"java.test.config": {
"vmargs": [
"--add-modules=ALL-SYSTEM",
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
"-Xmx2048M",
"--add-modules",
"ALL-SYSTEM",
"--add-modules",
"java.xml.bind",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED"
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-exports=java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED",
"--add-exports=java.xml.bind/javax.xml.bind=ALL-UNNAMED"
],
"name": "CIA Tests",
"showTestResults": true,
"excludes": [
"**/module-info.java"
]
},
"java.test.defaultConfig": "default",
"java.test.defaultConfig": "CIA Tests",
"java.project.sourcePaths": [
"src/main/java"
],
"java.project.testSourcePaths": [
"src/test/java"
],
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "automatic",
"java.dependency.packagePresentation": "hierarchical",
"maven.workspace.autoReload": true,
"maven.workspace.resolveFolders": true,
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 --add-modules=ALL-SYSTEM --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED",
"maven.terminal.customEnv": [
{
"environmentVariable": "MAVEN_OPTS",
"value": "-Xmx8192m -Xms2048m -XX:+UseG1GC"
"value": "-Xmx8192m -Xms2048m -XX:+UseG1GC --add-modules=ALL-MODULE-PATH"
}
],
"coverage-gutters.showGutterCoverage": true,
Expand All @@ -30,5 +47,15 @@
"sonarlint.connectedMode.project": {
"connectionId": "hack23",
"projectKey": "Hack23_cia"
}
},
"java.debug.settings.onBuildFailureProceed": true,
"java.test.editor.enableShortcuts": true,
"java.test.message.showFullStackTrace": true,
"java.test.message.displayNameFormat": "${className} - ${methodName}",
"maven.dependency.enableConflictDiagnostics": true,
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**"
],
"maven.pomfile.autoUpdateEffectivePOM": true
}
2 changes: 1 addition & 1 deletion citizen-intelligence-agency/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@
requires transitive com.hack23.cia.model.external.val.landstingvalkrets.impl;
requires transitive com.hack23.cia.model.external.riksdagen.votering.impl;
requires transitive com.hack23.cia.model.external.worldbank.countries.impl;
requires org.apache.commons.beanutils;
requires commons.beanutils;
requires static org.eclipse.jetty.jmx;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.hack23.cia.systemintegrationtest.suites;

import org.junit.jupiter.api.DisplayName;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import com.hack23.cia.web.impl.ui.application.util.UserContextUtilTest;
import com.hack23.cia.web.impl.ui.application.util.WebBrowserUtilTest;

/**
* The Class IntegrationTestSuite.
*/
@RunWith(Suite.class)
@DisplayName("CIA Unit Tests")
@Suite.SuiteClasses({
UserContextUtilTest.class,
WebBrowserUtilTest.class
})
public class UnitTestSuite {

}
8 changes: 5 additions & 3 deletions parent-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@
<jdk.target.version>21</jdk.target.version>
<javadoc.src.version>21</javadoc.src.version>
<javadoc.target.version>21</javadoc.target.version>
<testAdditionalRuntimeArgLine>-XX:+EnableDynamicAgentLoading --add-exports java.base/sun.nio.ch=ALL-UNNAMED
<testAdditionalRuntimeArgLine>-XX:+EnableDynamicAgentLoading --add-exports
java.base/sun.nio.ch=ALL-UNNAMED
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens
java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED</testAdditionalRuntimeArgLine>
Expand Down Expand Up @@ -336,7 +337,7 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.10.0</version>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
Expand Down Expand Up @@ -1439,7 +1440,8 @@
<jdk>21</jdk>
</activation>
<properties>
<testAdditionalRuntimeArgLine>-XX:+EnableDynamicAgentLoading --add-exports java.base/sun.nio.ch=ALL-UNNAMED
<testAdditionalRuntimeArgLine>-XX:+EnableDynamicAgentLoading --add-exports
java.base/sun.nio.ch=ALL-UNNAMED
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens
java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED</testAdditionalRuntimeArgLine>
Expand Down
25 changes: 12 additions & 13 deletions service.data.impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
<properties>
<liquibase.changeLogDirectory>${project.basedir}/target/classes/</liquibase.changeLogDirectory>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>${cia.project.versions.aws}</version>
<!-- Align to latest stable version -->
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.activation</groupId>
Expand Down Expand Up @@ -61,10 +73,6 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</exclusion>
<exclusion>
<groupId>software.amazon.ion</groupId>
<artifactId>ion-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -92,17 +100,8 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-cbor</artifactId>
</exclusion>
<exclusion>
<groupId>software.amazon.ion</groupId>
<artifactId>ion-java</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.amazon.ion</groupId>
<artifactId>ion-java</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down

0 comments on commit 1e5f871

Please sign in to comment.