in jest, we can set the title or name or description for the specific test. For simple example like below:
const sum = require('./sum');
test('adds 1 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
and the test will give output
PASS ./sum.test.js
✓ adds 1 2 to equal 3 (5ms)
you can find more about jest here: https://jestjs.io/docs/getting-started
Then, how to do it in spring? Is that possible? Thanks
CodePudding user response:
Assuming sum method is defined somewhere, here is the code
@Test
@DisplayName("adds 1 2 to equal 3")
void test() {
assertEquals(3, sum(1, 2));
}