当前位置: 首页>>代码示例>>Java>>正文


Java ArrayEquals类代码示例

本文整理汇总了Java中org.mockito.internal.matchers.ArrayEquals的典型用法代码示例。如果您正苦于以下问题:Java ArrayEquals类的具体用法?Java ArrayEquals怎么用?Java ArrayEquals使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArrayEquals类属于org.mockito.internal.matchers包,在下文中一共展示了ArrayEquals类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: expandVarArgs

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
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, 0, newArgs, 0, nonVarArgsCount);
    System.arraycopy(varArgs, 0, newArgs, nonVarArgsCount, varArgsCount);
    return newArgs;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:Invocation.java

示例2: expandVarArgs

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
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, 0, newArgs, 0, nonVarArgsCount);
    System.arraycopy(varArgs, 0, newArgs, nonVarArgsCount, varArgsCount);
    return newArgs;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:20,代码来源:ArgumentsProcessor.java

示例3: matches

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
@Override
public boolean matches(Object varargArgument) {
    if (varargArgument instanceof Header[]) {
        Header[] actualHeaders = (Header[]) varargArgument;
        return new ArrayEquals(expectedHeaders).matches(actualHeaders);
    }
    return false;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:RestHighLevelClientTests.java

示例4: verifyCohortSuccessful

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
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);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestZKProcedure.java

示例5: argumentsToMatchers

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
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;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:Invocation.java

示例6: shouldTransformArgumentsToMatchers

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
@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());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:InvocationTest.java

示例7: argumentsToMatchers

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
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;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:ArgumentsProcessor.java

示例8: shouldTransformArgumentsToMatchers

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
@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.size());
    assertEquals(Equals.class, matchers.get(0).getClass());
    assertEquals(ArrayEquals.class, matchers.get(1).getClass());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:InvocationImplTest.java

示例9: aryEq

import org.mockito.internal.matchers.ArrayEquals; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:AdditionalMatchers.java


注:本文中的org.mockito.internal.matchers.ArrayEquals类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。