@@ -36,8 +36,7 @@ public void testIOError() throws IOException {
3636 server .enqueue (new MockResponse ().setBody (fromResource ("news.json" )).setResponseCode (404 ));
3737
3838 assertThatExceptionOfType (ProxerException .class ).isThrownBy (() -> api .notifications ().news ().build ().execute ())
39- .has (new Condition <Throwable >(e -> ((ProxerException ) e ).getErrorType () == ErrorType .IO ,
40- "IO ErrorType" ));
39+ .has (new Condition <Throwable >(e -> ((ProxerException ) e ).getErrorType () == ErrorType .IO , "IO ErrorType" ));
4140 }
4241
4342 @ Test
@@ -58,26 +57,6 @@ public void testInvalidDataError() throws IOException {
5857 "PARSING ErrorType" ));
5958 }
6059
61- @ Test (timeout = 1000L )
62- public void testCancelledError () throws IOException , InterruptedException {
63- final CountDownLatch lock = new CountDownLatch (1 );
64-
65- server .enqueue (new MockResponse ().setBody (fromResource ("news.json" )));
66-
67- final ProxerCall <List <NewsArticle >> call = api .notifications ().news ().build ();
68-
69- call .enqueue (result -> {
70- // Failed. The lock will never be counted down and timeout.
71- }, exception -> {
72- assertThat (exception .getErrorType ()).isEqualTo (ErrorType .CANCELLED );
73-
74- lock .countDown ();
75- });
76-
77- call .cancel ();
78- lock .await ();
79- }
80-
8160 @ Test
8261 public void testServerError () throws Exception {
8362 server .enqueue (new MockResponse ().setBody (fromResource ("conferences_error.json" )));
@@ -147,11 +126,9 @@ public void testCancel() throws IOException, InterruptedException {
147126 call .enqueue (result -> {
148127 // Failed. The lock will never be counted down and timeout.
149128 }, exception -> {
150- if (exception .getErrorType () == ErrorType .IO ) {
151- lock .countDown ();
152- }
129+ assertThat (exception .getErrorType ()).isEqualTo (ErrorType .CANCELLED );
153130
154- // Failed: Not the exception we want. The lock will never be counted down and timeout.
131+ lock . countDown ();
155132 });
156133
157134 call .cancel ();
0 commit comments