У меня есть проект Spring Boot, где я использую Mockito для тестирования, но при попытке получить файл свойств
MyPersonalClass.Java (класс обслуживания)
@Service
public class MyPersonalClass {
public void getData() {
Properties runtimeprop = new Properties();
try {
runtimeprop = PropertyManager.getAllProperties("SimplePropertyFile"); // some other property other thatn simplePropertyFile 58 like sun and all
} catch (Exception e) {
log.logError(e);
}
String myProp = runtimeprop.getProperty("source.allow"); // Null
List<String> srclst = new ArrayList<>(Arrays.asList(allowedsrc.split(",")));// getting null Pointer Exception
}
SimplePropertyFile.properties (заданосвойство ниже должно прийти, пока мы запускаем тестовый класс, но я не могу получить
source.allow = PRIMER
source.value = TYPICAL
MypersonalClassTest.java (тестовый файл)
@RunWith(PowerMockRunner.class)
@PrepareForTest({ InquireOfferElementsImpl.class, PropertyManager.class })
//@TestPropertySource(locations = "classpath:SimplePropertyFile.properties")
//@PropertySource("classpath:SimplePropertyFile.properties")
//@TestPropertySource(properties = "Ssource.allow = PRIMER")
public class MypersonalClassTest {
// test code go here
// tested with given above Annotation but nothing is work for me
}
, если какое-либо тело знает о файле свойствиздеваться, пожалуйста, дайте мне знать