Package org.junit.runners.model

Examples of org.junit.runners.model.Statement


            // ensure we always have an actual name here instead of null because using
            // null will clash with the name used for looking up rules when the clas
            // has a BMRules annotation
            final String name = computeBMRulesName(annotation.value(), method);
            final String loadDirectory = computeLoadDirectory(annotation.dir(), this.loadDirectory);
            return new Statement() {
                public void evaluate() throws Throwable {
                    BMUnit.loadScriptFile(testKlazz, name, loadDirectory);
                    try {
                        statement.evaluate();
                    } finally {
View Full Code Here


        BMScripts scriptsAnnotation = method.getAnnotation(BMScripts.class);
        if (scriptsAnnotation == null) {
            return statement;
        } else {
            BMScript[] scriptAnnotations = scriptsAnnotation.scripts();
            Statement result = statement;
            // note we iterate down here because we generate statements by wraparound
            // which means the the outer statement gets executed first
            for (int i = scriptAnnotations.length; i> 0; i--) {
                BMScript scriptAnnotation = scriptAnnotations[i - 1];
                final Statement nextStatement = result;
                // ensure we always have an actual name here instead of null because using
                // null will clash with the name used for looking up rules when the clas
                // has a BMRules annotation
                final String name = computeBMRulesName(scriptAnnotation.value(), method);
                final String loadDirectory = computeLoadDirectory(scriptAnnotation.dir(), this.loadDirectory);
                result = new Statement() {
                    public void evaluate() throws Throwable {
                        BMUnit.loadScriptFile(testKlazz, name, loadDirectory);
                        try {
                            nextStatement.evaluate();
                        } finally {
                            BMUnit.unloadScriptFile(testKlazz, name);
                        }
                    }
                };
View Full Code Here

        if (annotation == null) {
            return statement;
        } else {
            final String name = method.getName();
            final String script = constructScriptText(annotation.rules());
            return new Statement() {
                public void evaluate() throws Throwable {
                    BMUnit.loadScriptText(testKlazz, name, script);
                    try {
                        statement.evaluate();
                    } finally {
View Full Code Here

        if (annotation == null) {
            return statement;
        } else {
            final String name = method.getName();
            final String script = constructScriptText(new BMRule[] {annotation });
            return new Statement() {
                public void evaluate() throws Throwable {
                    BMUnit.loadScriptText(testKlazz, name, script);
                    try {
                        statement.evaluate();
                    } finally {
View Full Code Here

        return bootstrap != null ? bootstrap.getContainer() : null;
    }

    @Override
    public Statement apply(final Statement base, final Description description) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                //
                bootstrap = new KernelBootstrap(Thread.currentThread().getContextClassLoader());
View Full Code Here

    ignoreCompilationErrors = clazz.getAnnotation( IgnoreCompilationErrors.class ) != null;
  }

  @Override
  protected Statement methodBlock(FrameworkMethod method) {
    Statement statement = super.methodBlock( method );
    processAnnotations( method );
    if ( !annotationProcessorNeedsToRun() ) {
      return statement;
    }
View Full Code Here

public class FacesRequestSetupRule implements MethodRule {
    private FacesEnvironment environment;
    private FacesRequest facesRequest;

    public Statement apply(final Statement base, final FrameworkMethod method, Object target) {
        return new Statement() {
            @Override
            public void evaluate() throws Throwable {
                starting(method);
                try {
                    base.evaluate();
View Full Code Here

* Second, the failures are recognized by IDE's (like IntelliJ IDEA) which open a comparison window.
*/
public class JUnitSoftAssertions extends AbstractSoftAssertions implements TestRule {

  public Statement apply(final Statement base, Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
    base.evaluate();
    MultipleFailureException.assertEmpty(collector.errors());
    }
View Full Code Here

   }
     
   @Override
   protected Statement withBeforeClasses(final Statement originalStatement)
   {
      final Statement statementWithBefores = super.withBeforeClasses(originalStatement);
      return new Statement()
      {
         @Override
         public void evaluate() throws Throwable
         {
            deployableTest.get().beforeClass(Arquillian.this.getTestClass().getJavaClass());
            statementWithBefores.evaluate();
         }
      };
   }
View Full Code Here

   }
  
   @Override
   protected Statement withAfterClasses(final Statement originalStatement)
   {
      final Statement statementWithAfters = super.withAfterClasses(originalStatement);
      return new Statement()
      {
         @Override
         public void evaluate() throws Throwable
         {
            new MultiStatementExecutor().execute
            (
                  new Statement() { public void evaluate() throws Throwable
                  {
                     statementWithAfters.evaluate();
                  }},
                  new Statement() { public void evaluate() throws Throwable
                  {
                     deployableTest.get().afterClass(Arquillian.this.getTestClass().getJavaClass());
                  }}
            );
         }
View Full Code Here

TOP

Related Classes of org.junit.runners.model.Statement

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.