Skip to content

Commit 1944c2e

Browse files
committed
Setup module info
1 parent 0df648e commit 1944c2e

16 files changed

+68
-23
lines changed

pom.xml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<name>LeetCode Tester</name>
@@ -57,6 +58,13 @@
5758
<source>${java.version}</source>
5859
<target>${java.version}</target>
5960
<compilerArgument>-Xlint</compilerArgument>
61+
<annotationProcessorPaths>
62+
<path>
63+
<groupId>org.projectlombok</groupId>
64+
<artifactId>lombok</artifactId>
65+
<version>${lombok.version}</version>
66+
</path>
67+
</annotationProcessorPaths>
6068
</configuration>
6169
</plugin>
6270

@@ -71,6 +79,15 @@
7179
<groupId>org.apache.maven.plugins</groupId>
7280
<artifactId>maven-surefire-plugin</artifactId>
7381
<version>${plugin.surefire.version}</version>
82+
<configuration>
83+
<!-- Surefire JUnite Hack for Test execution in Java Modules environment -->
84+
<!-- https://github.com/junit-team/junit5/issues/2147 -->
85+
<argLine>
86+
--add-exports org.codi.LeetCodeTester/org.codi.lct.example=org.junit.platform.commons
87+
--add-exports org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED
88+
--add-exports org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED
89+
</argLine>
90+
</configuration>
7491
</plugin>
7592

7693
<!-- Tools / dependency version management -->
@@ -174,6 +191,7 @@
174191
<configuration>
175192
<show>protected</show>
176193
<nohelp>true</nohelp>
194+
<quiet>true</quiet>
177195
<doclint>-missing</doclint>
178196
</configuration>
179197
</plugin>
@@ -252,12 +270,6 @@
252270
</dependency>
253271

254272
<!-- Testing -->
255-
<dependency>
256-
<groupId>org.junit.jupiter</groupId>
257-
<artifactId>junit-jupiter-engine</artifactId>
258-
<version>${junit.version}</version>
259-
</dependency>
260-
261273
<dependency>
262274
<groupId>org.junit.jupiter</groupId>
263275
<artifactId>junit-jupiter-api</artifactId>
@@ -266,7 +278,7 @@
266278

267279
<dependency>
268280
<groupId>org.junit.jupiter</groupId>
269-
<artifactId>junit-jupiter-params</artifactId>
281+
<artifactId>junit-jupiter-engine</artifactId>
270282
<version>${junit.version}</version>
271283
</dependency>
272284
</dependencies>

src/main/java/module-info.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module org.codi.LeetCodeTester {
2+
/* Exported from module for usage */
3+
// Annotations
4+
exports org.codi.lct.annotation;
5+
exports org.codi.lct.annotation.settings;
6+
// Core Testing
7+
exports org.codi.lct.core;
8+
exports org.codi.lct.core.tester;
9+
// Utilities
10+
exports org.codi.lct.ds;
11+
exports org.codi.lct.ds.extra;
12+
13+
/* Module Dependencies */
14+
// Lombok (Compile Only)
15+
requires static lombok;
16+
// Jackson
17+
requires com.fasterxml.jackson.core;
18+
requires transitive com.fasterxml.jackson.annotation;
19+
requires transitive com.fasterxml.jackson.databind;
20+
// JUnit
21+
requires transitive org.junit.jupiter.api;
22+
// Apache Commons
23+
requires org.apache.commons.lang3;
24+
// Logging
25+
requires org.slf4j;
26+
// Javadoc
27+
requires static org.apiguardian.api;
28+
29+
/* Expose for reflection & access */
30+
exports org.codi.lct.impl.adapter.eq to org.apache.commons.lang3;
31+
exports org.codi.lct.impl.testcase to org.junit.platform.commons;
32+
opens org.codi.lct.core.tester to org.junit.platform.commons;
33+
opens org.codi.lct.impl.adapter.ser to com.fasterxml.jackson.databind;
34+
opens org.codi.lct.impl.adapter.deser to com.fasterxml.jackson.databind;
35+
}

