|
19 | 19 |
|
20 | 20 | package org.elasticsearch.index;
|
21 | 21 |
|
| 22 | +import com.fasterxml.jackson.core.JsonParseException; |
22 | 23 | import org.apache.lucene.document.NumericDocValuesField;
|
23 | 24 | import org.elasticsearch.Version;
|
24 | 25 | import org.elasticsearch.cluster.metadata.IndexMetaData;
|
|
34 | 35 | import org.elasticsearch.test.ESTestCase;
|
35 | 36 |
|
36 | 37 | import java.io.IOException;
|
| 38 | +import java.io.UncheckedIOException; |
37 | 39 |
|
38 | 40 | import static org.hamcrest.Matchers.containsString;
|
39 | 41 | import static org.hamcrest.Matchers.hasToString;
|
@@ -70,9 +72,15 @@ public void testSlowLogParsedDocumentPrinterSourceToLog() throws IOException {
|
70 | 72 | "test", null, null, source, XContentType.JSON, null);
|
71 | 73 | p = new SlowLogParsedDocumentPrinter(index, pd, 10, true, 3);
|
72 | 74 |
|
73 |
| - assertThat(p.toString(), containsString("_failed_to_convert_[Unrecognized token 'invalid':" |
| 75 | + final UncheckedIOException e = expectThrows(UncheckedIOException.class, p::toString); |
| 76 | + assertThat(e, hasToString(containsString("_failed_to_convert_[Unrecognized token 'invalid':" |
74 | 77 | + " was expecting ('true', 'false' or 'null')\n"
|
75 |
| - + " at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper")); |
| 78 | + + " at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper"))); |
| 79 | + assertNotNull(e.getCause()); |
| 80 | + assertThat(e.getCause(), instanceOf(JsonParseException.class)); |
| 81 | + assertThat(e.getCause(), hasToString(containsString("Unrecognized token 'invalid':" |
| 82 | + + " was expecting ('true', 'false' or 'null')\n" |
| 83 | + + " at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper"))); |
76 | 84 | }
|
77 | 85 |
|
78 | 86 | public void testReformatSetting() {
|
|
0 commit comments