I followed the below StackOverflow page and wrote test case for Application class How to test main class of Spring-boot application
When I run my test case I get the following error
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'http.client.connection.timeout' in value "${http.client.connection.timeout}" ..... I have added @TestPropertySource("classpath:test-manifest.yml") in my test case.
test-manifest.yml has 'http.client.connection.timeout'
My Testcase
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[] {}); } } How to make it work? Any help is appreciated.