File tree 1 file changed +9
-9
lines changed
1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 22
22
import org .jsoup .nodes .Document ;
23
23
import org .jsoup .nodes .Element ;
24
24
import org .junit .Before ;
25
- import org .junit .Rule ;
26
25
import org .junit .Test ;
27
- import org .junit .rules .ExpectedException ;
28
26
import ru .mystamps .web .tests .Random ;
29
27
import java .util .Locale ;
30
28
34
32
35
33
public class JsoupSiteParserTest implements WithAssertions {
36
34
37
- @ Rule
38
- public ExpectedException thrown = ExpectedException .none ();
39
-
40
35
private JsoupSiteParser parser ;
41
36
42
37
@ Before
@@ -50,10 +45,15 @@ public void init() {
50
45
51
46
@ Test
52
47
public void parseShouldRequireNonBlankPageContent () {
53
- thrown .expect (IllegalArgumentException .class );
54
- thrown .expectMessage ("Page content must be non-blank" );
55
-
56
- parser .parse (nullOrBlank ());
48
+ // given
49
+ // when
50
+ Throwable thrown = catchThrowable (() -> {
51
+ parser .parse (nullOrBlank ());
52
+ });
53
+ // then
54
+ assertThat (thrown )
55
+ .isInstanceOf (IllegalArgumentException .class )
56
+ .hasMessage ("Page content must be non-blank" );
57
57
}
58
58
59
59
@ Test
You can’t perform that action at this time.
0 commit comments