Ejemplo n.º 1
0
  /** Tests if we can open the file, when it exists. */
  @Test
  public void fileConfirmationWhenFileExists() {
    stub.setFileName("etc/data/test.txt");
    presenter.start();
    presenter.fileNameChanged();
    presenter.confirmed();

    assertTrue(loader.isLoaded());
    assertTrue(stub.dataDisplayed());
  }
Ejemplo n.º 2
0
  /** Tests if we receive a confirmation when we attempt to open a file that it doesn't exist. */
  @Test
  public void fileConfirmationWhenFileDoesNotExist() {
    stub.setFileName("RandomName.txt");

    presenter.start();
    presenter.fileNameChanged();
    presenter.confirmed();

    assertFalse(loader.isLoaded());
    assertEquals(1, stub.getMessagesSent());
  }
Ejemplo n.º 3
0
  /**
   * Tests if we receive a confirmation when we attempt to open a file that it's name is null or an
   * empty string.
   */
  @Test
  public void fileConfirmationWhenNameIsNull() {
    stub.setFileName(null);

    presenter.start();
    presenter.fileNameChanged();
    presenter.confirmed();

    assertFalse(loader.isLoaded());
    assertEquals(1, stub.getMessagesSent());
  }