Package org.junit

Examples of org.junit.Ignore


    public void testIgnored(Test test) {
        String message = null;
        if (test instanceof JUnit4TestCaseFacade) {
            JUnit4TestCaseFacade facade = (JUnit4TestCaseFacade) test;
            Ignore annotation = facade.getDescription().getAnnotation(Ignore.class);
            if (annotation != null && annotation.value().length() > 0) {
                message = annotation.value();
            }
        }
        formatSkip(test, message);
    }
View Full Code Here


           */
          try {
            Class<?> testClass = Class.forName(JUnitVersionHelper.getTestCaseClassName(test));
         
                Method testMethod = testClass.getMethod(JUnitVersionHelper.getTestCaseName(test));
                Ignore annotation = testMethod.getAnnotation(Ignore.class);
                if (annotation != null && annotation.value().length() > 0) {
                    message = annotation.value();
                }
          } catch (NoSuchMethodException e) {
        // silently ignore - we'll report a skip with no message
      } catch (ClassNotFoundException e) {
        // silently ignore - we'll report a skip with no message
View Full Code Here

    public void testIgnored(Test test) {
        String message = null;
        if (test instanceof JUnit4TestCaseFacade) {
            JUnit4TestCaseFacade facade = (JUnit4TestCaseFacade) test;
            Ignore annotation = facade.getDescription().getAnnotation(Ignore.class);
            if (annotation != null && annotation.value().length() > 0) {
                message = annotation.value();
            }
        }
        formatSkip(test, message);
    }
View Full Code Here

                .value());
    }

    @Test
    public void characterizeCreatingMyOwnAnnotation() {
        Annotation annotation = new Ignore() {
            public String value() {
                return "message";
            }

            public Class<? extends Annotation> annotationType() {
                return Ignore.class;
            }
        };

        assertEquals(Ignore.class, annotation.annotationType());
    }
View Full Code Here

        return testMethods;
      testClassesRun.add(getTestClass().getJavaClass().getSimpleName());
      testMethods = new ArrayList<FrameworkMethod>();
      for (Method m : getTestClass().getJavaClass().getMethods()) {
        // check if the current test's class has methods annotated with @Ignore
        final Ignore ignored = m.getAnnotation(Ignore.class);
        if (ignored != null && !m.getName().equals("alwaysIgnoredTestMethod")) {
          System.err.println("NOTE: Ignoring test method '" + m.getName() + "': " + ignored.value());
        }
        // add methods starting with "test"
        final int mod = m.getModifiers();
        if (m.getAnnotation(Test.class) != null ||
            (m.getName().startsWith("test") &&
View Full Code Here

        return (Ignore) ReflectionUtils.invokeMethodWithArray( description, getAnnotation, ignoreParams );
    }

    public String getAnnotatedIgnoreValue( Description description )
    {
        final Ignore ignore = getAnnotatedIgnore( description );
        return ignore != null ? ignore.value() : null;
    }
View Full Code Here

        final Method testSomething2 =
            ReflectionUtils.getMethod( IgnoreWithDescription.class, "testSomething2", EMPTY_CLASS_ARRAY );
        final Annotation[] annotations = testSomething2.getAnnotations();
        Description desc =
            Description.createTestDescription( IgnoreWithDescription.class, "testSomething2", annotations );
        Ignore annotatedIgnore = reflector.getAnnotatedIgnore( desc );
        Assert.assertEquals( reason, annotatedIgnore.value() );
    }
View Full Code Here

    @Test
    public void testGetAnnotatedIgnore()
    {
        JUnit4Reflector reflector = new JUnit4Reflector();
        Description desc = Description.createTestDescription( IgnoreWithDescription.class, "testSomething2" );
        Ignore annotatedIgnore = reflector.getAnnotatedIgnore( desc );
        Assert.assertNull( annotatedIgnore );
    }
View Full Code Here

                isAllTestsIgnored = true;
            }
            else {
                isAllTestsIgnored = true;
                for ( FrameworkMethod method : computeTestMethods() ) {
                    Ignore ignore = method.getAnnotation( Ignore.class );
                    if ( ignore == null ) {
                        isAllTestsIgnored = false;
                        break;
                    }
                }
View Full Code Here

        // Now process that full list of test methods and build our custom result
        final List<FrameworkMethod> result = new ArrayList<FrameworkMethod>();
    final boolean doValidation = Boolean.getBoolean( Helper.VALIDATE_FAILURE_EXPECTED );
    int testCount = 0;

    Ignore virtualIgnore;

    for ( FrameworkMethod frameworkMethod : methods ) {
      // potentially ignore based on expected failure
            final FailureExpected failureExpected = Helper.locateAnnotation( FailureExpected.class, frameworkMethod, getTestClass() );
      if ( failureExpected != null && !doValidation ) {
View Full Code Here

TOP

Related Classes of org.junit.Ignore

Copyright © 2018 www.massapicom. 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.