File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 2222import org .jsoup .nodes .Document ;
2323import org .jsoup .nodes .Element ;
2424import org .junit .Before ;
25- import org .junit .Rule ;
2625import org .junit .Test ;
27- import org .junit .rules .ExpectedException ;
2826import ru .mystamps .web .tests .Random ;
2927import java .util .Locale ;
3028
3432
3533public class JsoupSiteParserTest implements WithAssertions {
3634
37- @ Rule
38- public ExpectedException thrown = ExpectedException .none ();
39-
4035 private JsoupSiteParser parser ;
4136
4237 @ Before
@@ -50,10 +45,15 @@ public void init() {
5045
5146 @ Test
5247 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" );
5757 }
5858
5959 @ Test
You can’t perform that action at this time.
0 commit comments