-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($λ): add functionaljava@4.8.1 dependencies and its tests
- Loading branch information
1 parent
0483a46
commit 554406c
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...loud-starter/src/test/java/com/jmsoftware/maf/springcloudstarter/FunctionalJavaTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.jmsoftware.maf.springcloudstarter; | ||
|
||
import cn.hutool.json.JSONUtil; | ||
import lombok.extern.slf4j.Slf4j; | ||
import lombok.val; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static fj.Show.*; | ||
import static fj.data.List.list; | ||
|
||
/** | ||
* <h1>FunctionalJavaTests</h1> | ||
* <p> | ||
* Change description here. | ||
* | ||
* @author Johnny Miller (鍾俊), email: johnnysviva@outlook.com, 9/28/21 11:00 PM | ||
**/ | ||
@Slf4j | ||
class FunctionalJavaTests { | ||
@Test | ||
void testListMap() { | ||
val arraylist = list(1, 2, 3).map(i -> i + 42); | ||
stringShow.println("Show arraylist in for-each loop:"); | ||
for (Integer integer : arraylist) { | ||
intShow.println(integer); | ||
} | ||
stringShow.print("listShow: "); | ||
listShow(intShow).println(arraylist); | ||
log.info("Serialized JSON array of arraylist: {}", JSONUtil.parse(arraylist)); | ||
Assertions.assertEquals(45, arraylist.index(2)); | ||
} | ||
} |