File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
assertj/src/test/java/com/geekyhacker/assertj Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .geekyhacker .assertj ;
2
2
3
3
import static org .assertj .core .api .Assertions .assertThat ;
4
+ import static org .assertj .core .api .Assertions .assertThatCode ;
4
5
import static org .assertj .core .api .Assertions .assertThatThrownBy ;
6
+ import static org .junit .jupiter .api .Assertions .assertDoesNotThrow ;
5
7
import static org .junit .jupiter .api .Assertions .assertThrows ;
6
8
7
9
import org .junit .jupiter .api .Test ;
@@ -24,6 +26,12 @@ void shouldReturnUserByUsername() throws UserNotFoundException {
24
26
assertThat (result ).isEqualTo (expected );
25
27
}
26
28
29
+ @ Test
30
+ void shouldNotThrowExceptionWhenGettingUserByUsername () {
31
+ assertDoesNotThrow (() -> userRepository .findByUsername ("test" ));
32
+ assertThatCode (() -> userRepository .findByUsername ("test" )).doesNotThrowAnyException ();
33
+ }
34
+
27
35
@ Test
28
36
void shouldThrowUserNotFoundException () {
29
37
assertThatThrownBy (() -> userRepository .findByUsername ("nonExistenceUsername" ))
You can’t perform that action at this time.
0 commit comments