Future in Vavr - Initial Commit
This commit is contained in:
parent
992c661e56
commit
5f0eed9502
22
vavr/src/main/java/com/baeldung/vavr/future/Tester.java
Normal file
22
vavr/src/main/java/com/baeldung/vavr/future/Tester.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package com.baeldung.vavr.future;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import io.vavr.concurrent.Future;
|
||||||
|
|
||||||
|
public class Tester {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void start() {
|
||||||
|
Future<Integer> resultFuture = Future.of(() -> addOne(4));
|
||||||
|
Integer result = resultFuture.get();
|
||||||
|
|
||||||
|
assertEquals(5, (int) result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer addOne(Integer num) {
|
||||||
|
return num + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user