Skip to content

Commit f330852

Browse files
Add a simple example right at the start of README.
1 parent 7c3d6ff commit f330852

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.markdown

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22

33
[![Build Status](https://travis-ci.com/sageserpent-open/americium.svg?branch=master)](https://travis-ci.com/sageserpent-open/americium)
44
[![Maven Central](https://index.scala-lang.org/sageserpent-open/americium/americium/latest-by-scala-version.svg?color=2465cd&style=flat)](https://index.scala-lang.org/sageserpent-open/americium/americium)
5+
```java
6+
// JShell...
7+
8+
import com.sageserpent.americium.java.Trials;
9+
import com.sageserpent.americium.java.TrialsApi;
10+
import com.sageserpent.americium.java.TrialsFactoring;
11+
12+
import java.util.Collection;
13+
14+
final TrialsApi api = Trials.api();
15+
16+
class SystemUnderTest {
17+
public static void printSum(Collection<Integer> input) {
18+
final int sum = input.stream().reduce((lhs, rhs) -> lhs + rhs).get();
19+
20+
System.out.println(sum);
21+
}
22+
}
23+
24+
try {
25+
api.integers().immutableLists().withLimit(100).supplyTo(SystemUnderTest::printSum);
26+
} catch (TrialsFactoring.TrialException exception){
27+
System.out.println(exception.getCause());
28+
System.out.println(exception.provokingCase());
29+
System.out.println(exception.recipe());
30+
}
31+
```
532

633
## What? Why? ##
734

0 commit comments

Comments
 (0)