prevent test from trying to use vaadin context
This commit is contained in:
parent
e6ad2a2899
commit
886f978f93
2 changed files with 5 additions and 4 deletions
|
@ -16,8 +16,7 @@
|
||||||
package com.faendir.acra.liquibase;
|
package com.faendir.acra.liquibase;
|
||||||
|
|
||||||
import com.faendir.acra.BackendApplication;
|
import com.faendir.acra.BackendApplication;
|
||||||
import com.faendir.acra.liquibase.ChangeAwareSpringLiquibase;
|
import com.faendir.acra.security.VaadinSessionSecurityContextHolderStrategy;
|
||||||
import com.faendir.acra.liquibase.LiquibaseChangePostProcessor;
|
|
||||||
import liquibase.exception.LiquibaseException;
|
import liquibase.exception.LiquibaseException;
|
||||||
import liquibase.integration.spring.SpringLiquibase;
|
import liquibase.integration.spring.SpringLiquibase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -47,7 +46,7 @@ import java.util.List;
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
|
||||||
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
|
||||||
@ComponentScan(basePackageClasses = BackendApplication.class, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = SpringLiquibase.class))
|
@ComponentScan(basePackageClasses = BackendApplication.class, excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = SpringLiquibase.class), @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = VaadinSessionSecurityContextHolderStrategy.class)})
|
||||||
@ImportAutoConfiguration(exclude = {LiquibaseAutoConfiguration.class, EmbeddedDataSourceConfiguration.class})
|
@ImportAutoConfiguration(exclude = {LiquibaseAutoConfiguration.class, EmbeddedDataSourceConfiguration.class})
|
||||||
public abstract class LiquibaseTest {
|
public abstract class LiquibaseTest {
|
||||||
@Autowired ResourceLoader resourceLoader;
|
@Autowired ResourceLoader resourceLoader;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package com.faendir.acra.rest;
|
package com.faendir.acra.rest;
|
||||||
|
|
||||||
import com.faendir.acra.model.App;
|
import com.faendir.acra.model.App;
|
||||||
|
import com.faendir.acra.security.VaadinSessionSecurityContextHolderStrategy;
|
||||||
import com.faendir.acra.service.DataService;
|
import com.faendir.acra.service.DataService;
|
||||||
import com.faendir.acra.service.UserService;
|
import com.faendir.acra.service.UserService;
|
||||||
import junit.framework.AssertionFailedError;
|
import junit.framework.AssertionFailedError;
|
||||||
|
@ -28,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.FilterType;
|
||||||
import org.springframework.mock.web.MockMultipartFile;
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
import org.springframework.security.test.context.support.WithMockUser;
|
import org.springframework.security.test.context.support.WithMockUser;
|
||||||
|
@ -51,7 +53,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
* @since 26.06.18
|
* @since 26.06.18
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@WebMvcTest(controllers = RestReportInterface.class, includeFilters = @ComponentScan.Filter(classes = EnableWebSecurity.class))
|
@WebMvcTest(controllers = RestReportInterface.class, includeFilters = @ComponentScan.Filter(classes = EnableWebSecurity.class), excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = VaadinSessionSecurityContextHolderStrategy.class))
|
||||||
@WithMockUser(roles = {"REPORTER", "USER"})
|
@WithMockUser(roles = {"REPORTER", "USER"})
|
||||||
public class RestReportInterfaceTest {
|
public class RestReportInterfaceTest {
|
||||||
@MockBean UserService userService;
|
@MockBean UserService userService;
|
||||||
|
|
Loading…
Reference in a new issue