Examples of Failure


Examples of org.junit.runner.notification.Failure

  }

  @Test
  public void failedConstructionIsTestFailure() {
    Result result= JUnitCore.runClasses(CantConstruct.class);
    Failure failure= result.getFailures().get(0);
    Description expected= Description.createTestDescription(CantConstruct.class, "foo");
    Assert.assertEquals(expected, failure.getDescription());
  }
View Full Code Here

Examples of org.junit.runner.notification.Failure

      throw new Error();
    }
  }
  @Test public void unexpected() {
    Result result= JUnitCore.runClasses(Unexpected.class);
    Failure failure= result.getFailures().get(0);
    String message= failure.getMessage();
    assertTrue(message.contains("expected<java.lang.Exception> but was<java.lang.Error>"));
    assertEquals(Error.class, failure.getException().getCause().getClass());
  }
View Full Code Here

Examples of org.junit.runner.notification.Failure

  }
 
  @Test public void constructorException() {
    JUnitCore core = new JUnitCore();
    Result result = core.run(new Class[] {FaultyConstructor.class});
    Failure failure = result.getFailures().get(0);
    assertEquals("Thrown during construction", failure.getException().getMessage());
  }
View Full Code Here

Examples of org.junit.runner.notification.Failure

  }
 
  @Test public void noRunnableMethods() {
    JUnitCore core = new JUnitCore();
    Result result = core.run(new Class[] {NoTests.class});
    Failure failure = result.getFailures().get(0);
    assertEquals("No runnable methods", failure.getException().getMessage());
  }
View Full Code Here

Examples of org.junit.runner.notification.Failure

        }
        catch ( Exception e )
        {
            LOG.error( I18n.err( I18n.ERR_181, getTestClass().getName() ) );
            LOG.error( e.getLocalizedMessage() );
            notifier.fireTestFailure( new Failure( getDescription(), e ) );
        }
        finally
        {
            // help GC to get rid of the directory service with all its references
            classDS = null;
View Full Code Here

Examples of org.junit.runner.notification.Failure

        }
        catch ( Exception e )
        {
            LOG.error( I18n.err( I18n.ERR_182, method.getName() ) );
            LOG.error( "", e );
            notifier.fireTestFailure( new Failure( getDescription(), e ) );
        }
    }
View Full Code Here

Examples of org.junit.runner.notification.Failure

            public void run()
            {
                try
                {
                    jUnit4TestSetReporter.testStarted( testSomething2 );
                    jUnit4TestSetReporter.testFailure( new Failure( testSomething2, new AssertionError( "Fud" ) ) );
                    jUnit4TestSetReporter.testFinished( testSomething2 );
                    countDownLatch.countDown();
                }
                catch ( Exception e )
                {
View Full Code Here

Examples of org.junit.runner.notification.Failure

        }
        catch ( Exception e )
        {
            LOG.error( I18n.err( I18n.ERR_181, getTestClass().getName() ) );
            LOG.error( e.getLocalizedMessage() );
            notifier.fireTestFailure( new Failure( getDescription(), e ) );
        }
        finally
        {
            // help GC to get rid of the directory service with all its references
            classDS = null;
View Full Code Here

Examples of org.junit.runner.notification.Failure

        }
        catch ( Exception e )
        {
            LOG.error( I18n.err( I18n.ERR_182, method.getName() ) );
            LOG.error( "", e );
            notifier.fireTestFailure( new Failure( getDescription(), e ) );
        }
    }
View Full Code Here

Examples of org.junit.runner.notification.Failure

         if(State.hasInitializationException()) 
         {
            // failed on suite level, ignore children
            //notifier.fireTestIgnored(getDescription());
            notifier.fireTestFailure(
                  new Failure(getDescription(),
                        new RuntimeException(
                              "Arquillian has previously been attempted initialized, but failed. See cause for previous exception",
                              State.getInitializationException())));
         }
         else
         {
            try
            {
               // ARQ-1742 If exceptions happen during boot
               TestRunnerAdaptor adaptor = TestRunnerAdaptorBuilder.build();
               // don't set it if beforeSuite fails
               adaptor.beforeSuite();
               State.testAdaptor(adaptor);
            }
            catch (Exception e
            {
               // caught exception during BeforeSuite, mark this as failed
               State.caughtInitializationException(e);
               notifier.fireTestFailure(new Failure(getDescription(), e));
            }
         }
      }
      notifier.addListener(new RunListener()
      {
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.