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

com.roscopeco.moxy.matchers.Matchers Maven / Gradle / Ivy

There is a newer version: 0.94.0
Show newest version
/*
 * Moxy - Lean-and-mean mocking framework for Java with a fluent API.
 *
 * Copyright 2018 Ross Bamford
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 *   The above copyright notice and this permission notice shall be included
 *   in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.roscopeco.moxy.matchers;

import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

import com.roscopeco.moxy.Moxy;
import com.roscopeco.moxy.api.MoxyEngine;

/**
 * 

Provides static access to the standard Moxy argument matchers.

* *

This class, along with the {@link com.roscopeco.moxy.Moxy} class, are the main top-level * classes most users will need to interact with when using Moxy. They are * designed so you can simply import static and start mocking.

* *

The methods in this class should only be called in the * context of a Moxy when(...) or assertMock(...) call. * Calling them out of context will result in {@link InconsistentMatchersException} * or {@link PossibleMatcherUsageError} exceptions when interacting with the framework.

* *

For a mini example, see {@link com.roscopeco.moxy.Moxy}. For full details, * see README.md.

* *

Note: Many of the standard matchers provided with this class * come in both primitive and reference versions. It is important that you use the * appropriate primitive type if the method matchers are applied to expects * primitive arguments. See README for more details.

* * @author Ross Bamford <roscopeco AT gmail DOT com> * @since 1.0 * @see com.roscopeco.moxy.Moxy * */ public class Matchers { /** * Create a matcher that will match any primitive byte * in the current default Moxy engine. * * @return zero (ignored). * @see #anyByte(MoxyEngine) * @since 1.0 */ public static byte anyByte() { return anyByte(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive byte in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (ignored). * @since 1.0 */ public static byte anyByte(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive char * in the current default Moxy engine. * * @return zero (NUL) (ignored). * @see #anyChar(MoxyEngine) * @since 1.0 */ public static char anyChar() { return anyChar(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive char * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (NUL) (ignored). * @since 1.0 */ public static char anyChar(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive short * in the current default Moxy engine. * * @return zero (ignored). * @see #anyShort(MoxyEngine) * @since 1.0 */ public static short anyShort() { return anyShort(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive short * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (ignored). * @since 1.0 */ public static short anyShort(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive int * in the current default Moxy engine. * * @return zero (ignored). * @see #anyInt(MoxyEngine) * @since 1.0 */ public static int anyInt() { return anyInt(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive int * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (ignored). * @since 1.0 */ public static int anyInt(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive long * in the current default Moxy engine. * * @return zero (ignored). * @see #anyLong(MoxyEngine) * @since 1.0 */ public static long anyLong() { return anyLong(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive long * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (ignored). * @since 1.0 */ public static long anyLong(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive float * in the current default Moxy engine. * * @return zero (ignored). * @see #anyFloat(MoxyEngine) * @since 1.0 */ public static float anyFloat() { return anyFloat(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive float * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (ignored). * @since 1.0 */ public static float anyFloat(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive double * in the current default Moxy engine. * * @return zero (ignored). * @see #anyDouble(MoxyEngine) * @since 1.0 */ public static double anyDouble() { return anyDouble(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive double * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return zero (ignored). * @since 1.0 */ public static double anyDouble(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return 0; } /** * Create a matcher that will match any primitive boolean * in the current default Moxy engine. * * @return false (ignored). * @see #anyBool(MoxyEngine) * @since 1.0 */ public static boolean anyBool() { return anyBool(Moxy.getMoxyEngine()); } /** * Create a matcher that will match any primitive boolean * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return false (ignored). * @since 1.0 */ public static boolean anyBool(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return false; } /** *

Create a matcher that will match any Object * in the current default Moxy engine.

* * For notes, see {@link #any(MoxyEngine)}. * * @return null (ignored). * @see #any(MoxyEngine) * @since 1.0 * * @param The type this matcher will operate on. */ public static T any() { return any(Moxy.getMoxyEngine()); } /** *

Create a matcher that will match any Object * in the specified {@link MoxyEngine}.

* *

Note that, outside the static type guarantees provided by * compile-time generics, this matcher performs no type checks. * It really will match any Object * at runtime.

* *

While this is unlikely to cause problems, it is worth noting.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on. */ public static T any(final MoxyEngine engine) { engine.registerMatcher(new AnyMatcher()); return null; } /* ************ EQUALS ************** */ /** * Create a matcher that will match the given primitive byte * in the current default Moxy engine. * * @param value The value to match. * * @return zero (ignored). * @see #eqByte(MoxyEngine, byte) * @since 1.0 */ public static byte eqByte(final byte value) { return eqByte(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive byte * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (ignored). * @since 1.0 */ public static byte eqByte(final MoxyEngine engine, final byte value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive char * in the current default Moxy engine. * * @param value The value to match. * * @return zero (NUL) (ignored). * @see #eqChar(MoxyEngine, char) * @since 1.0 */ public static char eqChar(final char value) { return eqChar(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive char * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (NUL) (ignored). * @since 1.0 */ public static char eqChar(final MoxyEngine engine, final char value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive short * in the current default Moxy engine. * * @param value The value to match. * * @return zero (ignored). * @see #eqShort(MoxyEngine, short) * @since 1.0 */ public static short eqShort(final short value) { return eqShort(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive short * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (ignored). * @since 1.0 */ public static short eqShort(final MoxyEngine engine, final short value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive int * in the current default Moxy engine. * * @param value The value to match. * * @return zero (ignored). * @see #eqInt(MoxyEngine, int) * @since 1.0 */ public static int eqInt(final int value) { return eqInt(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive int * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (ignored). * @since 1.0 */ public static int eqInt(final MoxyEngine engine, final int value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive long * in the current default Moxy engine. * * @param value The value to match. * * @return zero (ignored). * @see #eqLong(MoxyEngine, long) * @since 1.0 */ public static long eqLong(final long value) { return eqLong(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive long * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (ignored). * @since 1.0 */ public static long eqLong(final MoxyEngine engine, final long value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive float * in the current default Moxy engine. * * @param value The value to match. * * @return zero (ignored). * @see #eqFloat(MoxyEngine, float) * @since 1.0 */ public static float eqFloat(final float value) { return eqFloat(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive float * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (ignored). * @since 1.0 */ public static float eqFloat(final MoxyEngine engine, final float value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive double * in the current default Moxy engine. * * @param value The value to match. * * @return zero (ignored). * @see #eqDouble(MoxyEngine, double) * @since 1.0 */ public static double eqDouble(final double value) { return eqDouble(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive double * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return zero (ignored). * @since 1.0 */ public static double eqDouble(final MoxyEngine engine, final double value) { engine.registerMatcher(new EqualsMatcher(value)); return 0; } /** * Create a matcher that will match the given primitive boolean * in the current default Moxy engine. * * @param value The value to match. * * @return false (ignored). * @see #eqBool(MoxyEngine, boolean) * @since 1.0 */ public static boolean eqBool(final boolean value) { return eqBool(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match the given primitive boolean * in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return false (ignored). * @since 1.0 */ public static boolean eqBool(final MoxyEngine engine, final boolean value) { engine.registerMatcher(new EqualsMatcher(value)); return false; } /** *

Create a matcher that will match the given T * in the current default Moxy engine.

* *

For notes, see {@link #eqShort(MoxyEngine, short)}.

* * @param value The value to match. * * @return null (ignored). * @see #eq(MoxyEngine, Object) * @since 1.0 * * @param The type this matcher will operate on. */ public static T eq(final T value) { return eq(Moxy.getMoxyEngine(), value); } /** *

Create a matcher that will match the given T * in the specified {@link MoxyEngine}.

* *

The general matching rules used by this matcher are:

* *
    *
  • match: null == null
  • *
  • match: value.equals(actualArgument)
  • *
* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T eq(final MoxyEngine engine, final T value) { engine.registerMatcher(new EqualsMatcher(value)); return null; } /* ************ NOTEQUALS ************** */ /** * Create a matcher that will match any primitive byte except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqByte(MoxyEngine, byte) * @since 1.0 */ public static byte neqByte(final byte value) { return neqByte(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive byte except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static byte neqByte(final MoxyEngine engine, final byte value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive char except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqChar(MoxyEngine, char) * @since 1.0 */ public static char neqChar(final char value) { return neqChar(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive char except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static char neqChar(final MoxyEngine engine, final char value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive short except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqShort(MoxyEngine, short) * @since 1.0 */ public static short neqShort(final short value) { return neqShort(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive short except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static short neqShort(final MoxyEngine engine, final short value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive int except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqInt(MoxyEngine, int) * @since 1.0 */ public static int neqInt(final int value) { return neqInt(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive int except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static int neqInt(final MoxyEngine engine, final int value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive long except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqLong(MoxyEngine, long) * @since 1.0 */ public static long neqLong(final long value) { return neqLong(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive long except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static long neqLong(final MoxyEngine engine, final long value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive float except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqFloat(MoxyEngine, float) * @since 1.0 */ public static float neqFloat(final float value) { return neqFloat(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive float except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static float neqFloat(final MoxyEngine engine, final float value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive double except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return zero (ignored). * @see #neqDouble(MoxyEngine, double) * @since 1.0 */ public static double neqDouble(final double value) { return neqDouble(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive double except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return zero (ignored). * @since 1.0 */ public static double neqDouble(final MoxyEngine engine, final double value) { engine.registerMatcher(new NotEqualsMatcher(value)); return 0; } /** * Create a matcher that will match any primitive boolean except * the given value in the current default Moxy engine. * * @param value The value to exclude from matching. * * @return false (ignored). * @see #neqBool(MoxyEngine, boolean) * @since 1.0 */ public static boolean neqBool(final boolean value) { return neqBool(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive boolean except * the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to exclude from matching. * * @return false (ignored). * @since 1.0 */ public static boolean neqBool(final MoxyEngine engine, final boolean value) { engine.registerMatcher(new NotEqualsMatcher(value)); return false; } /** *

Create a matcher that will match any T except * the given value in the current default Moxy engine.

* *

For notes, see {@link #neq(MoxyEngine, Object)}.

* * @param value The Object to exclude from matching. * * @return null (ignored). * @see #neq(MoxyEngine, Object) * @since 1.0 * * @param The type this matcher will operate on. */ public static T neq(final T value) { return neq(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any T except * the given value in the specified {@link MoxyEngine}. * *

The general matching rules used by this matcher are:

* *
    *
  • match: ! (null == null)
  • *
  • match: ! (value.equals(actualArgument))
  • *
* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to match. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T neq(final MoxyEngine engine, final T value) { engine.registerMatcher(new NotEqualsMatcher(value)); return null; } /* ************ LESSTHAN ************** */ /** * Create a matcher that will match any primitive byte that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltByte(MoxyEngine, byte) * @since 1.0 */ public static byte ltByte(final byte value) { return ltByte(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive byte that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static byte ltByte(final MoxyEngine engine, final byte value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive char that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltChar(MoxyEngine, char) * @since 1.0 */ public static char ltChar(final char value) { return ltChar(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive char that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static char ltChar(final MoxyEngine engine, final char value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive char that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltChar(MoxyEngine, char) * @since 1.0 */ public static short ltShort(final short value) { return ltShort(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive short that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static short ltShort(final MoxyEngine engine, final short value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive int that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltInt(MoxyEngine, int) * @since 1.0 */ public static int ltInt(final int value) { return ltInt(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive int that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static int ltInt(final MoxyEngine engine, final int value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive long that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltLong(MoxyEngine, long) * @since 1.0 */ public static long ltLong(final long value) { return ltLong(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive long that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static long ltLong(final MoxyEngine engine, final long value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive float that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltFloat(MoxyEngine, float) * @since 1.0 */ public static float ltFloat(final float value) { return ltFloat(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive float that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static float ltFloat(final MoxyEngine engine, final float value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive double that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #ltDouble(MoxyEngine, double) * @since 1.0 */ public static double ltDouble(final double value) { return ltDouble(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive double that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static double ltDouble(final MoxyEngine engine, final double value) { engine.registerMatcher(new LessThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive boolean that * is strictly less-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return false (ignored). * @see #ltBool(MoxyEngine, boolean) * @since 1.0 */ public static boolean ltBool(final boolean value) { return ltBool(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive boolean that * is strictly less-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return false (ignored). * @since 1.0 */ public static boolean ltBool(final MoxyEngine engine, final boolean value) { engine.registerMatcher(new LessThanMatcher(value)); return false; } /** *

Create a matcher that will match any Comparable T that * is strictly less-than the given value in the specified {@link MoxyEngine}.

* *

For notes, see {@link #lt(Comparable)}.

* * @param value The value to compare to. * * @return null (ignored). * @see #lt(MoxyEngine, Comparable) * @since 1.0 * * @param The type this matcher will operate on */ public static > T lt(final T value) { return lt(Moxy.getMoxyEngine(), value); } /** *

Create a matcher that will match any Comparable T that * is strictly less-than the given value in the specified {@link MoxyEngine}.

* *

This matcher requires that objects implement java.lang.Comparable * and it follows the standard comparison rules for that class.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static > T lt(final MoxyEngine engine, final T value) { engine.registerMatcher(new LessThanMatcher(value)); return null; } /* ************ GREATERTHAN ************** */ /** * Create a matcher that will match any primitive byte that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtByte(MoxyEngine, byte) * @since 1.0 */ public static byte gtByte(final byte value) { return gtByte(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive byte that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static byte gtByte(final MoxyEngine engine, final byte value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive char that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtChar(MoxyEngine, char) * @since 1.0 */ public static char gtChar(final char value) { return gtChar(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive char that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static char gtChar(final MoxyEngine engine, final char value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive short that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtShort(MoxyEngine, short) * @since 1.0 */ public static short gtShort(final short value) { return gtShort(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive short that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static short gtShort(final MoxyEngine engine, final short value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive int that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtInt(MoxyEngine, int) * @since 1.0 */ public static int gtInt(final int value) { return gtInt(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive int that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static int gtInt(final MoxyEngine engine, final int value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive long that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtLong(MoxyEngine, long) * @since 1.0 */ public static long gtLong(final long value) { return gtLong(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive long that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static long gtLong(final MoxyEngine engine, final long value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive float that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtFloat(MoxyEngine, float) * @since 1.0 */ public static float gtFloat(final float value) { return gtFloat(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive float that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static float gtFloat(final MoxyEngine engine, final float value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive double that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return zero (ignored). * @see #gtDouble(MoxyEngine, double) * @since 1.0 */ public static double gtDouble(final double value) { return gtDouble(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive double that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return zero (ignored). * @since 1.0 */ public static double gtDouble(final MoxyEngine engine, final double value) { engine.registerMatcher(new GreaterThanMatcher(value)); return 0; } /** * Create a matcher that will match any primitive boolean that * is strictly greater-than the given value in the current default Moxy engine. * * @param value The value to compare to. * * @return false (ignored). * @see #gtBool(MoxyEngine, boolean) * @since 1.0 */ public static boolean gtBool(final boolean value) { return gtBool(Moxy.getMoxyEngine(), value); } /** * Create a matcher that will match any primitive boolean that * is strictly greater-than the given value in the specified {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return false (ignored). * @since 1.0 */ public static boolean gtBool(final MoxyEngine engine, final boolean value) { engine.registerMatcher(new GreaterThanMatcher(value)); return false; } /** *

Create a matcher that will match any Comparable T that * is strictly greater-than the given value in the current default Moxy engine.

* *

For notes, see {@link #gt(Comparable)}.

* * @param value The value to compare to. * * @return null (ignored). * @see #gt(MoxyEngine, Comparable) * @since 1.0 * * @param The type this matcher will operate on */ public static > T gt(final T value) { return gt(Moxy.getMoxyEngine(), value); } /** *

Create a matcher that will match any Comparable T that * is strictly greater-than the given value in the specified {@link MoxyEngine}.

* *

This matcher requires that objects implement java.lang.Comparable * and it follows the standard comparison rules for that class.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param value The value to compare to. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static > T gt(final MoxyEngine engine, final T value) { engine.registerMatcher(new GreaterThanMatcher(value)); return null; } /* ************ ANYOF ************** */ /** * Create a matcher that will match any primitive byte that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfByte(MoxyEngine, List) * @since 1.0 */ public static byte anyOfByte(final Byte... possibilities) { return anyOfByte(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive byte that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfByte(MoxyEngine, List) * @since 1.0 */ public static byte anyOfByte(final List possibilities) { return anyOfByte(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive byte that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static byte anyOfByte(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0; } /** * Create a matcher that will match any primitive char that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfChar(MoxyEngine, List) * @since 1.0 */ public static char anyOfChar(final Character... possibilities) { return anyOfChar(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive char that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfChar(MoxyEngine, List) * @since 1.0 */ public static char anyOfChar(final List possibilities) { return anyOfChar(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive char that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static char anyOfChar(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0; } /** * Create a matcher that will match any primitive short that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfShort(MoxyEngine, List) * @since 1.0 */ public static short anyOfShort(final Short... possibilities) { return anyOfShort(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive short that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfShort(MoxyEngine, List) * @since 1.0 */ public static short anyOfShort(final List possibilities) { return anyOfShort(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive short that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static short anyOfShort(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0; } /** * Create a matcher that will match any primitive int that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfInt(MoxyEngine, List) * @since 1.0 */ public static int anyOfInt(final Integer... possibilities) { return anyOfInt(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive int that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfInt(MoxyEngine, List) * @since 1.0 */ public static int anyOfInt(final List possibilities) { return anyOfInt(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive int that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static int anyOfInt(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0; } /** * Create a matcher that will match any primitive long that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfLong(MoxyEngine, List) * @since 1.0 */ public static long anyOfLong(final Long... possibilities) { return anyOfLong(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive long that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfLong(MoxyEngine, List) * @since 1.0 */ public static long anyOfLong(final List possibilities) { return anyOfLong(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive long that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static long anyOfLong(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0l; } /** * Create a matcher that will match any primitive float that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfFloat(MoxyEngine, List) * @since 1.0 */ public static float anyOfFloat(final Float... possibilities) { return anyOfFloat(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive float that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfFloat(MoxyEngine, List) * @since 1.0 */ public static float anyOfFloat(final List possibilities) { return anyOfFloat(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive float that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static float anyOfFloat(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0.0f; } /** * Create a matcher that will match any primitive double that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfDouble(MoxyEngine, List) * @since 1.0 */ public static double anyOfDouble(final Double... possibilities) { return anyOfDouble(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive double that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return zero (ignored). * @see #anyOfDouble(MoxyEngine, List) * @since 1.0 */ public static double anyOfDouble(final List possibilities) { return anyOfDouble(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive double that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return zero (ignored). * @since 1.0 */ public static double anyOfDouble(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return 0.0d; } /** * Create a matcher that will match any primitive boolean that * appears in the supplied arguments. The matcher is created in the default * Moxy engine. * * @param possibilities The potential values to match. * * @return false (ignored). * @see #anyOfBool(MoxyEngine, List) * @since 1.0 */ public static boolean anyOfBool(final Boolean... possibilities) { return anyOfBool(Arrays.asList(possibilities)); } /** * Create a matcher that will match any primitive boolean that * appears in the supplied List. The matcher is created in the * default Moxy engine. * * @param possibilities The potential values to match. * * @return false (ignored). * @see #anyOfBool(MoxyEngine, List) * @since 1.0 */ public static boolean anyOfBool(final List possibilities) { return anyOfBool(Moxy.getMoxyEngine(), possibilities); } /** * Create a matcher that will match any primitive boolean that * appears in the supplied list. The matcher is created in the specified * {@link MoxyEngine}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return false (ignored). * @since 1.0 */ public static boolean anyOfBool(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return false; } /** *

Create a matcher that will match any T that appears in * the supplied arguments. The matcher is created in the default * Moxy engine.

* *

For notes, see {@link #anyOf(MoxyEngine, List)}.

* * @param possibilities The potential values to match. * * @return null (ignored). * @see #anyOf(MoxyEngine, List) * @since 1.0 * * @param The type this matcher will operate on */ @SafeVarargs public static T anyOf(final T... possibilities) { return anyOf(Arrays.asList(possibilities)); } /** *

Create a matcher that will match any T that appears in * the supplied List. The matcher is created in the default * Moxy engine.

* *

For notes, see {@link #anyOf(MoxyEngine, List)}.

* * @param possibilities The potential values to match. * * @return null (ignored). * @see #anyOf(MoxyEngine, List) * @since 1.0 * * @param The type this matcher will operate on */ public static T anyOf(final List possibilities) { return anyOf(Moxy.getMoxyEngine(), possibilities); } /** *

Create a matcher that will match any T that appears in * the supplied List. The matcher is created in the default * Moxy engine.

* *

Matching is performed using {@link java.util.List#contains} on the * supplied List.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param possibilities The potential values to match. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T anyOf(final MoxyEngine engine, final List possibilities) { engine.registerMatcher(new AnyOfMatcher(possibilities)); return null; } /* ************ AND ************** */ /** *

Create a matcher that will match any primitive byte for which * the supplied matchers also match that byte. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andByte(gtByte(1), ltByte(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andByte(MoxyEngine, Byte...) * @since 1.0 */ public static byte andByte(final Byte... fromMatchers) { return andByte(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive byte for which * the supplied matchers also match that byte. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andByte(engine, gtByte(engine, 1), ltByte(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static byte andByte(final MoxyEngine engine, final Byte... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive char for which * the supplied matchers also match that char. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andChar(gtChar(1), ltChar(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andChar(Character...) * @since 1.0 */ public static char andChar(final Character... fromMatchers) { return andChar(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive char for which * the supplied matchers also match that char. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andChar(engine, gtChar(engine, 1), ltChar(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static char andChar(final MoxyEngine engine, final Character... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive short for which * the supplied matchers also match that short. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andShort(gtShort(1), ltShort(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andShort(MoxyEngine, Short...) * @since 1.0 */ public static short andShort(final Short... fromMatchers) { return andShort(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive short for which * the supplied matchers also match that short. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andShort(engine, gtShort(engine, 1), ltShort(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static short andShort(final MoxyEngine engine, final Short... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive int for which * the supplied matchers also match that int. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andInt(engine, gtInt(engine, 1), ltInt(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andInt(MoxyEngine, Integer...) * @since 1.0 */ public static int andInt(final Integer... fromMatchers) { return andInt(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive int for which * the supplied matchers also match that int. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andInt(engine, gtInt(engine, 1), ltInt(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static int andInt(final MoxyEngine engine, final Integer... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive long for which * the supplied matchers also match that long. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andLong(gtLong(1), ltLong(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andLong(MoxyEngine, Long...) * @since 1.0 */ public static long andLong(final Long... fromMatchers) { return andLong(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive long for which * the supplied matchers also match that long. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andLong(engine, gtLong(engine, 1), ltLong(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static long andLong(final MoxyEngine engine, final Long... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive float for which * the supplied matchers also match that float. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andFloat(gtFloat(1), ltFloat(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andFloat(MoxyEngine, Float...) * @since 1.0 */ public static float andFloat(final Float... fromMatchers) { return andFloat(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive float for which * the supplied matchers also match that float. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andFloat(engine, gtFloat(engine, 1), ltFloat(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static float andFloat(final MoxyEngine engine, final Float... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive double for which * the supplied matchers also match that double. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andDouble(gtDouble(1), ltDouble(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #andDouble(MoxyEngine, Double...) * @since 1.0 */ public static double andDouble(final Double... fromMatchers) { return andDouble(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive double for which * the supplied matchers also match that double. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andDouble(engine, gtDouble(engine, 1), ltDouble(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static double andDouble(final MoxyEngine engine, final Double... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive boolean for which * the supplied matchers also match that boolean. The matcher is created * in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andBool(gtBool(1), ltBool(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return false (ignored). * @see #andBool(MoxyEngine, Boolean...) * @since 1.0 */ public static boolean andBool(final Boolean... fromMatchers) { return andBool(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive boolean for which * the supplied matchers also match that boolean. The matcher is created * in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(andBool(engine, gtBool(engine, 1), ltBool(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static boolean andBool(final MoxyEngine engine, final Boolean... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return false; } /** *

Create a matcher that will match any T for which the supplied * matchers also match that byte. The matcher is created in the * default Moxy engine.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return null (ignored). * @see #and(MoxyEngine, Object...) * @since 1.0 * * @param The type this matcher will operate on */ @SafeVarargs public static T and(final T... fromMatchers) { return and(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any T for which the supplied * matchers also match that byte. The matcher is created in the * specified {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ @SafeVarargs public static T and(final MoxyEngine engine, final T... fromMatchers) { engine.registerMatcher(new AndMatcher(fromMatchers)); return null; } /* ************ OR ************** */ /** *

Create a matcher that will match any primitive byte for which * any of the supplied matchers also match that byte. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orByte(eqByte(1), eqByte(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orByte(MoxyEngine, Byte...) * @since 1.0 */ public static byte orByte(final Byte... fromMatchers) { return orByte(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive byte for which * any of the supplied matchers also match that byte. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orByte(engine, eqByte(engine, 1), eqByte(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static byte orByte(final MoxyEngine engine, final Byte... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive char for which * any of the supplied matchers also match that char. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orChar(eqChar(1), eqChar(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orChar(MoxyEngine, Character...) * @since 1.0 */ public static char orChar(final Character... fromMatchers) { return orChar(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive char for which * any of the supplied matchers also match that char. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orChar(engine, eqChar(engine, 1), eqChar(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static char orChar(final MoxyEngine engine, final Character... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive short for which * any of the supplied matchers also match that short. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orShort(eqShort(1), eqShort(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orShort(MoxyEngine, Short...) * @since 1.0 */ public static short orShort(final Short... fromMatchers) { return orShort(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive short for which * any of the supplied matchers also match that short. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orShort(engine, eqShort(engine, 1), eqShort(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static short orShort(final MoxyEngine engine, final Short... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive int for which * any of the supplied matchers also match that int. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orInt(eqInt(1), eqInt(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orInt(MoxyEngine, Integer...) * @since 1.0 */ public static int orInt(final Integer... fromMatchers) { return orInt(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive int for which * any of the supplied matchers also match that int. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orInt(engine, eqInt(engine, 1), eqInt(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static int orInt(final MoxyEngine engine, final Integer... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive long for which * any of the supplied matchers also match that long. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orLong(eqLong(1), eqLong(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orLong(MoxyEngine, Long...) * @since 1.0 */ public static long orLong(final Long... fromMatchers) { return orLong(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive long for which * any of the supplied matchers also match that long. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orLong(engine, eqLong(engine, 1), eqLong(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static long orLong(final MoxyEngine engine, final Long... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive float for which * any of the supplied matchers also match that float. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orFloat(eqFloat(1), eqFloat(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orFloat(MoxyEngine, Float...) * @since 1.0 */ public static float orFloat(final Float... fromMatchers) { return orFloat(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive float for which * any of the supplied matchers also match that float. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orFloat(engine, eqFloat(engine, 1), eqFloat(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static float orFloat(final MoxyEngine engine, final Float... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive double for which * any of the supplied matchers also match that double. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orDouble(eqDouble(1), eqDouble(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @see #orDouble(MoxyEngine, Double...) * @since 1.0 */ public static double orDouble(final Double... fromMatchers) { return orDouble(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive double for which * any of the supplied matchers also match that double. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orDouble(engine, eqDouble(engine, 1), eqDouble(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return zero (ignored). * @since 1.0 */ public static double orDouble(final MoxyEngine engine, final Double... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return 0; } /** *

Create a matcher that will match any primitive boolean for which * any of the supplied matchers also match that boolean. The matcher * is created in the default Moxy engine.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orBool(eqBool(1), eqBool(10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return false (ignored). * @see #orBool(MoxyEngine, Boolean...) * @since 1.0 */ public static boolean orBool(final Boolean... fromMatchers) { return orBool(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any primitive boolean for which * any of the supplied matchers also match that boolean. The matcher * is created in the specified {@link MoxyEngine}.

* *

Note: all nested matchers must also be supplied using * the appropriate primitive matcher type methods, e.g.:

* *

   * when(() -> mock.method(orBool(engine, eqBool(engine, 1), eqBool(engine, 10))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers (or primitive variants), you may find it more efficient to use * {@link #anyOf(Object...)} instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return false (ignored). * @since 1.0 */ public static boolean orBool(final MoxyEngine engine, final Boolean... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return false; } /** *

Create a matcher that will match any T for which * any of the supplied matchers also match that byte. The matcher * is created in the default Moxy engine.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers, you may find it more efficient to use {@link #anyOf(Object...)} * instead.

* * @param fromMatchers Matcher method invocations that should be matched. * * @return null (ignored). * @see #or(MoxyEngine, Object...) * @since 1.0 * * @param The type this matcher will operate on */ @SafeVarargs public static T or(final T... fromMatchers) { return or(Moxy.getMoxyEngine(), fromMatchers); } /** *

Create a matcher that will match any T for which * any of the supplied matchers also match that byte. The matcher * is created in the supplied {@link MoxyEngine}.

* *

If you find that you are using this matcher with all {@link #eq(Object)} * matchers, you may find it more efficient to use {@link #anyOf(Object...)} * instead.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatchers Matcher method invocations that should be matched. * * @return null (ignored). * @see #or(MoxyEngine, Object...) * @since 1.0 * * @param The type this matcher will operate on */ @SafeVarargs public static T or(final MoxyEngine engine, final T... fromMatchers) { engine.registerMatcher(new OrMatcher(fromMatchers)); return null; } /* ************ NOT ************** */ /** *

Create a matcher that will match any primitive byte for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notByte(eqByte(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notByte(MoxyEngine, byte) * @since 1.0 */ public static byte notByte(final byte fromMatcher) { return notByte(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive byte for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notByte(engine, eqByte(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static byte notByte(final MoxyEngine engine, final byte fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive char for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notChar(eqChar(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notChar(MoxyEngine, char) * @since 1.0 */ public static char notChar(final char fromMatcher) { return notChar(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive char for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notChar(engine, eqChar(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static char notChar(final MoxyEngine engine, final char fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive short for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notShort(eqShort(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notShort(MoxyEngine, short) * @since 1.0 */ public static short notShort(final short fromMatcher) { return notShort(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive short for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notShort(engine, eqShort(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static short notShort(final MoxyEngine engine, final short fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive int for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notInt(eqInt(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notInt(MoxyEngine, int) * @since 1.0 */ public static int notInt(final int fromMatcher) { return notInt(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive int for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notInt(engine, eqInt(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static int notInt(final MoxyEngine engine, final int fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive long for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notLong(eqLong(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notLong(MoxyEngine, long) * @since 1.0 */ public static long notLong(final long fromMatcher) { return notLong(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive long for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notLong(engine, eqLong(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static long notLong(final MoxyEngine engine, final long fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive float for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notFloat(eqFloat(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notFloat(MoxyEngine, float) * @since 1.0 */ public static float notFloat(final float fromMatcher) { return notFloat(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive float for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notFloat(engine, eqFloat(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static float notFloat(final MoxyEngine engine, final float fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive double for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notDouble(eqDouble(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @see #notDouble(MoxyEngine, double) * @since 1.0 */ public static double notDouble(final double fromMatcher) { return notDouble(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive double for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notDouble(engine, eqDouble(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 */ public static double notDouble(final MoxyEngine engine, final double fromMatcher) { engine.registerMatcher(new NotMatcher()); return 0; } /** *

Create a matcher that will match any primitive boolean for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notBool(eqBool(1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param fromMatcher Matcher method invocation to negate. * * @return false (ignored). * @see #notBool(MoxyEngine, boolean) * @since 1.0 */ public static boolean notBool(final boolean fromMatcher) { return notBool(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any primitive boolean for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* *

Note: the nested matcher must also be supplied using * the appropriate primitive matcher type method, e.g.:

* *

   * when(() -> mock.method(notBool(engine, eqBool(engine, 1))));
   * 
* *

Failure to adhere to this rule will cause {@link PossibleMatcherUsageError} * exceptions to be thrown.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return false (ignored). * @since 1.0 */ public static boolean notBool(final MoxyEngine engine, final boolean fromMatcher) { engine.registerMatcher(new NotMatcher()); return false; } /** *

Create a matcher that will match any T for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the default * Moxy engine.

* * @param fromMatcher Matcher method invocation to negate. * * @return null (ignored). * @see #not(MoxyEngine, Object) * @since 1.0 * * @param The type this matcher will operate on */ public static T not(final T fromMatcher) { return not(Moxy.getMoxyEngine(), fromMatcher); } /** *

Create a matcher that will match any T for which * the supplied matcher does not match. In other words, this * matcher negates its nested matcher. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param fromMatcher Matcher method invocation to negate. * * @return zero (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T not(final MoxyEngine engine, final T fromMatcher) { engine.registerMatcher(new NotMatcher()); return null; } /* ************ FUNCTION ************** */ /** *

Create a matcher that will match a primitive byte if the supplied * function returns true for that byte. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static byte matchesByte(final Predicate predicate) { return matchesByte(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive byte if the supplied * function returns true for that byte. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static byte matchesByte(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive char if the supplied * predicate returns true for that char. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static char matchesChar(final Predicate predicate) { return matchesChar(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive char if the supplied * predicate returns true for that char. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static char matchesChar(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive short if the supplied * predicate returns true for that short. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static short matchesShort(final Predicate predicate) { return matchesShort(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive short if the supplied * predicate returns true for that short. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static short matchesShort(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive int if the supplied * predicate returns true for that int. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static int matchesInt(final Predicate predicate) { return matchesInt(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive int if the supplied * predicate returns true for that int. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static int matchesInt(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive long if the supplied * predicate returns true for that long. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static long matchesLong(final Predicate predicate) { return matchesLong(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive long if the supplied * predicate returns true for that long. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static long matchesLong(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive float if the supplied * predicate returns true for that float. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static float matchesFloat(final Predicate predicate) { return matchesFloat(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive float if the supplied * predicate returns true for that float. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static float matchesFloat(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive double if the supplied * predicate returns true for that double. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static double matchesDouble(final Predicate predicate) { return matchesDouble(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive double if the supplied * predicate returns true for that double. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return zero (ignored). * @since 1.0 * */ public static double matchesDouble(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return 0; } /** *

Create a matcher that will match a primitive boolean if the supplied * predicate returns true for that boolean. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return false (ignored). * @since 1.0 * */ public static boolean matchesBool(final Predicate predicate) { return matchesBool(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match a primitive boolean if the supplied * predicate returns true for that boolean. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return false (ignored). * @since 1.0 * */ public static boolean matchesBool(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return false; } /** *

Create a matcher that will match an argument of type T if the supplied * predicate returns true for that argument. The matcher is created in the default * {@link MoxyEngine}.

* * @param predicate The predicate that will determine the match. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T matches(final Predicate predicate) { return matches(Moxy.getMoxyEngine(), predicate); } /** *

Create a matcher that will match an argument of type T if the supplied * predicate returns true for that argument. The matcher is created in the specified * {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param predicate The predicate that will determine the match. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T matches(final MoxyEngine engine, final Predicate predicate) { engine.registerMatcher(new PredicateMatcher<>(predicate)); return null; } /* ************ CUSTOM ************** */ /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive byte arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customByte((arg) -> arg >= (byte)3))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customByte(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static byte customByte(final MoxyMatcher matcher) { return customByte(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive byte arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customByte(engine, (arg) -> arg >= (byte)3))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static byte customByte(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive char arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customChar((arg) -> arg != 'z'))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customChar(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static char customChar(final MoxyMatcher matcher) { return customChar(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive char arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customChar(engine, (arg) -> arg != 'z'))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static char customChar(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive short arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customShort((arg) -> arg >= (short)3))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customShort(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static short customShort(final MoxyMatcher matcher) { return customShort(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive short arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customShort(engine, (arg) -> arg >= (short)3))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static short customShort(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive int arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customInt((arg) -> arg >= 3))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customInt(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static int customInt(final MoxyMatcher matcher) { return customInt(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive int arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customInt(engine, (arg) -> arg >= 3))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static int customInt(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive long arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customLong((arg) -> arg >= 3L))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customLong(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static long customLong(final MoxyMatcher matcher) { return customLong(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive long arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customLong(engine, (arg) -> arg >= 3L))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static long customLong(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive float arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customFloat((arg) -> arg >= 3.0f))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customFloat(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static float customFloat(final MoxyMatcher matcher) { return customFloat(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive float arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customFloat(engine, (arg) -> arg >= 3.0f))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static float customFloat(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive double arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customDouble((arg) -> arg >= 3.0d))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return zero (ignored). * @see #customDouble(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static double customDouble(final MoxyMatcher matcher) { return customDouble(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive double arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customDouble(engine, (arg) -> arg >= 3.0d))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return zero (ignored). * @since 1.0 */ public static double customDouble(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return 0; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive boolean arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customBool((arg) -> arg == true))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return false (ignored). * @see #customBool(MoxyEngine, MoxyMatcher) * @since 1.0 */ public static boolean customBool(final MoxyMatcher matcher) { return customBool(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against primitive boolean arguments (using the primitive * wrapper classes and autoboxing).

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(customBool(engine, (arg) -> arg == true))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return false (ignored). * @since 1.0 */ public static boolean customBool(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return false; } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against T arguments.

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(custom((arg) -> "ok".equals(arg)))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param matcher Custom matcher to add. * * @return null (ignored). * @see #custom(MoxyEngine, MoxyMatcher) * @since 1.0 * * @param The type this matcher will operate on */ public static T custom(final MoxyMatcher matcher) { return custom(Moxy.getMoxyEngine(), matcher); } /** *

Allows addition of a custom {@link MoxyMatcher} that will match * against T arguments.

* *

For simple cases, this method accepts a Java 1.8 lambda expression, * into which the argument to be matched is passed. For example:

* *

   * when(() -> mock.method(custom(engine, (arg) -> "ok".equals(arg)))).thenReturn("passed");
   * 
* *

In more complex cases, such as when custom stack manipulation is required, * you can pass in a custom implementation of {@link MoxyMatcher}. See * the documentation on that interface for more details.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param matcher Custom matcher to add. * * @return null (ignored). * @since 1.0 * * @param The type this matcher will operate on */ public static T custom(final MoxyEngine engine, final MoxyMatcher matcher) { engine.registerMatcher(matcher); return null; } /* ************ STRING - STARTSWITH ************** */ /** *

Creates a matcher for String arguments that matches * if the argument starts with the specified String. * The matcher is created in the default Moxy engine.

* * @param string The string that arguments must start with in order to match. * * @return null (ignored). * @see #startsWith(MoxyEngine, String) * @since 1.0 */ public static String startsWith(final String string) { return startsWith(Moxy.getMoxyEngine(), string); } /** *

Creates a matcher for String arguments that matches * if the argument starts with the specified String. * The matcher is created in the specified {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param string The string that arguments must start with in order to match. * * @return null (ignored). * @since 1.0 */ public static String startsWith(final MoxyEngine engine, final String string) { engine.registerMatcher(new StartsWithMatcher(string)); return null; } /* ************ STRING - CONTAINS ************** */ /** *

Creates a matcher for String arguments that matches * if the argument contains the specified String. * The matcher is created in the default Moxy engine.

* * @param string The string that arguments must contain in order to match. * * @return null (ignored). * @see #contains(MoxyEngine, String) * @since 1.0 */ public static String contains(final String string) { return contains(Moxy.getMoxyEngine(), string); } /** *

Creates a matcher for String arguments that matches * if the argument contains the specified String. * The matcher is created in the specified {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param string The string that arguments must contain in order to match. * * @return null (ignored). * @since 1.0 */ public static String contains(final MoxyEngine engine, final String string) { engine.registerMatcher(new ContainsMatcher(string)); return null; } /* ************ STRING - ENDSSWITH ************** */ /** *

Creates a matcher for String arguments that matches * if the argument ends with the specified String. * The matcher is created in the default Moxy engine.

* * @param string The string that arguments must end with in order to match. * * @return null (ignored). * @see #endsWith(MoxyEngine, String) * @since 1.0 */ public static String endsWith(final String string) { return endsWith(Moxy.getMoxyEngine(), string); } /** *

Creates a matcher for String arguments that matches * if the argument ends with the specified String. * The matcher is created in the specified {@link MoxyEngine}.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param string The string that arguments must end with in order to match. * * @return null (ignored). * @since 1.0 */ public static String endsWith(final MoxyEngine engine, final String string) { engine.registerMatcher(new EndsWithMatcher(string)); return null; } /* ************ STRING - REGEX ************** */ /** *

Creates a matcher for String arguments that matches * if the argument matches the specified regular expression. * The matcher is created in the default Moxy engine.

* *

The matcher will match if any part of the argument matches * the regular expression. If you wish to match the whole string, * you must use the regular expression anchor characters ^ * and $.

* * @param regex The string containing the regular expression that arguments must match in order to match. * * @return null (ignored). * @see #regexMatch(MoxyEngine, String) * @since 1.0 */ public static String regexMatch(final String regex) { return regexMatch(Moxy.getMoxyEngine(), regex); } /** *

Creates a matcher for String arguments that matches * if the argument matches the specified regular expression. * The matcher is created in the specified {@link MoxyEngine}.

* *

The matcher will match if any part of the argument matches * the regular expression. If you wish to match the whole string, * you must use the regular expression anchor characters ^ * and $.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param regex The string containing the regular expression that arguments must match in order to match. * * @return null (ignored). * @since 1.0 */ public static String regexMatch(final MoxyEngine engine, final String regex) { engine.registerMatcher(new RegexMatcher(regex)); return null; } /** *

Create a matcher for T arguments that matches if the * argument is an instanceof the specified class. * The matcher is created in the default {@link MoxyEngine}.

* *

More specifically, this matcher will match if the specified * class isAssignableFrom the runtime class of the * argument.

* * @param clz The class this matcher will match instances of. * * @return null (Ignored). * @see #instanceOf(MoxyEngine, Class) * @since 1.0 * * @param The type this matcher checks instanceof. */ public static T instanceOf(final Class clz) { return instanceOf(Moxy.getMoxyEngine(), clz); } /** * Convenience alias of {@link #instanceOf(Class)}. * * @param clz The class this matcher will match instances of. * * @return null (Ignored). * @see #instanceOf(Class) * @see #any(MoxyEngine, Class) * @since 1.0 * * @param The type this matcher checks instanceof. */ public static T any(final Class clz) { return instanceOf(clz); } /** *

Create a matcher for T arguments that matches if the * argument is an instanceof the specified class. * The matcher is created in the specified {@link MoxyEngine}.

* *

More specifically, this matcher will match if the specified * class isAssignableFrom the runtime class of the * argument.

* * @param engine The {@link MoxyEngine} to which this matcher applies. * @param clz The class this matcher will match instances of. * * @return null (Ignored). * @see #instanceOf(MoxyEngine, Class) * @since 1.0 * * @param The type this matcher checks instanceof. */ public static T instanceOf(final MoxyEngine engine, final Class clz) { engine.registerMatcher(new InstanceOfMatcher<>(clz)); return null; } /** * Convenience alias of {@link #instanceOf(MoxyEngine, Class)}. * * @param engine The {@link MoxyEngine} to which this matcher applies. * @param clz The class this matcher will match instances of. * * @return null (Ignored). * @see #instanceOf(MoxyEngine, Class) * @see #any(Class) * @since 1.0 * * @param The type this matcher checks instanceof. */ public static T any(final MoxyEngine engine, final Class clz) { return instanceOf(engine, clz); } private Matchers() { throw new UnsupportedOperationException( "com.roscopeco.moxy.matchers.Matchers is not designed for instantiation"); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy