parent
6a9e13cc03
commit
891b4eb248
|
@ -1,3 +0,0 @@
|
||||||
### Relevant articles
|
|
||||||
|
|
||||||
- [Introduction to jOOL](http://www.baeldung.com/jool)
|
|
25
jooq/pom.xml
25
jooq/pom.xml
|
@ -1,25 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<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">
|
|
||||||
<parent>
|
|
||||||
<artifactId>parent-modules</artifactId>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>jooq</artifactId>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jooq</groupId>
|
|
||||||
<artifactId>jool</artifactId>
|
|
||||||
<version>${jool.version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<jool.version>0.9.12</jool.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung;
|
package com.baeldung.jool;
|
||||||
|
|
||||||
import org.jooq.lambda.Seq;
|
import org.jooq.lambda.Seq;
|
||||||
import org.jooq.lambda.Unchecked;
|
import org.jooq.lambda.Unchecked;
|
||||||
|
@ -13,6 +13,7 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ import static junit.framework.Assert.assertTrue;
|
||||||
import static junit.framework.TestCase.assertEquals;
|
import static junit.framework.TestCase.assertEquals;
|
||||||
import static org.jooq.lambda.tuple.Tuple.tuple;
|
import static org.jooq.lambda.tuple.Tuple.tuple;
|
||||||
|
|
||||||
public class JOOLUnitTest {
|
public class JOOLTest {
|
||||||
@Test
|
@Test
|
||||||
public void givenSeq_whenCheckContains_shouldReturnTrue() {
|
public void givenSeq_whenCheckContains_shouldReturnTrue() {
|
||||||
List<Integer> concat = Seq.of(1, 2, 3).concat(Seq.of(4, 5, 6)).toList();
|
List<Integer> concat = Seq.of(1, 2, 3).concat(Seq.of(4, 5, 6)).toList();
|
||||||
|
@ -54,18 +55,18 @@ public class JOOLUnitTest {
|
||||||
@Test
|
@Test
|
||||||
public void givenSeq_whenJoin_shouldHaveElementsFromBothSeq() {
|
public void givenSeq_whenJoin_shouldHaveElementsFromBothSeq() {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
Seq.of(1, 2, 4).innerJoin(Seq.of(1, 2, 3), (a, b) -> a == b).toList(),
|
Seq.of(1, 2, 4).innerJoin(Seq.of(1, 2, 3), Objects::equals).toList(),
|
||||||
Arrays.asList(tuple(1, 1), tuple(2, 2))
|
Arrays.asList(tuple(1, 1), tuple(2, 2))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
Seq.of(1, 2, 4).leftOuterJoin(Seq.of(1, 2, 3), (a, b) -> a == b).toList(),
|
Seq.of(1, 2, 4).leftOuterJoin(Seq.of(1, 2, 3), Objects::equals).toList(),
|
||||||
Arrays.asList(tuple(1, 1), tuple(2, 2), tuple(4, null))
|
Arrays.asList(tuple(1, 1), tuple(2, 2), tuple(4, null))
|
||||||
);
|
);
|
||||||
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
Seq.of(1, 2, 4).rightOuterJoin(Seq.of(1, 2, 3), (a, b) -> a == b).toList(),
|
Seq.of(1, 2, 4).rightOuterJoin(Seq.of(1, 2, 3), Objects::equals).toList(),
|
||||||
Arrays.asList(tuple(1, 1), tuple(2, 2), tuple(null, 3))
|
Arrays.asList(tuple(1, 1), tuple(2, 2), tuple(null, 3))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -197,7 +198,7 @@ public class JOOLUnitTest {
|
||||||
public void givenOperationThatThrowsCheckedException_whenExecuteUsingUncheckedFuction_shouldPass() {
|
public void givenOperationThatThrowsCheckedException_whenExecuteUsingUncheckedFuction_shouldPass() {
|
||||||
//when
|
//when
|
||||||
List<Integer> collect = Stream.of("a", "b", "c")
|
List<Integer> collect = Stream.of("a", "b", "c")
|
||||||
.map(Unchecked.function(elem -> methodThatThrowsChecked(elem)))
|
.map(Unchecked.function(this::methodThatThrowsChecked))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
//then
|
//then
|
||||||
|
@ -236,5 +237,4 @@ public class JOOLUnitTest {
|
||||||
Arrays.asList(tuple("michael", "similar", "winter", "summer"), tuple("jodie", "variable", "winter", "summer"))
|
Arrays.asList(tuple("michael", "similar", "winter", "summer"), tuple("jodie", "variable", "winter", "summer"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
1
pom.xml
1
pom.xml
|
@ -83,7 +83,6 @@
|
||||||
<!--<module>jee7</module>-->
|
<!--<module>jee7</module>-->
|
||||||
<!-- <module>jhipster/jhipster-monolithic</module> -->
|
<!-- <module>jhipster/jhipster-monolithic</module> -->
|
||||||
<module>jjwt</module>
|
<module>jjwt</module>
|
||||||
<module>jooq</module>
|
|
||||||
<module>jpa-storedprocedure</module>
|
<module>jpa-storedprocedure</module>
|
||||||
<module>jsf</module>
|
<module>jsf</module>
|
||||||
<module>json-path</module>
|
<module>json-path</module>
|
||||||
|
|
Loading…
Reference in New Issue