Beispiel #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());
  }
Beispiel #2
0
  /** Tests if the name of the file changes. */
  @Test
  public void updateFileNameToLoader() {
    String EXPECTED_FILE = "Stamatis";
    stub.setFileName(EXPECTED_FILE);

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

    assertEquals(EXPECTED_FILE, loader.getFileName());
  }
Beispiel #3
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());
  }
Beispiel #4
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());
  }