Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kushagraThapar committed Mar 24, 2023
1 parent 0bfe13e commit 4c7a3be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void structWithEmptyArrayToMap() {
.field("array_of_boolean", SchemaBuilder.array(Schema.BOOLEAN_SCHEMA).build());

Struct struct = new Struct(schema)
.put("array_of_boolean", Map.of());
.put("array_of_boolean", List.of());

Map<String, Object> converted = StructToJsonMap.toJsonMap(struct);
assertEquals(List.of(), converted.get("array_of_boolean"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.junit.runners.Parameterized;
import org.mockito.Mock;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -158,15 +159,15 @@ public void jsonPathNotExistThrows() {

@Test
public void complexJsonPath() {
returnOnKeyOrValue(null,
Map.of("id", List.of(
Map.of("id", 0,
"name", "cosmos kramer",
"occupation", "unknown"),
Map.of("id", 1,
"name", "franz kafka",
"occupation", "writer")
)));
Map<String, Object> map1 = new LinkedHashMap<>();
map1.put("id", 0);
map1.put("name", "cosmos kramer");
map1.put("occupation", "unknown");
Map<String, Object> map2 = new LinkedHashMap<>();
map2.put("id", 1);
map2.put("name", "franz kafka");
map2.put("occupation", "writer");
returnOnKeyOrValue(null, Map.of("id", List.of(map1, map2)));

strategy.configure(Map.of(ProvidedInConfig.JSON_PATH_CONFIG, "$.id[0].name"));
assertEquals("cosmos kramer", strategy.generateId(record));
Expand Down

0 comments on commit 4c7a3be

Please sign in to comment.