/** 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()); }
/** 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()); }
/** 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()); }
/** * 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()); }