org.mockito.internal.matchers.ArrayEquals的实例源码

项目:astor    文件Invocation.java   
private static Object[] expandVarargs(final boolean isVarargs,final Object[] args) {
    if (!isVarargs || args[args.length - 1] != null && !args[args.length - 1].getClass().isArray()) {
        return args == null ? new Object[0] : args;
    }

    final int nonVarargsCount = args.length - 1;
    Object[] varargs;
    if (args[nonVarargsCount] == null) {
        // in case someone deliberately passed null vararg array
        varargs = new Object[] { null };
    } else {
        varargs = ArrayEquals.createObjectArray(args[nonVarargsCount]);
    }
    final int varargsCount = varargs.length;
    Object[] newArgs = new Object[nonVarargsCount + varargsCount];
    System.arraycopy(args,newArgs,nonVarargsCount);
    System.arraycopy(varargs,nonVarargsCount,varargsCount);
    return newArgs;
}
项目:astor    文件ArgumentsProcessor.java   
public static Object[] expandVarargs(final boolean isVarargs,final Object[] args) {
    if (!isVarargs || new ArrayUtils().isEmpty(args) || args[args.length - 1] != null && !args[args.length - 1].getClass().isArray()) {
        return args == null ? new Object[0] : args;
    }

    final int nonVarargsCount = args.length - 1;
    Object[] varargs;
    if (args[nonVarargsCount] == null) {
        // in case someone deliberately passed null vararg array
        varargs = new Object[] { null };
    } else {
        varargs = ArrayEquals.createObjectArray(args[nonVarargsCount]);
    }
    final int varargsCount = varargs.length;
    Object[] newArgs = new Object[nonVarargsCount + varargsCount];
    System.arraycopy(args,varargsCount);
    return newArgs;
}
项目:elasticsearch_my    文件RestHighLevelClientTests.java   
@Override
public boolean matches(Object varargArgument) {
    if (varargArgument instanceof Header[]) {
        Header[] actualHeaders = (Header[]) varargArgument;
        return new ArrayEquals(expectedHeaders).matches(actualHeaders);
    }
    return false;
}
项目:ditb    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,SubprocedureFactory subprocFactory,Iterable<Subprocedure> cohortTasks,VerificationMode prepare,VerificationMode commit,VerificationMode cleanup,VerificationMode finish,boolean opHasError) throws Exception {

  // make sure we build the correct number of cohort members
  Mockito.verify(subprocFactory,Mockito.times(cohortNames.size())).buildSubprocedure(
    Mockito.eq(opName),(byte[]) Mockito.argThat(new ArrayEquals(data)));
  // verify that we ran each of the operations cleanly
  int j = 0;
  for (Subprocedure op : cohortTasks) {
    LOG.debug("Checking mock:" + (j++));
    waitAndVerifySubproc(op,prepare,commit,cleanup,finish,opHasError);
  }
}
项目:LCIndex-HBase-0.94.16    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:pbase    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:HIndex    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:IRIndex    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:astor    文件Invocation.java   
protected List<Matcher> argumentsToMatchers() {
    List<Matcher> matchers = new ArrayList<Matcher>(arguments.length);
    for (Object arg : arguments) {
        if (arg != null && arg.getClass().isArray()) {
            matchers.add(new ArrayEquals(arg));
        } else {
            matchers.add(new Equals(arg));
        }
    }
    return matchers;
}
项目:astor    文件InvocationTest.java   
@Test
public void shouldTransformArgumentsToMatchers() throws Exception {
    Invocation i = new InvocationBuilder().args("foo",new String[] {"bar"}).toInvocation();
    List matchers = i.argumentsToMatchers();

    assertEquals(2,matchers.size());
    assertEquals(Equals.class,matchers.get(0).getClass());
    assertEquals(ArrayEquals.class,matchers.get(1).getClass());
}
项目:astor    文件ArgumentsProcessor.java   
public static List<Matcher> argumentsToMatchers(Object[] arguments) {
    List<Matcher> matchers = new ArrayList<Matcher>(arguments.length);
    for (Object arg : arguments) {
        if (arg != null && arg.getClass().isArray()) {
            matchers.add(new ArrayEquals(arg));
        } else {
            matchers.add(new Equals(arg));
        }
    }
    return matchers;
}
项目:astor    文件InvocationImpltest.java   
@Test
public void shouldTransformArgumentsToMatchers() throws Exception {
    Invocation i = new InvocationBuilder().args("foo",new String[]{"bar"}).toInvocation();
    List matchers = ArgumentsProcessor.argumentsToMatchers(i.getArguments());

    assertEquals(2,matchers.get(1).getClass());
}
项目:hbase    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:PyroDB    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:c5    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:HBase-Research    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:hbase-0.94.8-qod    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:hindex    文件TestZKProcedure.java   
private void verifyCohortSuccessful(List<String> cohortNames,opHasError);
  }
}
项目:astor    文件AdditionalMatchers.java   
/**
 * Object array argument that is equal to the given array,i.e. it has to
 * have the same type,length,and each element has to be equal.
 * <p>
 * See examples in javadoc for {@link AdditionalMatchers} class
 * 
 * @param <T>
 *            the type of the array,it is passed through to prevent casts.
 * @param value
 *            the given array.
 * @return <code>null</code>.
 */
public static <T> T[] aryEq(T[] value) {
    return reportMatcher(new ArrayEquals(value)).returnNull();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * 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();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * 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();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * int array argument that is equal to the given array,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();       
}
项目:astor    文件AdditionalMatchers.java   
/**
 * float array argument that is equal to the given array,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();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * double array argument that is equal to the given array,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();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * char array argument that is equal to the given array,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();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * byte array argument that is equal to the given array,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();
}
项目:astor    文件AdditionalMatchers.java   
/**
 * boolean array argument that is equal to the given array,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();
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...