Created
November 27, 2017 13:18
-
-
Save Hromenique/3317116e87a529a523545d21c0cd5805 to your computer and use it in GitHub Desktop.
Configuração para executar testes com Spring excluíndo classes dos contexto de injeção
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@ComponentScan(basePackages = "br.com.hrom", | |
excludeFilters = { | |
@Filter(type = FilterType.REGEX, pattern = "br.com.hrom.queue.*") | |
}) | |
//@EnableAutoConfiguration and @Enable???Repositories in case of one or more depedencies need database repositories. | |
//Otherwise errors will occurrs when start the container | |
@EnableAutoConfiguration | |
@EnableMongoRepositories(basePackages = "br.com.hrom") | |
public class MyTestConfig { | |
} | |
@RunWith(SpringRunner.class) | |
@SpringBootTest(classes = MyTestConfig.class) | |
@TestPropertySource("classpath:application-tests.properties") | |
public class MyTest { | |
//My tests | |
@Test | |
public void test1(){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment