Merge pull request #1877 from OpenRefine/issue1876
Fix reconciliation result deserialization
This commit is contained in:
commit
d4222c05ef
@ -334,7 +334,7 @@ public class StandardReconConfig extends ReconConfig {
|
||||
public String name;
|
||||
@JsonProperty("id")
|
||||
public String id;
|
||||
@JsonProperty("types")
|
||||
@JsonProperty("type")
|
||||
public List<ReconType> types = Collections.emptyList();
|
||||
@JsonProperty("score")
|
||||
public double score;
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user