Examples of EasyMockTemplate


Examples of org.fest.mocks.EasyMockTemplate

  }

  @Test
  public void should_take_screenshot_if_test_fails_and_is_GUI_test() throws Exception {
    setUpUsing("failedGUITest");
    new EasyMockTemplate(notifier, screenshotTaker) {
      protected void expectations() {
        screenshotTaker.saveScreenshot(testInfo.screenshotFileName());
        expectLastCall().once();
        reportMatcherForFailure();
        expectNotifierToFireTestFailure();
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

  }

  @Test
  public void should_not_take_screenshot_if_test_fails_and_is_not_GUI_test() throws Exception {
    setUpUsing("failedNonGUITest");
    new EasyMockTemplate(notifier, screenshotTaker) {
      protected void expectations() {
        reportMatcherForFailure();
        expectNotifierToFireTestFailure();
      }
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

    failure = new Failure(description, cause);
  }

  @Test
  public void shouldNotifyWhenAddingFailure() {
    new EasyMockTemplate(delegate, notifier) {
      protected void expectations() {
        expect(delegate.getDescription()).andReturn(description);
        reportMatcher(new FailureMatcher(failure));
        notifier.fireTestFailure(failure);
        expectLastCall().once();
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

*/
public class InnerRunner_runUnprotected_Test extends InnerRunner_TestCase {

  @Test
  public void should_call_delegate_when_running_unprotected() {
    new EasyMockTemplate(delegate, notifier) {
      protected void expectations() {
        delegate.doRun(notifier);
        expectLastCall().once();
      }

View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

  }

  @Test
  public void should_not_create_output_folder_if_it_already_exists() {
    assertThat(new File(parentPath)).exists();
    new EasyMockTemplate(context) {
      @Override protected void expectations() {
        expect(context.getOutputDirectory()).andReturn(parentPath);
      }

      @Override protected void codeToTest() {
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

  }

  @Test
  public void should_create_output_folder_if_it_does_not_exist() {
    assertThat(new File(path)).doesNotExist();
    new EasyMockTemplate(context) {
      @Override protected void expectations() {
        expect(context.getOutputDirectory()).andReturn(path);
      }

      @Override protected void codeToTest() {
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

    }.run();
  }

  @Test(expected = FilesException.class)
  public void should_throw_error_if_output_folder_cannot_be_created() {
    new EasyMockTemplate(context) {
      @Override protected void expectations() {
        expect(context.getOutputDirectory()).andReturn("zz:-//");
      }

      @Override protected void codeToTest() {
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

  }

  @Test
  public void should_add_screenshot_element_test_is_GUI_test() {
    final BufferedImage image = new BufferedImage(10, 10, TYPE_BYTE_BINARY);
    new EasyMockTemplate(screenshotTaker, guiTestRecognizer) {
      @Override protected void expectations() {
        expect(guiTestRecognizer.isGUITest(testClassNameFrom(test), testMethodNameFrom(test))).andReturn(true);
        expect(screenshotTaker.takeDesktopScreenshot()).andReturn(image);
      }
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

    }.run();
  }

  @Test
  public void should_not_add_screenshot_element_test_is_not_GUI_test() {
    new EasyMockTemplate(screenshotTaker, guiTestRecognizer) {
      @Override protected void expectations() {
        expect(guiTestRecognizer.isGUITest(testClassNameFrom(test), testMethodNameFrom(test))).andReturn(false);
      }

      @Override protected void codeToTest() {
View Full Code Here

Examples of org.fest.mocks.EasyMockTemplate

    encoded = "Hello";
  }

  @Test
  public void should_not_rethrow_error() {
    new EasyMockTemplate(decoder) {
      @Override protected void expectations() throws Throwable {
        expect(decoder.decodeBase64(encoded)).andThrow(thrownOnPurpose());
      }

      @Override protected void codeToTest() {
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.