I would like to use annotation:
@ContextConfiguration(initializers = ConfigFileApplicationContextInitializer.class,
classes = {EventService.class})
Because I would like to use constant values from application-test.properties
. But when I would like to run test I receive information:
java.lang.IllegalStateException: Failed to load ApplicationContext
Part of the Code:
@RunWith(SpringRunner.class)
@ContextConfiguration(initializers = ConfigFileApplicationContextInitializer.class,
classes = {EventService.class})
@ActiveProfiles("test")
public class FootballPitchCommandToFootballPitchTest {
FootballPitchCommandToFootballPitch converter;
@Value("${FOOTBALL_PITCH_NAME}")
private String footballPitchName ;
@Autowired
EventService eventService;
Should I make a configuration file especialy for the test where I use this annotation? Is there any other way to use application.properties in test classes without annotation @ContextConfiguation?
Thank you for responses
Aucun commentaire:
Enregistrer un commentaire