Package org.jbehave.core

Examples of org.jbehave.core.Block


        resetOriginalHeadlessMode();
    }

    private void ensureDoesNotThrowExceptionWhenNotHeadless(final HeadlessChecker headlessChecker) throws Exception {
        System.getProperties().remove("java.awt.headless");
        Exception exception = runAndCatch(Exception.class, new Block() {
            public void run() throws Exception {
                headlessChecker.check();
            }
        });
        ensureThat(exception, isNull());
View Full Code Here


        ensureThat(exception, isNull());
    }

    private void ensureThrowsPendingExceptionOnHeadless(final HeadlessChecker headlessChecker) throws Exception {
        System.getProperties().put("java.awt.headless", "true");
        Exception exception = runAndCatch(PendingException.class, new Block() {
            public void run() throws Exception {
                headlessChecker.check();
            }
        });
        ensureThat(exception, isNotNull());
View Full Code Here

    public void shouldWrapJMockVerificationFailureAsVerificationException() throws Exception {
        // given...
        final UsingJMock instance = new HasMockThatFailsVerify();

        // when...
        Exception exception = runAndCatch(VerificationException.class, new Block() {
            public void run() throws Exception {
                instance.verifyMocks();
            }
        });
       
View Full Code Here

    public void shouldFailTheBuildWhenVerificationFails() throws Exception {
        final String behaviourClassName = FailingBehaviourClass.class.getName();
        task.setBehavioursClassName(behaviourClassName);
        runner.valueToReturn = 1;

        Exception exception = runAndCatch(BuildException.class, new Block() {
            public void run() throws Exception {
                task.execute();
            }
        });
        ensureThat(exception, isNotNull());
View Full Code Here

    public void shouldFailTheBuildWhenVerificationFails() throws Exception {
        final String storyClassName = FailingStoryClass.class.getName();
        task.setStoryClassName(storyClassName);
        runner.valueToReturn = 1;

        Exception exception = runAndCatch(BuildException.class, new Block() {
            public void run() throws Exception {
                task.execute();
            }
        });
        ensureThat(exception, isNotNull());
View Full Code Here

    }
   
    public void shouldCopeWithNullArguments() throws Exception {
        final PrintStream aStream = new PrintStream(new ByteArrayOutputStream());
       
        Exception exception = runAndCatch(Exception.class, new Block() {
            public void run() throws Exception {
                new JBehaveFrameworkError(null, null).printStackTrace(aStream);
                new JBehaveFrameworkError((String)null).printStackTrace(aStream);
                new JBehaveFrameworkError((Throwable)null).printStackTrace(aStream);
            }
View Full Code Here

  }

  public void shouldNotConvertFromNegativeSterlingAmounts() throws Exception {
    // expects
    exchangeRateServiceMock.stubs("retrieveRate").will(returnValue(new ExchangeRate(1.85, 0.54)));
    Exception exception = runAndCatch(InvalidAmountException.class, new Block() {
            public void run() throws Exception {
                sterlingConverter.convertFromSterling(-1, Currency.USD);
            }
        });
        ensureThat(exception, isNotNull());
View Full Code Here

  }

  public void shouldNotConvertFromNegativeAmounts() throws Exception {
    //expects
    exchangeRateServiceMock.stubs("retrieveRate").will(returnValue(new ExchangeRate(1.85, 0.54)));
        Exception exception = runAndCatch(InvalidAmountException.class, new Block() {
            public void run() throws Exception {
                sterlingConverter.convertToSterling(-3, Currency.EUR);
            }
        });
  }
View Full Code Here

import org.jbehave.core.mock.UsingMatchers;

public class StoryToDirectoryPrinterBehaviour extends UsingMatchers {

    public void shouldThrowIllegalArgumentExceptionIfDirectoryDoesNotExist() throws Exception {
        Exception exception = runAndCatch(IllegalArgumentException.class, new Block() {
            public void run() throws Exception {
                new StoryToDirectoryPrinter(null, new File("FileWhichDoesNotExist"));
            }
        });
       
View Full Code Here

        ensureThat(exception, isNotNull());
    }
   

    public void shouldThrowIllegalArgumentExceptionIfFileIsNotDirectory() throws Exception {
        Exception exception = runAndCatch(IllegalArgumentException.class, new Block() {
            public void run() throws Exception {
                new StoryToDirectoryPrinter(null, new File("FileWhichExists"));
            }
        });
       
View Full Code Here

TOP

Related Classes of org.jbehave.core.Block

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.