merge with master
This commit is contained in:
commit
d2343acc2d
@ -0,0 +1,10 @@
|
|||||||
|
package com.plannaplan.controllers;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
|
public abstract class AbstractControllerTest {
|
||||||
|
@Autowired
|
||||||
|
protected WebApplicationContext webApplicationContext;
|
||||||
|
|
||||||
|
}
|
@ -12,7 +12,6 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
|
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
|
||||||
@ -21,14 +20,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class AssignmentsControllerTest {
|
public class AssignmentsControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
private static final String ASSIGFNMENTS_ENDPOINT = "/api/v1/assignments/getCurrentAssignments";
|
private static final String ASSIGFNMENTS_ENDPOINT = "/api/v1/assignments/getCurrentAssignments";
|
||||||
private static final String TEST_MAIL = "notexistingassignmentuser@mail.domain";
|
private static final String TEST_MAIL = "notexistingassignmentuser@mail.domain";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService service;
|
private UserService service;
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
@ -26,10 +25,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class CommisionControllerTest {
|
public class CommisionControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService service;
|
private UserService service;
|
||||||
|
@ -20,20 +20,16 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class ConfigControllerTest {
|
public class ConfigControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
private static final String FILE_NAME = "Zajecia.xlsx";
|
private static final String FILE_NAME = "Zajecia.xlsx";
|
||||||
private static final String CONFIG_ENDPOINT = "/api/v1/configurator/config";
|
private static final String CONFIG_ENDPOINT = "/api/v1/configurator/config";
|
||||||
private static final String TEST_MAIL = "notexisting@mail.domain";
|
private static final String TEST_MAIL = "notexisting@mail.domain";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService service;
|
private UserService service;
|
||||||
|
|
||||||
|
@ -2,13 +2,11 @@ package com.plannaplan.controllers;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
@ -16,14 +14,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class CoursesControllerTest {
|
public class CoursesControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
private static final String COURSES_ENDPOINT = "/api/v1/courses/getCourses";
|
private static final String COURSES_ENDPOINT = "/api/v1/courses/getCourses";
|
||||||
private static final String COURSESGROUPS_ENDPOINT = "/api/v1/courses/getCoursesWithGroups";
|
private static final String COURSESGROUPS_ENDPOINT = "/api/v1/courses/getCoursesWithGroups";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnAllCoursesOk() throws Exception {
|
public void shouldReturnAllCoursesOk() throws Exception {
|
||||||
|
|
||||||
|
@ -2,13 +2,11 @@ package com.plannaplan.controllers;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
@ -16,12 +14,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class GroupControllerTest {
|
public class GroupControllerTest extends AbstractControllerTest {
|
||||||
private static final String GROUPS_BY_COURSE_ENDPOINT = "/api/v1/groups/getCourseGroups";
|
private static final String GROUPS_BY_COURSE_ENDPOINT = "/api/v1/groups/getCourseGroups";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldFailWithNoParaeter() throws Exception {
|
public void shouldFailWithNoParaeter() throws Exception {
|
||||||
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
|
MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
|
||||||
|
@ -3,13 +3,11 @@ package com.plannaplan.controllers;
|
|||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
@ -17,10 +15,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class TokenControllerTest {
|
public class TokenControllerTest extends AbstractControllerTest {
|
||||||
private final String TOKEN_ENDPOINT = "/token";
|
private final String TOKEN_ENDPOINT = "/token";
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldFailWithNoParameter() throws Exception {
|
public void shouldFailWithNoParameter() throws Exception {
|
||||||
|
@ -12,7 +12,6 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.web.servlet.MockMvc;
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
|
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
|
||||||
@ -21,12 +20,9 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration
|
@ContextConfiguration
|
||||||
public class UsersControllerTest {
|
public class UsersControllerTest extends AbstractControllerTest {
|
||||||
private static final String ENDPOINT = "/api/v1/users/searchForStudents";
|
private static final String ENDPOINT = "/api/v1/users/searchForStudents";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private WebApplicationContext webApplicationContext;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService service;
|
private UserService service;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user