mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-20 07:26:49 +00:00
deps: Refactor dependencies (#3224)
* remove spring dep move junit, logging, mockito under dep mgmt * upgrade anti-corruption-layer deps * async method invocation * balking, bloc * bridge to bytecode * caching * callback - cqrs * component - health check * hexagonal - metadata mapping * rest of the patterns * remove checkstyle, take spotless into use
This commit is contained in:
@@ -24,18 +24,15 @@
|
||||
*/
|
||||
package com.iluwatar.model.view.presenter;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Application test */
|
||||
class AppTest {
|
||||
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -28,10 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* FileLoaderTest
|
||||
*
|
||||
*/
|
||||
/** FileLoaderTest */
|
||||
class FileLoaderTest {
|
||||
|
||||
@Test
|
||||
@@ -40,5 +37,4 @@ class FileLoaderTest {
|
||||
fileLoader.setFileName("non-existing-file");
|
||||
assertNull(fileLoader.loadData());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+11
-17
@@ -27,25 +27,19 @@ package com.iluwatar.model.view.presenter;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* FileSelectorJframeTest
|
||||
*
|
||||
*/
|
||||
/** FileSelectorJframeTest */
|
||||
class FileSelectorJframeTest {
|
||||
|
||||
/**
|
||||
* Tests if the jframe action event is triggered without any exception.
|
||||
*/
|
||||
@Test
|
||||
void testActionEvent() {
|
||||
assertDoesNotThrow(() ->{
|
||||
FileSelectorJframe jFrame = new FileSelectorJframe();
|
||||
ActionEvent action = new ActionEvent("dummy", 1, "dummy");
|
||||
jFrame.actionPerformed(action);
|
||||
});
|
||||
}
|
||||
|
||||
/** Tests if the jframe action event is triggered without any exception. */
|
||||
@Test
|
||||
void testActionEvent() {
|
||||
assertDoesNotThrow(
|
||||
() -> {
|
||||
FileSelectorJframe jFrame = new FileSelectorJframe();
|
||||
ActionEvent action = new ActionEvent("dummy", 1, "dummy");
|
||||
jFrame.actionPerformed(action);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+9
-28
@@ -38,24 +38,16 @@ import org.junit.jupiter.api.Test;
|
||||
*/
|
||||
class FileSelectorPresenterTest {
|
||||
|
||||
/**
|
||||
* The Presenter component.
|
||||
*/
|
||||
/** The Presenter component. */
|
||||
private FileSelectorPresenter presenter;
|
||||
|
||||
/**
|
||||
* The View component, implemented this time as a Stub!!!
|
||||
*/
|
||||
/** The View component, implemented this time as a Stub!!! */
|
||||
private FileSelectorStub stub;
|
||||
|
||||
/**
|
||||
* The Model component.
|
||||
*/
|
||||
/** The Model component. */
|
||||
private FileLoader loader;
|
||||
|
||||
/**
|
||||
* Initializes the components of the test case.
|
||||
*/
|
||||
/** Initializes the components of the test case. */
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
this.stub = new FileSelectorStub();
|
||||
@@ -64,9 +56,7 @@ class FileSelectorPresenterTest {
|
||||
presenter.setLoader(loader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the Presenter was successfully connected with the View.
|
||||
*/
|
||||
/** Tests if the Presenter was successfully connected with the View. */
|
||||
@Test
|
||||
void wiring() {
|
||||
presenter.start();
|
||||
@@ -75,9 +65,7 @@ class FileSelectorPresenterTest {
|
||||
assertTrue(stub.isOpened());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the name of the file changes.
|
||||
*/
|
||||
/** Tests if the name of the file changes. */
|
||||
@Test
|
||||
void updateFileNameToLoader() {
|
||||
var expectedFile = "Stamatis";
|
||||
@@ -105,9 +93,7 @@ class FileSelectorPresenterTest {
|
||||
assertEquals(1, stub.getMessagesSent());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if we receive a confirmation when we attempt to open a file that it doesn't exist.
|
||||
*/
|
||||
/** Tests if we receive a confirmation when we attempt to open a file that it doesn't exist. */
|
||||
@Test
|
||||
void fileConfirmationWhenFileDoesNotExist() {
|
||||
stub.setFileName("RandomName.txt");
|
||||
@@ -120,9 +106,7 @@ class FileSelectorPresenterTest {
|
||||
assertEquals(1, stub.getMessagesSent());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if we can open the file, when it exists.
|
||||
*/
|
||||
/** Tests if we can open the file, when it exists. */
|
||||
@Test
|
||||
void fileConfirmationWhenFileExists() {
|
||||
stub.setFileName("etc/data/test.txt");
|
||||
@@ -134,9 +118,7 @@ class FileSelectorPresenterTest {
|
||||
assertTrue(stub.dataDisplayed());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the view closes after cancellation.
|
||||
*/
|
||||
/** Tests if the view closes after cancellation. */
|
||||
@Test
|
||||
void cancellation() {
|
||||
presenter.start();
|
||||
@@ -155,5 +137,4 @@ class FileSelectorPresenterTest {
|
||||
assertFalse(loader.isLoaded());
|
||||
assertFalse(stub.dataDisplayed());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user