|
19 | 19 | import static org.mockito.Mockito.never;
|
20 | 20 | import static org.mockito.Mockito.verify;
|
21 | 21 | import static org.mockito.Mockito.when;
|
| 22 | +import static org.opensearch.core.xcontent.MediaTypeParserRegistry.setDefaultMediaType; |
22 | 23 | import static org.opensearch.sql.opensearch.client.OpenSearchClient.META_CLUSTER_NAME;
|
23 | 24 | import static org.opensearch.sql.opensearch.data.type.OpenSearchDataType.MappingType;
|
24 | 25 |
|
|
34 | 35 | import lombok.SneakyThrows;
|
35 | 36 | import org.apache.commons.lang3.reflect.FieldUtils;
|
36 | 37 | import org.apache.lucene.search.TotalHits;
|
| 38 | +import org.junit.jupiter.api.BeforeAll; |
37 | 39 | import org.junit.jupiter.api.BeforeEach;
|
38 | 40 | import org.junit.jupiter.api.DisplayNameGeneration;
|
39 | 41 | import org.junit.jupiter.api.DisplayNameGenerator;
|
@@ -101,6 +103,11 @@ void setUp() {
|
101 | 103 | client = new OpenSearchRestClient(restClient);
|
102 | 104 | }
|
103 | 105 |
|
| 106 | + @BeforeAll |
| 107 | + static void setUpJSON() { |
| 108 | + setDefaultMediaType(XContentType.JSON); |
| 109 | + } |
| 110 | + |
104 | 111 | @Test
|
105 | 112 | void is_index_exist() throws IOException {
|
106 | 113 | when(restClient.indices()
|
@@ -142,7 +149,6 @@ void create_index() throws IOException {
|
142 | 149 | @Test
|
143 | 150 | void create_index_with_IOException() throws IOException {
|
144 | 151 | when(restClient.indices().create(any(), any())).thenThrow(IOException.class);
|
145 |
| - |
146 | 152 | assertThrows(IllegalStateException.class,
|
147 | 153 | () -> client.createIndex("test", ImmutableMap.of()));
|
148 | 154 | }
|
|
0 commit comments