diff --git a/pom.xml b/pom.xml index dace0197..66ae3d68 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,7 @@ 3.14.0 2.1.1 2020.0.4 + 4.8.1 1.0.0.M5 2.5.1 2.5.1 @@ -291,5 +292,26 @@ hutool-all ${hutool-all.version} + + + org.functionaljava + functionaljava + ${functionaljava.version} + + + org.functionaljava + functionaljava-java8 + ${functionaljava.version} + + + org.functionaljava + functionaljava-quickcheck + ${functionaljava.version} + + + org.functionaljava + functionaljava-java-core + ${functionaljava.version} + diff --git a/spring-cloud-starter/src/test/java/com/jmsoftware/maf/springcloudstarter/FunctionalJavaTests.java b/spring-cloud-starter/src/test/java/com/jmsoftware/maf/springcloudstarter/FunctionalJavaTests.java new file mode 100644 index 00000000..fb2649e5 --- /dev/null +++ b/spring-cloud-starter/src/test/java/com/jmsoftware/maf/springcloudstarter/FunctionalJavaTests.java @@ -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; + +/** + *

FunctionalJavaTests

+ *

+ * 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)); + } +}