|
24 | 24 | import java.time.Instant;
|
25 | 25 | import java.time.ZoneId;
|
26 | 26 | import java.time.format.DateTimeFormatter;
|
27 |
| -import java.util.*; |
28 |
| -import java.util.concurrent.*; |
| 27 | +import java.util.ArrayList; |
| 28 | +import java.util.Arrays; |
| 29 | +import java.util.Collections; |
| 30 | +import java.util.List; |
| 31 | +import java.util.Set; |
| 32 | +import java.util.concurrent.BlockingQueue; |
| 33 | +import java.util.concurrent.Callable; |
| 34 | +import java.util.concurrent.CountDownLatch; |
| 35 | +import java.util.concurrent.ExecutorService; |
| 36 | +import java.util.concurrent.Executors; |
| 37 | +import java.util.concurrent.LinkedBlockingQueue; |
| 38 | +import java.util.concurrent.ThreadFactory; |
| 39 | +import java.util.concurrent.TimeUnit; |
29 | 40 | import java.util.concurrent.atomic.LongAdder;
|
30 | 41 | import java.util.function.Consumer;
|
31 | 42 |
|
@@ -187,13 +198,20 @@ public void accept(QueryResult queryResult) {
|
187 | 198 | * see Issue #602
|
188 | 199 | */
|
189 | 200 | @Test
|
190 |
| - public void testCallbackQueryFailureHandling() { |
| 201 | + public void testCallbackQueryFailureHandling() throws Throwable { |
191 | 202 | final AsyncResult<QueryResult> res = new AsyncResult<>();
|
192 | 203 |
|
193 | 204 | this.influxDB.query(new Query("SHOW SERRIES"), res.resultConsumer, res.errorConsumer);
|
194 | 205 |
|
195 |
| - Assertions.assertThrows(InfluxDBException.class, res::result, |
196 |
| - "Malformed query should throw InfluxDBException"); |
| 206 | + try{ |
| 207 | + res.result(); |
| 208 | + Assertions.fail("Malformed query should throw InfluxDBException"); |
| 209 | + } |
| 210 | + catch (InfluxDBException e){ |
| 211 | + Assertions.assertTrue(e.getMessage().matches("Bad Request[\\s-a-zA-Z{}:\",0-9]*error parsing query: " + |
| 212 | + "found SERRIES, expected[\\s-a-zA-Z{}:\",0-9]*"), |
| 213 | + "Error string not expected"); |
| 214 | + } |
197 | 215 | }
|
198 | 216 |
|
199 | 217 | /**
|
|
0 commit comments