Removed some unnecessary files.
This commit is contained in:
parent
47907cb91b
commit
9f00e00f34
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>java-design-patterns</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>com.iluwatar</groupId>
|
||||
<artifactId>observer</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>observer</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,120 +0,0 @@
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* This test case is responsible for testing our application
|
||||
* by taking advantage of the Model-View-Controller architectural pattern.
|
||||
*/
|
||||
public class FileselectorPresenterTest {
|
||||
|
||||
/**
|
||||
* The Presenter component.
|
||||
*/
|
||||
private FileSelectorPresenter presenter;
|
||||
|
||||
/**
|
||||
* The View component, implemented this time as a Stub!!!
|
||||
*/
|
||||
private FileSelectorStub stub;
|
||||
|
||||
/**
|
||||
* The Model component.
|
||||
*/
|
||||
private FileLoader loader;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the components of the test case.
|
||||
*/
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.stub = new FileSelectorStub();
|
||||
this.loader = new FileLoader();
|
||||
presenter = new FileSelectorPresenter(this.stub);
|
||||
presenter.setLoader(loader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the Presenter was successfully connected with the View.
|
||||
*/
|
||||
@Test
|
||||
public void wiring() {
|
||||
presenter.start();
|
||||
|
||||
assertNotNull(stub.getPresenter());
|
||||
assertTrue(stub.isOpened());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'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());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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 view closes after cancellation.
|
||||
*/
|
||||
@Test
|
||||
public void cancellation() {
|
||||
presenter.start();
|
||||
presenter.cancelled();
|
||||
|
||||
assertFalse(stub.isOpened());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user