Refactor all Unit & Integration Tests starting a Spring container with SpringRunner to extend STDG's IntegrationTestsSupport.

This commit is contained in:
John Blum
2021-03-30 11:25:08 -07:00
parent 9cdb4ca7f3
commit 0728ee1e21
10 changed files with 36 additions and 15 deletions

View File

@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
import org.springframework.data.gemfire.tests.support.MapBuilder;
import org.springframework.hamcrest.RegexMatcher;
@@ -63,6 +64,7 @@ import lombok.ToString;
* @see org.springframework.boot.autoconfigure.SpringBootApplication
* @see org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
* @see org.springframework.boot.test.context.SpringBootTest
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
* @see org.springframework.test.context.junit4.SpringRunner
* @see org.springframework.test.web.servlet.MockMvc
@@ -79,7 +81,7 @@ import lombok.ToString;
)
@AutoConfigureMockMvc
@SuppressWarnings("unused")
public class MockPersistentSessionAccessSmokeTests {
public class MockPersistentSessionAccessSmokeTests extends IntegrationTestsSupport {
@Autowired
private MockMvc mvc;

View File

@@ -21,4 +21,6 @@ dependencies {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation('org.springframework.data:spring-data-geode-test')
}

View File

@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.test.context.junit4.SpringRunner;
import example.app.model.Contact;
@@ -35,16 +36,14 @@ import example.app.service.ContactsService;
* @author John Blum
* @see org.junit.Test
* @see org.springframework.boot.test.context.SpringBootTest
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.test.context.junit4.SpringRunner
* @see example.app.model.Contact
* @see example.app.repo.ContactRepository
* @see example.app.service.ContactsService
* @since 1.2.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
@SuppressWarnings("unused")
public class DatabaseWithLookAsideCachingApplicationSmokeTests {
public class DatabaseWithLookAsideCachingApplicationSmokeTests extends IntegrationTestsSupport {
@Autowired
private ContactRepository contactRepository;

View File

@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.AbstractRefreshableApplicationContext;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
import org.springframework.geode.distributed.event.ApplicationContextMembershipListener;
import org.springframework.geode.distributed.event.MembershipListenerAdapter;
@@ -45,7 +46,10 @@ import org.springframework.test.context.junit4.SpringRunner;
* @see org.apache.geode.cache.Cache
* @see org.springframework.context.ConfigurableApplicationContext
* @see org.springframework.context.support.AbstractRefreshableApplicationContext
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
* @see org.springframework.geode.distributed.event.ApplicationContextMembershipListener
* @see org.springframework.geode.distributed.event.MembershipListenerAdapter
* @see org.springframework.geode.test.context.TestRefreshableApplicationContextLoader
* @see org.springframework.test.context.ContextConfiguration
* @see org.springframework.test.context.junit4.SpringRunner
@@ -58,7 +62,7 @@ import org.springframework.test.context.junit4.SpringRunner;
loader = TestRefreshableApplicationContextLoader.class
)
@SuppressWarnings({ "unused" })
public class SpringBootApacheGeodePeerCacheApplicationUnitTests {
public class SpringBootApacheGeodePeerCacheApplicationUnitTests extends IntegrationTestsSupport {
@Autowired
private ConfigurableApplicationContext applicationContext;

View File

@@ -26,6 +26,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.data.gemfire.GemfireTemplate;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.WebApplicationContext;
@@ -37,6 +38,7 @@ import org.springframework.web.context.WebApplicationContext;
* @see org.springframework.boot.test.context.SpringBootTest
* @see org.springframework.context.ApplicationContext
* @see org.springframework.data.gemfire.GemfireTemplate
* @see org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport
* @see org.springframework.test.context.junit4.SpringRunner
* @see example.app.InitializerApplication
* @since 1.2.0
@@ -44,7 +46,7 @@ import org.springframework.web.context.WebApplicationContext;
@RunWith(SpringRunner.class)
@SpringBootTest
@SuppressWarnings("unused")
public class InitializerApplicationSmokeTests {
public class InitializerApplicationSmokeTests extends IntegrationTestsSupport {
@Autowired
private ApplicationContext applicationContext;