mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 22:59:43 +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,15 +24,14 @@
|
||||
*/
|
||||
package com.iluwatar.page.controller;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
|
||||
/**
|
||||
* Application test
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Application test */
|
||||
public class AppTest {
|
||||
@Test
|
||||
void shouldExecuteApplicationWithoutException() {
|
||||
assertDoesNotThrow(() -> App.main(new String[]{}));
|
||||
assertDoesNotThrow(() -> App.main(new String[] {}));
|
||||
}
|
||||
}
|
||||
|
||||
+4
-7
@@ -24,19 +24,16 @@
|
||||
*/
|
||||
package com.iluwatar.page.controller;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributesModelMap;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Test for Signup Controller
|
||||
*/
|
||||
/** Test for Signup Controller */
|
||||
public class SignupControllerTest {
|
||||
|
||||
/**
|
||||
* Verify if user can sign up and redirect to user page
|
||||
*/
|
||||
/** Verify if user can sign up and redirect to user page */
|
||||
@Test
|
||||
void testSignup() {
|
||||
var controller = new SignupController();
|
||||
|
||||
@@ -24,16 +24,13 @@
|
||||
*/
|
||||
package com.iluwatar.page.controller;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* Test for Signup Model
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** Test for Signup Model */
|
||||
public class SignupModelTest {
|
||||
/**
|
||||
* Verify if a user can set a name properly
|
||||
*/
|
||||
/** Verify if a user can set a name properly */
|
||||
@Test
|
||||
void testSetName() {
|
||||
SignupModel model = new SignupModel();
|
||||
@@ -41,9 +38,7 @@ public class SignupModelTest {
|
||||
assertEquals("Lily", model.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a user can set an email properly
|
||||
*/
|
||||
/** Verify if a user can set an email properly */
|
||||
@Test
|
||||
void testSetEmail() {
|
||||
SignupModel model = new SignupModel();
|
||||
@@ -51,9 +46,7 @@ public class SignupModelTest {
|
||||
assertEquals("Lily@email", model.getEmail());
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a user can set a password properly
|
||||
*/
|
||||
/** Verify if a user can set a password properly */
|
||||
@Test
|
||||
void testSetPassword() {
|
||||
SignupModel model = new SignupModel();
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
*/
|
||||
package com.iluwatar.page.controller;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -31,9 +35,6 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest
|
||||
@@ -41,17 +42,13 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
public class UserControllerTest {
|
||||
private UserController userController;
|
||||
|
||||
@Autowired
|
||||
MockMvc mockMvc;
|
||||
@Autowired MockMvc mockMvc;
|
||||
|
||||
/**
|
||||
* Verify if view and model are directed properly
|
||||
*/
|
||||
/** Verify if view and model are directed properly */
|
||||
@Test
|
||||
void testGetUserPath () throws Exception {
|
||||
this.mockMvc.perform(get("/user")
|
||||
.param("name", "Lily")
|
||||
.param("email", "Lily@email.com"))
|
||||
void testGetUserPath() throws Exception {
|
||||
this.mockMvc
|
||||
.perform(get("/user").param("name", "Lily").param("email", "Lily@email.com"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(model().attribute("name", "Lily"))
|
||||
.andExpect(model().attribute("email", "Lily@email.com"))
|
||||
|
||||
@@ -29,9 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class UserModelTest {
|
||||
/**
|
||||
* Verify if a user can set a name properly
|
||||
*/
|
||||
/** Verify if a user can set a name properly */
|
||||
@Test
|
||||
void testSetName() {
|
||||
UserModel model = new UserModel();
|
||||
@@ -39,9 +37,7 @@ public class UserModelTest {
|
||||
assertEquals("Lily", model.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a user can set an email properly
|
||||
*/
|
||||
/** Verify if a user can set an email properly */
|
||||
@Test
|
||||
void testSetEmail() {
|
||||
UserModel model = new UserModel();
|
||||
|
||||
Reference in New Issue
Block a user