
org.bitbucket.cowwoc.requirements.guava.GuavaVerifier Maven / Gradle / Ivy
/*
* Copyright (c) 2017 Gili Tzabari
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
package org.bitbucket.cowwoc.requirements.guava;
import com.google.common.collect.Multimap;
import org.bitbucket.cowwoc.requirements.java.Configuration;
import java.util.function.Function;
/**
* Verifies the requirements of the Guava library API.
*
* Implementations must be immutable.
*/
public interface GuavaVerifier extends Configuration
{
@Override
GuavaVerifier putContext(String name, Object value);
@Override
GuavaVerifier removeContext(String name);
@Override
GuavaVerifier withDefaultException();
@Override
GuavaVerifier withException(Class extends RuntimeException> exception);
@Override
GuavaVerifier withAssertionsDisabled();
@Override
GuavaVerifier withAssertionsEnabled();
@Override
GuavaVerifier withDiff();
@Override
GuavaVerifier withoutDiff();
@Override
GuavaVerifier withStringConverter(Class type, Function converter);
@Override
GuavaVerifier withoutStringConverter(Class type);
@Override
GuavaVerifier withConfiguration(Configuration configuration);
/**
* Verifies the requirements of a {@code Multimap}.
*
* @param the type of key in the multimap
* @param the type of value in the multimap
* @param actual the actual value
* @param name the name of the value
* @return a verifier for the value
* @throws NullPointerException if {@code name} is null
* @throws IllegalArgumentException if {@code name} is empty
*/
MultimapVerifier requireThat(Multimap actual, String name);
/**
* Same as {@link #requireThat(Multimap, String)} but does nothing if assertions are disabled.
*
* @param the type of key in the multimap
* @param the type of value in the multimap
* @param actual the actual value
* @param name the name of the value
* @return a verifier for the value
* @throws NullPointerException if name is null
* @throws IllegalArgumentException if name is empty
*/
MultimapVerifier assertThat(Multimap actual, String name);
}