Skip to content

Instantly share code, notes, and snippets.

@samshu
samshu / OptionalArrayArgumentMatcher.java
Created May 29, 2017 11:26
A Mockito ArgumentMatcher for java 8 Optional of array objects.
@SuppressWarnings("rawtypes")
public class OptionalArrayArgumentMatcher extends ArgumentMatcher<Optional> {
private final Optional compareWith;
public OptionalArrayArgumentMatcher(Optional optionalArray) {
this.compareWith = optionalArray;
}
@Override
@samshu
samshu / MapBuilder.java
Created May 29, 2017 11:24
A fluent builder for java Maps
import java.util.Map;
/**
* Fluent builder for {@link Map}'s
*
* @param <K> key type
* @param <V> value type
*/
public class MapBuilder<K, V> {