File tree Expand file tree Collapse file tree 6 files changed +118
-0
lines changed
main/java/com/pivovarit/jpms
test/java/com/pivovarit/jpms Expand file tree Collapse file tree 6 files changed +118
-0
lines changed Original file line number Diff line number Diff line change 1+ .claude
12.idea /
23target /
34
45* .iml
56.DS_Store
7+
Original file line number Diff line number Diff line change 1+ https://4comprehension.com/jdk8-on-spin-wait/
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
3+ <modelVersion >4.0.0</modelVersion >
4+
5+ <parent >
6+ <groupId >com.pivovarit</groupId >
7+ <artifactId >articles</artifactId >
8+ <version >1.0-SNAPSHOT</version >
9+ <relativePath >../pom.xml</relativePath >
10+ </parent >
11+ <artifactId >java-jpms-jdk8</artifactId >
12+
13+ <name >java-jpms-jdk8</name >
14+
15+ <build >
16+ <plugins >
17+ <plugin >
18+ <groupId >org.apache.maven.plugins</groupId >
19+ <artifactId >maven-compiler-plugin</artifactId >
20+ <configuration >
21+ <source >8</source >
22+ <target >8</target >
23+ </configuration >
24+ </plugin >
25+ <plugin >
26+ <groupId >org.moditect</groupId >
27+ <artifactId >moditect-maven-plugin</artifactId >
28+ <version >1.2.2.Final</version >
29+ <executions >
30+ <execution >
31+ <id >add-module-infos</id >
32+ <phase >package</phase >
33+ <goals >
34+ <goal >add-module-info</goal >
35+ </goals >
36+ <configuration >
37+ <jvmVersion >9</jvmVersion >
38+ <module >
39+ <moduleInfoSource >
40+ module com.pivovarit.jpms {
41+ exports com.pivovarit.jpms;
42+ }
43+ </moduleInfoSource >
44+ </module >
45+ </configuration >
46+ </execution >
47+ </executions >
48+ </plugin >
49+ <plugin >
50+ <artifactId >maven-surefire-plugin</artifactId >
51+ </plugin >
52+ </plugins >
53+ </build >
54+
55+ <dependencies >
56+ <dependency >
57+ <groupId >org.junit.jupiter</groupId >
58+ <artifactId >junit-jupiter-engine</artifactId >
59+ <scope >test</scope >
60+ </dependency >
61+ <dependency >
62+ <groupId >org.assertj</groupId >
63+ <artifactId >assertj-core</artifactId >
64+ <scope >test</scope >
65+ </dependency >
66+ </dependencies >
67+ </project >
Original file line number Diff line number Diff line change 1+ package com .pivovarit .jpms ;
2+
3+ public final class StringUtils {
4+
5+ private StringUtils () {
6+ }
7+
8+ public static String reverse (String input ) {
9+ return input == null ? null : new StringBuilder (input ).reverse ().toString ();
10+ }
11+
12+ public static boolean isPalindrome (String input ) {
13+ if (input == null ) {
14+ return false ;
15+ }
16+ String reversed = reverse (input );
17+ return input .equalsIgnoreCase (reversed );
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ package com .pivovarit .jpms ;
2+
3+ import org .junit .jupiter .api .Test ;
4+
5+ import static org .assertj .core .api .Assertions .assertThat ;
6+
7+ class StringUtilsTest {
8+
9+ @ Test
10+ void shouldReverseString () {
11+ assertThat (StringUtils .reverse ("hello" )).isEqualTo ("olleh" );
12+ }
13+
14+ @ Test
15+ void shouldReturnNullForNullReverse () {
16+ assertThat (StringUtils .reverse (null )).isNull ();
17+ }
18+
19+ @ Test
20+ void shouldDetectPalindrome () {
21+ assertThat (StringUtils .isPalindrome ("racecar" )).isTrue ();
22+ }
23+
24+ @ Test
25+ void shouldDetectNonPalindrome () {
26+ assertThat (StringUtils .isPalindrome ("hello" )).isFalse ();
27+ }
28+ }
Original file line number Diff line number Diff line change 3434 <module >java-immutable-collectors</module >
3535 <module >java-11-string-api-updates</module >
3636 <module >java-jdk8-on-spin-wait</module >
37+ <module >java-jpms-jdk8</module >
3738 <module >java-design-patterns</module >
3839 <module >java-random-stream</module >
3940 <module >java-last-gatherer</module >
You can’t perform that action at this time.
0 commit comments