当前位置: 首页>>代码示例>>Java>>正文


Java JsonStreamParser类代码示例

本文整理汇总了Java中com.google.gson.JsonStreamParser的典型用法代码示例。如果您正苦于以下问题:Java JsonStreamParser类的具体用法?Java JsonStreamParser怎么用?Java JsonStreamParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsonStreamParser类属于com.google.gson包,在下文中一共展示了JsonStreamParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
@POST
@Path("save")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response save(String json) throws Exception {
    JsonStreamParser jsonStreamParser = new JsonStreamParser(json);
    if (!jsonStreamParser.hasNext()) {
        return Response.status(Status.BAD_REQUEST).build();
    }
    JsonObject saveObject = jsonStreamParser.next().getAsJsonObject();
    // get navigation
    MCRNavigation newNavigation = MCRWCMSNavigationManager.fromJSON(saveObject);
    // save navigation
    MCRWCMSNavigationManager.save(newNavigation);
    // save content
    JsonArray items = saveObject.get(MCRWCMSNavigationProvider.JSON_ITEMS).getAsJsonArray();
    getContentManager().save(items);
    return Response.ok().build();
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:20,代码来源:MCRWCMSNavigationResource.java

示例2: getCategoryIDMap

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public static HashMap<MCRCategoryID, String> getCategoryIDMap(String json) {
    HashMap<MCRCategoryID, String> categories = new HashMap<>();
    JsonStreamParser jsonStreamParser = new JsonStreamParser(json);
    if (jsonStreamParser.hasNext()) {
        JsonArray saveObjArray = jsonStreamParser.next().getAsJsonArray();
        for (JsonElement jsonElement : saveObjArray) {
            //jsonObject.item.id.rootid
            JsonObject root = jsonElement.getAsJsonObject();
            String rootId = root.getAsJsonObject("item").getAsJsonObject("id").getAsJsonPrimitive("rootid")
                .getAsString();

            String state = root.getAsJsonPrimitive("state").getAsString();
            JsonElement parentIdJSON = root.get("parentId");
            if (parentIdJSON != null && parentIdJSON.isJsonPrimitive()
                && "_placeboid_".equals(parentIdJSON.getAsString())) {
                state = "new";
            }

            categories.put(MCRCategoryID.rootID(rootId), state);
        }
    } else {
        return null;
    }
    return categories;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:26,代码来源:MCRCategUtils.java

示例3: testReadWriteTwoStrings_add1417

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
@Test(timeout = 1000)
public void testReadWriteTwoStrings_add1417() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoStrings_add1417");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    writer.write(gson.toJson("one").toCharArray());
    writer.write(gson.toJson("one").toCharArray());
    writer.write(gson.toJson("two").toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    String actualOne = gson.fromJson(parser.next(), String.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2395,actualOne);
    String actualTwo = gson.fromJson(parser.next(), String.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2396,actualTwo);
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:ReadersWritersTest.java

示例4: testReadWriteTwoStrings_add1418

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
@Test(timeout = 1000)
public void testReadWriteTwoStrings_add1418() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoStrings_add1418");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    writer.write(gson.toJson("one").toCharArray());
    writer.write(gson.toJson("two").toCharArray());
    writer.write(gson.toJson("two").toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    String actualOne = gson.fromJson(parser.next(), String.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2395,actualOne);
    String actualTwo = gson.fromJson(parser.next(), String.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2396,actualTwo);
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:17,代码来源:ReadersWritersTest.java

示例5: testReadWriteTwoObjects_add1415

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
@Test(timeout = 1000)
public void testReadWriteTwoObjects_add1415() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_add1415");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:20,代码来源:ReadersWritersTest.java

示例6: testReadWriteTwoObjects_add1416

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
@Test(timeout = 1000)
public void testReadWriteTwoObjects_add1416() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_add1416");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:20,代码来源:ReadersWritersTest.java

示例7: testReadWriteTwoObjects

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(2 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例8: testReadWriteTwoObjects_literalMutation1921

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1921() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1921");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 0 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例9: testReadWriteTwoObjects_literalMutation1922

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1922() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1922");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , false , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例10: testReadWriteTwoObjects_literalMutation1923

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1923() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1923");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "foo");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例11: testReadWriteTwoObjects_literalMutation1924

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1924() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1924");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(1 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例12: testReadWriteTwoObjects_literalMutation1925

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1925() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1925");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 1 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例13: testReadWriteTwoObjects_literalMutation1926

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1926() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1926");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , true , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例14: testReadWriteTwoObjects_literalMutation1927

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
public void testReadWriteTwoObjects_literalMutation1927() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_literalMutation1927");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    writer.write(gson.toJson(expectedOne).toCharArray());
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "foo");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java

示例15: testReadWriteTwoObjects_remove1171

import com.google.gson.JsonStreamParser; //导入依赖的package包/类
@Test(timeout = 1000)
public void testReadWriteTwoObjects_remove1171() throws IOException {
    fr.inria.diversify.testamplification.logger.Logger.writeTestStart(Thread.currentThread(),this, "testReadWriteTwoObjects_remove1171");
    Gson gson = new Gson();
    CharArrayWriter writer = new CharArrayWriter();
    TestTypes.BagOfPrimitives expectedOne = new TestTypes.BagOfPrimitives(1 , 1 , true , "one");
    TestTypes.BagOfPrimitives expectedTwo = new TestTypes.BagOfPrimitives(2 , 2 , false , "two");
    writer.write(gson.toJson(expectedTwo).toCharArray());
    CharArrayReader reader = new CharArrayReader(writer.toCharArray());
    JsonStreamParser parser = new JsonStreamParser(reader);
    TestTypes.BagOfPrimitives actualOne = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2391,actualOne.stringValue);
    TestTypes.BagOfPrimitives actualTwo = gson.fromJson(parser.next(), TestTypes.BagOfPrimitives.class);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2392,actualTwo.stringValue);
    fr.inria.diversify.testamplification.logger.Logger.logAssertArgument(Thread.currentThread(),2394,parser,2393,parser.hasNext());
    fr.inria.diversify.testamplification.logger.Logger.writeTestFinish(Thread.currentThread());
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:18,代码来源:ReadersWritersTest.java


注:本文中的com.google.gson.JsonStreamParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。