Значения не загружаются из файла свойств в JUnit - PullRequest
0 голосов
/ 10 ноября 2018

Это мой тестовый файл, и я не могу ввести значения из файла свойств

@RunWith(MockitoJUnitRunner.class)
@ContextConfiguration(classes = VersionResourceImplTest.myProp.class)
@TestPropertySource(properties = {"ra.bank.app.version=TestVersion"})
public class VersionResourceImplTest {

    @Value("${ra.bank.app.version}")
    private String applicationVersion;

    @Test
    public void testVersion() {
        Assert.assertEquals("TestVersion", applicationVersion);
    }

    @Configuration
    public static class myProp{
        @Bean
        public static PropertySourcesPlaceholderConfigurer propertiesResolver()
        {
            return new PropertySourcesPlaceholderConfigurer();
        }
    }
}

Получение ошибки: Неудачные тесты:

VersionResourceImplTest.testVersion:36 expected:<TestVersion> but was:<null>
Not able to fetch values from property file
...