Migrate Spring unit tests to spring profiles
Instead of replacing configuration with test configuration on classpath, create test profile and use that. Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -43,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
|
||||
@@ -51,6 +52,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebMvcTest(ConfigController.class)
|
||||
@Slf4j
|
||||
@ActiveProfiles("test")
|
||||
public class ConfigControllerTest
|
||||
{
|
||||
@Autowired
|
||||
|
||||
@@ -49,6 +49,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
@@ -57,6 +58,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebMvcTest(LootTrackerController.class)
|
||||
@Slf4j
|
||||
@ActiveProfiles("test")
|
||||
public class LootTrackerControllerTest
|
||||
{
|
||||
@Autowired
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
# Use in-memory database for tests
|
||||
datasource:
|
||||
runelite:
|
||||
jndiName:
|
||||
driverClassName: org.h2.Driver
|
||||
type: org.h2.jdbcx.JdbcDataSource
|
||||
url: jdbc:h2:mem:runelite
|
||||
runelite-cache:
|
||||
jndiName:
|
||||
driverClassName: org.h2.Driver
|
||||
type: org.h2.jdbcx.JdbcDataSource
|
||||
url: jdbc:h2:mem:cache
|
||||
runelite-tracker:
|
||||
jndiName:
|
||||
driverClassName: org.h2.Driver
|
||||
type: org.h2.jdbcx.JdbcDataSource
|
||||
url: jdbc:h2:mem:xptracker
|
||||
Reference in New Issue
Block a user