예제 #1
0
파일: WonTest.java 프로젝트: nubcaker/SEM
  /**
   * Initialize variables for the test process.
   *
   * @throws Exception possible Exception.
   */
  @Before
  public void setUp() throws Exception {
    testWon = new Won(1);
    testWon.tMain = mockedGame;

    when(mockedGame.getGame()).thenReturn(new Game(0, 0, mockedLogger, 1));
  }
예제 #2
0
 public void win() {
   boolean allClicked = true;
   for (int i = 0; i < row; i++) {
     for (int j = 0; j < col; j++) {
       if (flag[i][j] == true && bombs[i][j] == false) {
         allClicked = false;
       }
       if (clicked[i][j] == false) {
         allClicked = false;
         break;
       }
     }
   }
   if (allClicked != false) {
     Won won = new Won();
     won.setLocationRelativeTo(null);
     won.setVisible(true);
     dispose();
   }
 }
예제 #3
0
파일: WonTest.java 프로젝트: nubcaker/SEM
 /**
  * Test whether keyReleased() works correctly. Key: 3.
  *
  * @throws Exception possible Exception.
  */
 @Test
 public void testKeyReleased3() throws Exception {
   testWon.keyReleased(Input.KEY_3, 'a');
 }
예제 #4
0
파일: WonTest.java 프로젝트: nubcaker/SEM
  /**
   * Test whether keyReleased() works correctly. Key: 1.
   *
   * @throws Exception possible Exception.
   */
  @Test
  public void testKeyReleased1() throws Exception {
    testWon.keyReleased(Input.KEY_1, 'a');

    verify(mockedGame).newGame(1);
  }
예제 #5
0
파일: WonTest.java 프로젝트: nubcaker/SEM
 /**
  * Test whether getID() works correctly.
  *
  * @throws Exception possible Exception.
  */
 @Test
 public void testGetID() throws Exception {
   assertEquals(1, testWon.getID());
 }
예제 #6
0
파일: WonTest.java 프로젝트: nubcaker/SEM
 /**
  * Test whether update() works correctly, and thus, does nothing.
  *
  * @throws Exception possible Exception.
  */
 @Test
 public void testUpdate() throws Exception {
   testWon.tExit = true;
   testWon.update(mockedContainer, mockedGame, 0);
 }
예제 #7
0
파일: WonTest.java 프로젝트: nubcaker/SEM
 /**
  * Test whether keyReleased() works correctly. Key: yen.
  *
  * @throws Exception possible Exception.
  */
 @Test
 public void testKeyReleasedDefault() throws Exception {
   testWon.keyReleased(Input.KEY_YEN, 'a');
 }
예제 #8
0
파일: WonTest.java 프로젝트: nubcaker/SEM
  /**
   * Test whether keyReleased() works correctly. Key: space.
   *
   * @throws Exception possible Exception.
   */
  @Test
  public void testKeyReleasedSpace() throws Exception {
    testWon.keyReleased(Input.KEY_SPACE, 'a');

    verify(mockedGame).enterState(5);
  }