Skip to content
Permalink
Browse files

How to use @SpringBootTest on my library submodule

  • Loading branch information...
slem1 committed Oct 19, 2017
1 parent 191eee5 commit ffd8316b00b27ef826ddce4f6d547967e5849b77
@@ -12,5 +12,18 @@
<groupId>fr.sle</groupId>
<artifactId>spring-boot-test-howto-business</artifactId>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

</dependencies>

</project>
@@ -0,0 +1,10 @@
package fr.sle.testhowto;

import org.springframework.stereotype.Component;

/**
* @author slemoine
*/
@Component
public class MyComponent {
}
@@ -0,0 +1,10 @@
package fr.sle.testhowto;

import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* @author slemoine
*/
@SpringBootApplication
public class ApplicationTest {
}
@@ -0,0 +1,24 @@
package fr.sle.testhowto.test;

import fr.sle.testhowto.MyComponent;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
* @author slemoine
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class MyComponentTestClass {

@Autowired
private MyComponent component;

@Test
public void myComponentTestMethod(){

}
}

0 comments on commit ffd8316

Please sign in to comment.
You can’t perform that action at this time.