Nuclos unit test: JUnit, TestNG, Spring, SpringJUnit4ClassRunner, AbstractTestNGSpringContextTests, Mockito, @Autowired, ReflectionTestUtils. |
Language: Deutsch · English
Unit tests in Nuclos – JUnit and TestNG with a Spring context, ReflectionTestUtils, Mockito and @Autowired.
Auf dieser Seite |
Nuclos supports classic unit tests. A unit test checks a single method/class independently of the rest of the code – ideal for calculations. In the build and CI process all tests run automatically.
testng.xml suites).Nuclos tests can use Spring to inject beans and load the context:
| Approach | Description |
|---|---|
SpringJUnit4ClassRunner | JUnit test with a Spring context. |
AbstractTestNGSpringContextTests | TestNG test with a Spring context. |
ReflectionTestUtils | sets private fields for tests. |
@Autowired / @Configurable | injection into test or domain objects. |
| Mockito / Springockito | mocking dependencies in combination with Spring. |
The most extensive examples are in the FDM project (Nuclos staff only). This page gives everyone else an overview of what is possible. |