Skip to content

Commit 69d5fbd

Browse files
author
Maximilian Hippler
committed
Fixed regex in test
1 parent 0254cbc commit 69d5fbd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/test/java/org/influxdb/InfluxDBTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.util.concurrent.TimeUnit;
4040
import java.util.concurrent.atomic.LongAdder;
4141
import java.util.function.Consumer;
42+
import java.util.regex.Pattern;
4243

4344
/**
4445
* Test the InfluxDB API.
@@ -208,9 +209,11 @@ public void testCallbackQueryFailureHandling() throws Throwable {
208209
Assertions.fail("Malformed query should throw InfluxDBException");
209210
}
210211
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");
212+
Pattern errorPattern = Pattern.compile("Bad Request.*error parsing query: found SERRIES, expected.*",
213+
Pattern.DOTALL);
214+
215+
Assertions.assertTrue(errorPattern.matcher(e.getMessage()).matches(),
216+
"Error string \"" + e.getMessage() + "\" does not match error pattern");
214217
}
215218
}
216219

0 commit comments

Comments
 (0)