src/main/java/org/codi/lct/core/tester/LCTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.codi.lct.impl.helper.JacksonHelper;
1010

1111
/**
12-
* Defines a test case based on expected output & provided inputs.
12+
* Defines a test case based on expected output and provided inputs.
1313
* Inputs can be in any format, and the executor will attempt to convert it to the right format prior to execution.
1414
*/
1515
@Value

src/main/java/org/codi/lct/ds/extra/Pair.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package org.codi.lct.ds.extra;
22

33
import lombok.AllArgsConstructor;
4-
import lombok.EqualsAndHashCode;
5-
import lombok.NoArgsConstructor;
4+
import lombok.Data;
65

7-
@NoArgsConstructor
6+
@Data
87
@AllArgsConstructor
9-
@EqualsAndHashCode
108
@SuppressWarnings("checkstyle:MemberName")
119
public class Pair<L, R> {
1210

src/main/java/org/codi/lct/impl/helper/ConfigHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ConfigHelper {
2727

2828
static {
2929
// Load default properties
30-
Properties props = FileHelper.loadProperties(null, "lc-tester.properties");
30+
Properties props = FileHelper.loadProperties(null, "lct/lc-tester.properties");
3131
BASE_CONFIG = LCConfig.builder()
3232
.trackExecutionTime(getBooleanProperty(props, LCConfig.Fields.trackExecutionTime, false))
3333
.allowMissingExpectedValues(getBooleanProperty(props, LCConfig.Fields.allowMissingExpectedValues, false))

src/main/java/org/codi/lct/impl/helper/JacksonHelper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ public List<Object> readAllValues(MappingIterator<Object> iterator) {
5959
iterator.forEachRemaining(values::add);
6060
return values;
6161
} catch (Exception e) {
62-
throw new LCException(
63-
"Error reading values from input content: " + iterator.getCurrentLocation().getSourceRef(), e);
62+
throw new LCException("Error reading values from input content: " + iterator.getCurrentLocation()
63+
.contentReference()
64+
.getRawContent(), e);
6465
}
6566
}
6667

src/test/java/org/codi/lct/example/Example01ASimpleFirstExample.java renamed to src/test/java/org/codi/lct/example/Example01_ASimpleFirstExample_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Test cases are loaded automatically from the TestCase data file at {@code
1111
* resources/lct/org/codi/lct/example/Example01ASimpleFirstExample}
1212
*/
13-
public class Example01ASimpleFirstExample extends LCTester {
13+
public class Example01_ASimpleFirstExample_Test extends LCTester {
1414

1515
@LCSolution
1616
public int sum(int[] nums) {

src/test/java/org/codi/lct/example/Example02CustomTestCase.java renamed to src/test/java/org/codi/lct/example/Example02_CustomTestCase_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* Note: each test case is run on a separate test instance
1414
*/
15-
public class Example02CustomTestCase extends LCTester {
15+
public class Example02_CustomTestCase_Test extends LCTester {
1616

1717
/**
1818
* {@link LCTestCaseGenerator} annotation is not required since the signature matches {@code public static

src/test/java/org/codi/lct/example/Example03ManualTestCase.java renamed to src/test/java/org/codi/lct/example/Example03_ManualTestCase_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* To avoid sharing the test instance, create multiple @Test methods instead
2222
*/
2323
@ExtendWith(LCExtension.class)
24-
public class Example03ManualTestCase {
24+
public class Example03_ManualTestCase_Test {
2525

2626
@Test
2727
@DisplayName("My manual test runner")

src/test/java/org/codi/lct/example/Example04ComplexDataStructures.java renamed to src/test/java/org/codi/lct/example/Example04_ComplexDataStructures_Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Checkout {@link org.codi.lct.ds} for supported data structures
99
*/
10-
public class Example04ComplexDataStructures extends LCTester {
10+
public class Example04_ComplexDataStructures_Test extends LCTester {
1111

1212
public ListNode inorder(TreeNode root) {
1313
ListNode preStart = new ListNode(0, null);

0 commit comments

Comments
 (0)