Issue 453 - Add test for importing top level JSON array - from Thad

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2287 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2011-10-07 16:52:31 +00:00
parent 79c795138c
commit e3f1fab4e8

View File

@ -1,6 +1,6 @@
/*
Copyright 2010, Google Inc.
Copyright 2010,2011 Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -184,7 +184,40 @@ public class JsonImporterTests extends ImporterTest {
assertProjectCreated(project,3,16);
}
@Test
public void testJSONMinimumArray(){
String ScraperwikiOutput =
"[\n" +
"{\n" +
" \"school\": \"University of Cambridge\\n" +
" United Kingdom\",\n" +
" \"student-faculty-score\": \"100\",\n" +
" \"intl-student-score\": \"95\",\n" +
" \"intl-faculty-score\": \"96\",\n" +
" \"rank\": \"#1\",\n" +
" \"peer-review-score\": \"100\",\n" +
" \"emp-review-score\": \"100\",\n" +
" \"score\": \"100.0\",\n" +
" \"citations-score\": \"93\"\n" +
" },\n" +
" {\n" +
" \"school\": \"Harvard University\\n" +
" United States\",\n" +
" \"student-faculty-score\": \"97\",\n" +
" \"intl-student-score\": \"87\",\n" +
" \"intl-faculty-score\": \"71\",\n" +
" \"rank\": \"#2\",\n" +
" \"peer-review-score\": \"100\",\n" +
" \"emp-review-score\": \"100\",\n" +
" \"score\": \"99.2\",\n" +
" \"citations-score\": \"100\"\n" +
" }\n" +
"]\n";
RunTest(ScraperwikiOutput);
log(project);
assertProjectCreated(project,9,2);
}
/**
* org.codehaus.Jackson.JsonParser has an inconsistency when returning getLocalName
* of an Entity_Start token which occurs after a Field_Name token