Package com.sandwich.koan.ui

Examples of com.sandwich.koan.ui.AbstractSuitePresenter


public class AbstractSuitePresenterTest extends CommandLineTestCase {

  @Test
  public void testForwardingOneHundredPercentSuccess() throws Exception {
    final int state[] = new int[]{0};
    AbstractSuitePresenter presenter = new AbstractSuitePresenter() {
      public void displayAllSuccess(KoanSuiteResult result) {
        assertEquals(0, state[0]);
        state[0] = 1;
      }
      public void displayChart(KoanSuiteResult result) {
        assertEquals(1, state[0]);
        state[0] = 2;
      }
      public void displayPassingFailing(KoanSuiteResult result) {
        assertEquals(2, state[0]);
        state[0] = 3;
      }
      public void displayHeader(KoanSuiteResult result) {
        assertEquals(3, state[0]);
        state[0] = 4;
      }
      public void displayOneOrMoreFailure(KoanSuiteResult result) {
        fail();
      }
      public void displayError(String error) {
        fail();
      }
      public void displayMessage(String error) {
        fail();
      }
      public void clearMessages() {
        fail();
      }
    };

    KoanSuiteResult kr = new KoanResultBuilder().build();
    presenter.displayResult(kr);
    assertEquals(4, state[0]);
  }
View Full Code Here


  }
 
  @Test
  public void testForwardingOneOrMoreFails() throws Exception {
    final int state[] = new int[]{0};
    AbstractSuitePresenter presenter = new AbstractSuitePresenter() {
      public void displayOneOrMoreFailure(KoanSuiteResult result) {
        assertEquals(0, state[0]);
        state[0] = 1;
      }
      public void displayChart(KoanSuiteResult result) {
        assertEquals(1, state[0]);
        state[0] = 2;
      }
      public void displayPassingFailing(KoanSuiteResult result) {
        assertEquals(2, state[0]);
        state[0] = 3;
      }
      public void displayHeader(KoanSuiteResult result) {
        assertEquals(3, state[0]);
        state[0] = 4;
      }
      public void displayAllSuccess(KoanSuiteResult result) {
        fail();
      }
      public void displayError(String error) {
        fail();
      }
      public void displayMessage(String error) {
        fail();
      }
      public void clearMessages() {
        fail();
      }
    };

    KoanSuiteResult kr = new KoanResultBuilder().remainingCases(Arrays.asList(OneFailingKoan.class.getSimpleName())
      ).methodResult(new KoanMethodResult(KoanMethod.getInstance("", OneFailingKoan.class.getDeclaredMethods()[0]),
          "", "")).build();
    presenter.displayResult(kr);
    assertEquals(4, state[0]);
  }
View Full Code Here

public class AbstractSuitePresenterTest {

  @Test
  public void testForwardingOneHundredPercentSuccess() throws Exception {
    final int state[] = new int[]{0};
    AbstractSuitePresenter presenter = new AbstractSuitePresenter() {
      public void displayAllSuccess(KoanSuiteResult result) {
        assertEquals(0, state[0]);
        state[0] = 1;
      }
      public void displayChart(KoanSuiteResult result) {
        assertEquals(1, state[0]);
        state[0] = 2;
      }
      public void displayPassingFailing(KoanSuiteResult result) {
        assertEquals(2, state[0]);
        state[0] = 3;
      }
      public void displayHeader(KoanSuiteResult result) {
        assertEquals(3, state[0]);
        state[0] = 4;
      }
      public void displayOneOrMoreFailure(KoanSuiteResult result) {
        fail();
      }
    };

    KoanSuiteResult kr = new KoanResultBuilder().build();
    presenter.displayResult(kr);
    assertEquals(4, state[0]);
  }
View Full Code Here

  }
 
  @Test
  public void testForwardingOneOrMoreFails() throws Exception {
    final int state[] = new int[]{0};
    AbstractSuitePresenter presenter = new AbstractSuitePresenter() {
      public void displayOneOrMoreFailure(KoanSuiteResult result) {
        assertEquals(0, state[0]);
        state[0] = 1;
      }
      public void displayChart(KoanSuiteResult result) {
        assertEquals(1, state[0]);
        state[0] = 2;
      }
      public void displayPassingFailing(KoanSuiteResult result) {
        assertEquals(2, state[0]);
        state[0] = 3;
      }
      public void displayHeader(KoanSuiteResult result) {
        assertEquals(3, state[0]);
        state[0] = 4;
      }
      public void displayAllSuccess(KoanSuiteResult result) {
        fail();
      }
    };

    KoanSuiteResult kr = new KoanResultBuilder().remainingCases(Arrays.asList(OneFailingKoan.class.getSimpleName())
      ).methodResult(new KoanMethodResult(KoanMethod.getInstance("", OneFailingKoan.class.getDeclaredMethods()[0]),
          "", "")).build();
    presenter.displayResult(kr);
    assertEquals(4, state[0]);
  }
View Full Code Here

TOP

Related Classes of com.sandwich.koan.ui.AbstractSuitePresenter

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.