Examples of IMethodInstance


Examples of org.testng.IMethodInstance

public class VerifyMethodInterceptor implements IMethodInterceptor {
  @Override
  public List<IMethodInstance> intercept(List<IMethodInstance> methods,
      ITestContext context) {
    List<IMethodInstance> result = Lists.newArrayList();
    IMethodInstance verifier = null;

    // Doing a naive approach here: we run through the list of methods
    // twice, once to find the verifier and once more to actually create
    // the result. Obviously, this can be done with just one loop
    for (IMethodInstance m : methods) {
View Full Code Here

Examples of org.testng.IMethodInstance

    List<IMethodInstance> result = new ArrayList<IMethodInstance>();
    for (final Method m : realClass.getDeclaredMethods()) {
      Annotation a = m.getAnnotation(Verify.class);
      if (a != null) {
        final ITestNGMethod vm = TestNGUtils.createITestNGMethod(tm, m);
        result.add(new IMethodInstance() {

          @Override
          public Object[] getInstances() {
            return tm.getInstances();
          }
View Full Code Here

Examples of org.testng.IMethodInstance

    }


    private IMethodInstance mockIMethodAnnotatedWith(Class methodClass, boolean firstTestAnnotation,
                                                     boolean lastTestAnnotation, boolean orderAnnotation) throws Exception {
        IMethodInstance methodInstance = mock(IMethodInstance.class);
        ITestNGMethod testNgMethod = mock(ITestNGMethod.class);

        when(methodInstance.getMethod()).thenReturn(testNgMethod);
        when(testNgMethod.getRealClass()).thenReturn(methodClass);

        String methodName;
        if (firstTestAnnotation && lastTestAnnotation && orderAnnotation == true) {
            methodName = ClassWithMethodsToTest.WITH_TEST_ORDER_ONE_AND_FIRST_AND_LAST_ANNOTATION;
View Full Code Here

Examples of org.testng.IMethodInstance

    private IMethodInstance mockIMethodDependantUponOtherMethods() throws Exception {
        return mockIMethodDependantUponOtherMethods(ClassWithMethodsToTest.class);
    }

    private IMethodInstance mockIMethodDependantUponOtherMethods(Class methodClass) throws Exception {
        IMethodInstance methodInstance = mock(IMethodInstance.class);
        ITestNGMethod testNgMethod = mock(ITestNGMethod.class);

        when(methodInstance.getMethod()).thenReturn(testNgMethod);
        when(testNgMethod.getRealClass()).thenReturn(methodClass);
        when(testNgMethod.getMethodsDependedUpon()).thenReturn(new String[]{"method1, method2"});


        Method methodWithoutAnnotations = ClassWithMethodsToTest.class.getMethod(ClassWithMethodsToTest.WITHOUT_ANNOTATIONS);
View Full Code Here

Examples of org.testng.IMethodInstance

        return methodInstance;
    }

    private IMethodInstance mockIMethodWithTestOrderAnnotationWithParamOne() throws Exception {

        IMethodInstance methodInstance = mock(IMethodInstance.class);
        ITestNGMethod testNgMethod = mock(ITestNGMethod.class);

        when(methodInstance.getMethod()).thenReturn(testNgMethod);
        when(testNgMethod.getRealClass()).thenReturn(ClassWithMethodsToTest.class);

        mockWithMethod(testNgMethod, ClassWithMethodsToTest.WITH_TEST_ORDER_ONE);

        when(testNgMethod.getMethodsDependedUpon()).thenReturn(new String[]{});
View Full Code Here

Examples of org.testng.IMethodInstance

        return methodInstance;
    }

    private IMethodInstance mockIMethodWithTestOrderAnnotationWithParamTen() throws Exception {

        IMethodInstance methodInstance = mock(IMethodInstance.class);
        ITestNGMethod testNgMethod = mock(ITestNGMethod.class);

        when(methodInstance.getMethod()).thenReturn(testNgMethod);
        when(testNgMethod.getRealClass()).thenReturn(ClassWithMethodsToTest.class);

        mockWithMethod(testNgMethod, ClassWithMethodsToTest.WITH_TEST_ORDER_TEN);

        when(testNgMethod.getMethodsDependedUpon()).thenReturn(new String[]{});
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.