Test examples
Basic assertions
import org.springframework.stereotype.Service;
@Service
public class SimpleService
{
public String getValue() {
return "a really simple service";
}
}Test written by Diffblue Cover
@SpringBootTest
@RunWith(org.springframework.test.context.junit4.SpringRunner.class)
public class SimpleServiceDiffblueTest {
@Autowired
private SimpleService simpleService;
@Test
public void diffbluetestGetValue() {
// Arrange, Act and Assert
assertEquals("a really simple service", this.simpleService.getValue());
}
}Mocking
Source
Tests written by Diffblue Cover
OS agnostic assertions
Source
Test written by Diffblue Cover
Example containing logic
Source
Test written by Diffblue Cover
Example of complex logic
Source
Tests written by Diffblue Cover
Testing trivial methods
Last updated
Was this helpful?

