mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 16:59:24 +00:00
refactor: remove code smell java:S5786 (#2159)
https://sonarcloud.io/organizations/iluwatar/rules?open=java%3AS5786&rule_key=java%3AS5786
This commit is contained in:
@@ -39,7 +39,7 @@ import static org.junit.Assert.*;
|
||||
and https://stackoverflow.com/questions/50211433/servlets-unit-testing
|
||||
*/
|
||||
|
||||
public class AppServletTest extends Mockito{
|
||||
class AppServletTest extends Mockito{
|
||||
private String msgPartOne = "<h1>This Server Doesn't Support";
|
||||
private String msgPartTwo = "Requests</h1>\n"
|
||||
+ "<h2>Use a GET request with boolean values for the following parameters<h2>\n"
|
||||
@@ -47,7 +47,7 @@ public class AppServletTest extends Mockito{
|
||||
private String destination = "newsDisplay.jsp";
|
||||
|
||||
@Test
|
||||
public void testDoGet() throws Exception {
|
||||
void testDoGet() throws Exception {
|
||||
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
|
||||
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
|
||||
RequestDispatcher mockDispatcher = Mockito.mock(RequestDispatcher.class);
|
||||
@@ -64,7 +64,7 @@ public class AppServletTest extends Mockito{
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoPost() throws Exception {
|
||||
void testDoPost() throws Exception {
|
||||
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
|
||||
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
@@ -78,7 +78,7 @@ public class AppServletTest extends Mockito{
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoPut() throws Exception {
|
||||
void testDoPut() throws Exception {
|
||||
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
|
||||
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
@@ -92,7 +92,7 @@ public class AppServletTest extends Mockito{
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoDelete() throws Exception {
|
||||
void testDoDelete() throws Exception {
|
||||
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
|
||||
HttpServletResponse mockResp = Mockito.mock(HttpServletResponse.class);
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
|
||||
@@ -30,9 +30,9 @@ import org.mockito.Mockito;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class JavaBeansTest {
|
||||
class JavaBeansTest {
|
||||
@Test
|
||||
public void testDefaultConstructor() {
|
||||
void testDefaultConstructor() {
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean();
|
||||
assertEquals("DEFAULT_NAME", newBean.getName());
|
||||
assertTrue(newBean.isBusinessInterest());
|
||||
@@ -43,7 +43,7 @@ public class JavaBeansTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNameGetterSetter() {
|
||||
void testNameGetterSetter() {
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean();
|
||||
assertEquals("DEFAULT_NAME", newBean.getName());
|
||||
newBean.setName("TEST_NAME_ONE");
|
||||
@@ -51,7 +51,7 @@ public class JavaBeansTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBusinessSetterGetter() {
|
||||
void testBusinessSetterGetter() {
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean();
|
||||
assertTrue(newBean.isBusinessInterest());
|
||||
newBean.setBusinessInterest(false);
|
||||
@@ -59,7 +59,7 @@ public class JavaBeansTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testScienceSetterGetter() {
|
||||
void testScienceSetterGetter() {
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean();
|
||||
assertTrue(newBean.isScienceNewsInterest());
|
||||
newBean.setScienceNewsInterest(false);
|
||||
@@ -67,7 +67,7 @@ public class JavaBeansTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSportsSetterGetter() {
|
||||
void testSportsSetterGetter() {
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean();
|
||||
assertTrue(newBean.isSportsInterest());
|
||||
newBean.setSportsInterest(false);
|
||||
@@ -75,7 +75,7 @@ public class JavaBeansTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWorldSetterGetter() {
|
||||
void testWorldSetterGetter() {
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean();
|
||||
assertTrue(newBean.isWorldNewsInterest());
|
||||
newBean.setWorldNewsInterest(false);
|
||||
@@ -83,7 +83,7 @@ public class JavaBeansTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequestConstructor(){
|
||||
void testRequestConstructor(){
|
||||
HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
|
||||
ClientPropertiesBean newBean = new ClientPropertiesBean((mockReq));
|
||||
assertEquals("DEFAULT_NAME", newBean.getName());
|
||||
|
||||
Reference in New Issue
Block a user