All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bitbucket.cowwoc.requirements.guava.MultimapVerifier Maven / Gradle / Ivy

There is a newer version: 4.0.4-RC
Show newest version
/*
 * Copyright 2014 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 java.util.Collection;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Consumer;
import org.bitbucket.cowwoc.requirements.core.CollectionVerifier;
import org.bitbucket.cowwoc.requirements.core.PrimitiveNumberVerifier;
import org.bitbucket.cowwoc.requirements.core.capabilities.ObjectCapabilities;

/**
 * Verifies a {@link Multimap}.
 *
 * @param  the type of key in the multimap
 * @param  the type of value in the multimap
 * @author Gili Tzabari
 */
public interface MultimapVerifier
	extends ObjectCapabilities, Multimap>
{
	/**
	 * @return a verifier over {@link Multimap#keySet()}
	 */
	CollectionVerifier, K> keySet();

	/**
	 * @param consumer verifies the {@link Multimap#keySet()}
	 * @return this
	 */
	MultimapVerifier keySet(Consumer, K>> consumer);

	/**
	 * @return verifier over {@link Multimap#values()}
	 */
	CollectionVerifier, V> values();

	/**
	 * @param consumer verifies the {@link Multimap#values()}
	 * @return this
	 */
	MultimapVerifier values(Consumer, V>> consumer);

	/**
	 * @return verifier over {@link Multimap#entries()}
	 */
	CollectionVerifier>, Entry> entries();

	/**
	 * @param consumer verifies the {@link Multimap#entries()}
	 * @return this
	 */
	MultimapVerifier entries(
		Consumer>, Entry>> consumer);

	/**
	 * Ensures that the actual value is empty.
	 *
	 * @return this
	 * @throws IllegalArgumentException if actual value is not empty
	 */
	MultimapVerifier isEmpty();

	/**
	 * Ensures that the actual value is not empty.
	 *
	 * @return this
	 * @throws IllegalArgumentException if actual value is empty
	 */
	MultimapVerifier isNotEmpty();

	/**
	 * @return verifier over {@link Multimap#size()}
	 */
	PrimitiveNumberVerifier size();

	/**
	 * @param consumer verifies the multimap's size
	 * @return this
	 */
	MultimapVerifier size(Consumer> consumer);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy