Я следовал нижеприведенной странице StackOverflow и написал тестовый пример для класса Application Как протестировать основной класс приложения Spring-boot
Когда я запускаю свой тестовый пример, я получаю следующую ошибку
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'http.client.connection.timeout' in value "${http.client.connection.timeout}"
.....
Я добавил @TestPropertySource ("classpath: test-manifest.yml") в моем тестовом примере.
test-manifest.yml имеет ' http.client.connection.timeout '
Мой тестовый случай
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.mypackage.Application;
@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource("classpath:test-manifest.yml")
@SpringBootTest
public class MainTest {
@Test
public void main() {
Application.main(new String[] {});
}
}
Как заставить это работать?Любая помощь приветствуется.