From 82598ae1d5bcadfab84ea4fc2b8fb3cc6646be5d Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Sun, 2 Dec 2018 11:59:47 +0900 Subject: [PATCH] Fix reconciliation result deserialization. Closes #1876. --- .../refine/model/recon/StandardReconConfig.java | 2 +- .../model/recon/StandardReconConfigTests.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/main/src/com/google/refine/model/recon/StandardReconConfig.java b/main/src/com/google/refine/model/recon/StandardReconConfig.java index da11a6ba5..34981f0a5 100644 --- a/main/src/com/google/refine/model/recon/StandardReconConfig.java +++ b/main/src/com/google/refine/model/recon/StandardReconConfig.java @@ -334,7 +334,7 @@ public class StandardReconConfig extends ReconConfig { public String name; @JsonProperty("id") public String id; - @JsonProperty("types") + @JsonProperty("type") public List types = Collections.emptyList(); @JsonProperty("score") public double score; diff --git a/main/tests/server/src/com/google/refine/tests/model/recon/StandardReconConfigTests.java b/main/tests/server/src/com/google/refine/tests/model/recon/StandardReconConfigTests.java index 0019d5929..53d3e5373 100644 --- a/main/tests/server/src/com/google/refine/tests/model/recon/StandardReconConfigTests.java +++ b/main/tests/server/src/com/google/refine/tests/model/recon/StandardReconConfigTests.java @@ -20,6 +20,7 @@ import com.google.refine.model.recon.ReconConfig; import com.google.refine.model.recon.ReconJob; import com.google.refine.model.recon.StandardReconConfig; import com.google.refine.model.recon.StandardReconConfig.ColumnDetail; +import com.google.refine.model.recon.StandardReconConfig.ReconResult; import com.google.refine.operations.OperationRegistry; import com.google.refine.operations.recon.ReconOperation; import com.google.refine.tests.RefineTest; @@ -172,4 +173,17 @@ public class StandardReconConfigTests extends RefineTest { ColumnDetail cd = ParsingUtilities.mapper.readValue(uiJson, ColumnDetail.class); TestUtils.isSerializedTo(cd, backendJson); } + + @Test + public void deserializeReconResult() throws JsonParseException, JsonMappingException, IOException { + String json = "{\"score\":100.0," + + "\"match\":false," + + "\"type\":[" + + " {\"id\":\"Q17366755\"," + + " \"name\":\"hamlet in Alberta\"}]," + + "\"id\":\"Q5136635\"," + + "\"name\":\"Cluny\"}"; + ReconResult rr = ParsingUtilities.mapper.readValue(json, ReconResult.class); + assertEquals(rr.types.get(0).name, "hamlet in Alberta"); + } }