Package org.gnubridge.presentation.gui

Examples of org.gnubridge.presentation.gui.MainController


public class MainControllerTest extends TestCase {
  public void testWhenBiddingStartsVulnerabilityIsSetOnBiddingView() {
    MockMainView mw = new MockMainView("gnubridge");
    ViewFactory.setMockMainView(mw);
    assertFalse("precondition", ((MockBiddingView) mw.getBiddingView()).isVulnerabilitySet());
    new MainController();
    assertTrue(((MockBiddingView) mw.getBiddingView()).isVulnerabilitySet());
  }
View Full Code Here


  }

  public void testWhenGameStartsScoreIsSetOnDealView() {
    MockMainView mw = new MockMainView("gnubridge");
    ViewFactory.setMockMainView(mw);
    MainController mainController = new MainController();
    mainController.getBiddingController().placeBid(7, "NT");
    assertFalse("precondition", ((MockDealView) mw.getDealView()).isStartingScoreSet());
    mainController.playGame();
    assertTrue(((MockDealView) mw.getDealView()).isStartingScoreSet());
  }
View Full Code Here

    MockMainView mw = new MockMainView("gnubridge");
    ViewFactory.setMockMainView(mw);
    MockScoringTracker mockTracker = new MockScoringTracker();
    ScoringTracker.setInstance(mockTracker);

    MainController mainController = new MainController();
    mainController.getBiddingController().placeBid(7, "NT");
    mainController.playGame();
    assertEquals("initial scoring tracker not obtained through factory method", mockTracker, ((MockDealView) mw
        .getDealView()).getScoringTracker());

    mainController.newGame();
    mainController.getBiddingController().placeBid(7, "NT");
    mainController.playGame();
    assertEquals("score was not preserved in between games", mockTracker, ((MockDealView) mw.getDealView())
        .getScoringTracker());

  }
View Full Code Here

  public void testWhenGameStartsVulnerabilityOnScoringTrackerIsReset() {
    MockScoringTracker mockTracker = new MockScoringTracker();
    ScoringTracker.setInstance(mockTracker);
    assertNull("precondition", mockTracker.getUsThemVulnerability());
    new MainController();
    assertNotNull((mockTracker.getUsThemVulnerability()));
  }
View Full Code Here

  }

  public void testNewGameResetsVulnerabilityOnScoringTrackerIsReset() {
    MockScoringTracker mockTracker = new MockScoringTracker();
    ScoringTracker.setInstance(mockTracker);
    MainController mainController = new MainController();
    UsThemVulnerability initialVulnerability = mockTracker.getUsThemVulnerability();
    assertSame("precondition", initialVulnerability, mockTracker.getUsThemVulnerability());
    mainController.newGame();
    assertNotSame(initialVulnerability, mockTracker.getUsThemVulnerability());
  }
View Full Code Here

  private static void buildGui() throws InterruptedException, InvocationTargetException {
    SwingUtilities.invokeAndWait(new Runnable() {
      public void run() {
        Deal.setPreInitializedGame(constructGame());
        MainController controller = new MainController();
        controller.getBiddingController().getAuction().bid(new Bid(1, NoTrump.i()));
        controller.getBiddingController().getAuction().bid(new Pass());
        controller.getBiddingController().getAuction().bid(new Pass());
        controller.getBiddingController().getAuction().bid(new Pass());
        controller.getBiddingController().playGame();
      }

    });

  }
View Full Code Here

TOP

Related Classes of org.gnubridge.presentation.gui.MainController

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.