/** * <code>null</code> argument. * <p> * See examples in javadoc for {@link Matchers} class * * @return <code>null</code>. */ public static Object isNull() { return reportMatcher(Null.NULL).returnNull(); }
/** * Not <code>null</code> argument. * <p> * alias to {@link Matchers#isNotNull()} * <p> * See examples in javadoc for {@link Matchers} class * * @return <code>null</code>. */ public static Object notNull() { return reportMatcher(NotNull.NOT_NULL).returnNull(); }
/** * <code>null</code> argument. * The class argument is provided to avoid casting. * <p> * See examples in javadoc for {@link Matchers} class * * @param clazz Type to avoid casting * @return <code>null</code>. */ public static <T> T isNull(Class<T> clazz) { return (T) reportMatcher(Null.NULL).returnNull(); }
/** * Allows creating custom argument matchers. * <p> * In rare cases when the parameter is a primitive then you <b>*must*</b> use relevant intThat(), floatThat(), etc. method. * This way you will avoid <code>NullPointerException</code> during auto-unboxing. * <p> * See examples in javadoc for {@link ArgumentMatcher} class * * @param matcher decides whether argument matches * @return <code>null</code>. */ public static <T> T argThat(Matcher<T> matcher) { return reportMatcher(matcher).<T>returnNull(); }
/** * Not <code>null</code> argument, not necessary of the given class. * The class argument is provided to avoid casting. * <p> * alias to {@link Matchers#isNotNull(Class)} * <p> * See examples in javadoc for {@link Matchers} class * * @param clazz Type to avoid casting * @return <code>null</code>. */ public static <T> T notNull(Class<T> clazz) { return (T) reportMatcher(NotNull.NOT_NULL).returnNull(); }
/** * comparable argument greater than the given value. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given value. * @return <code>null</code>. */ public static <T extends Comparable<T>> T gt(Comparable<T> value) { return reportMatcher(new GreaterThan<T>(value)).<T>returnNull(); }
/** * long array argument that is equal to the given array, i.e. it has to have * the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static long[] aryEq(long[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * String argument that contains a substring that matches the given regular * expression. * * @param regex * the regular expression. * @return <code>null</code>. */ public static String find(String regex) { return reportMatcher(new Find(regex)).<String>returnNull(); }
/** * comparable argument less than or equal the given value details. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given value. * @return <code>null</code>. */ public static <T extends Comparable<T>> T leq(Comparable<T> value) { return reportMatcher(new LessOrEqual<T>(value)).<T>returnNull(); }
/** * float array argument that is equal to the given array, i.e. it has to * have the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static float[] aryEq(float[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * double array argument that is equal to the given array, i.e. it has to * have the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static double[] aryEq(double[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * argument greater than or equal the given value. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given value. * @return <code>null</code>. */ public static <T extends Comparable<T>> T geq(Comparable<T> value) { return reportMatcher(new GreaterOrEqual<T>(value)).<T>returnNull(); }
/** * int array argument that is equal to the given array, i.e. it has to have * the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static int[] aryEq(int[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * comparable argument less than the given value. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given value. * @return <code>null</code>. */ public static <T extends Comparable<T>> T lt(Comparable<T> value) { return reportMatcher(new LessThan<T>(value)).<T>returnNull(); }
/** * short array argument that is equal to the given array, i.e. it has to * have the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static short[] aryEq(short[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * char array argument that is equal to the given array, i.e. it has to have * the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static char[] aryEq(char[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * boolean array argument that is equal to the given array, i.e. it has to * have the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static boolean[] aryEq(boolean[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * comparable argument equals to the given value according to their * compareTo method. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given value. * @return <code>null</code>. */ public static <T extends Comparable<T>> T cmpEq(Comparable<T> value) { return reportMatcher(new CompareEqual<T>(value)).<T>returnNull(); }
/** * byte array argument that is equal to the given array, i.e. it has to have * the same length, and each element has to be equal. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param value * the given array. * @return <code>null</code>. */ public static byte[] aryEq(byte[] value) { return reportMatcher(new ArrayEquals(value)).returnNull(); }
/** * Object argument that does not match the given argument matcher. * <p> * See examples in javadoc for {@link AdditionalMatchers} class * * @param <T> * the type of the object, it is passed through to prevent casts. * @param first * placeholder for the argument matcher. * @return <code>null</code>. */ public static <T> T not(T first) { return mockingProgress.getArgumentMatcherStorage().reportNot().<T>returnNull(); }