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


Java Json.setWriter方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.Json.setWriter方法的典型用法代码示例。如果您正苦于以下问题:Java Json.setWriter方法的具体用法?Java Json.setWriter怎么用?Java Json.setWriter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.Json的用法示例。


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

示例1: getRequest

import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Test
void getRequest() throws IOException {
    String expected = TestUtils.getResourceRequestString("testsResources/SearchGcOwner_request.txt",
            isDummy ? null : apiKey);

    Coordinate searchCoord = new CoordinateGPS(52.581892, 13.398128); // Home of Katipa(like Longri)
    SearchGCOwner searchGC = new SearchGCOwner(apiKey, 30, searchCoord, 50000, "bros", (byte) 2);

    StringWriter writer = new StringWriter();
    Json json = new Json(JsonWriter.OutputType.json);
    json.setWriter(writer);
    searchGC.getRequest(json);

    String actual = writer.toString();
    assertEquals(expected, actual);
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:17,代码来源:SearchGcOwnerTest.java

示例2: getRequest

import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Test
void getRequest() throws IOException {
    String expected = TestUtils.getResourceRequestString("testsResources/GetYourUserProfile_request.txt",
            isDummy ? null : apiKey);
    GetYourUserProfile getYourUserProfile = new GetYourUserProfile(apiKey);

    StringWriter writer = new StringWriter();
    Json json = new Json(JsonWriter.OutputType.json);
    json.setWriter(writer);

    json.writeObjectStart();
    getYourUserProfile.getRequest(json);
    json.writeObjectEnd();

    String actual = writer.toString();

    //remove "DeviceOperatingSystem"
    expected = expected.replace("UNKNOWN", GetYourUserProfile.getDeviceOperatingSystem());
    assertEquals(expected, actual, "Should be equals");
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:21,代码来源:GetYourUserProfileTest.java

示例3: getRequest

import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Test
void getRequest() throws IOException {

    String expected = TestUtils.getResourceRequestString("testsResources/SearchGcCoordinate_request.txt",
            isDummy ? null : apiKey);


    //set MembershipType for tests to Premium
    GroundspeakAPI.setTestMembershipType(ApiResultState.MEMBERSHIP_TYPE_PREMIUM);

    byte apiState;
    if (GroundspeakAPI.isPremiumMember()) {
        apiState = 2;
    } else {
        apiState = 1;
    }

    SearchCoordinate searchCoordinate = new SearchCoordinate(apiKey, 50
            , LONGRI_HOME_COORDS, 50000, apiState);

    StringWriter writer = new StringWriter();
    Json json = new Json(JsonWriter.OutputType.json);
    json.setWriter(writer);
    searchCoordinate.getRequest(json);

    String actual = writer.toString();
    assertEquals(expected, actual);


}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:31,代码来源:SearchCoordinateTest.java

示例4: getRequest

import com.badlogic.gdx.utils.Json; //导入方法依赖的package包/类
@Test
void getRequest() throws IOException {
    String expected = TestUtils.getResourceRequestString("testsResources/SearchGc_request.txt",
            isDummy ? null : apiKey);
    SearchGC searchGC = new SearchGC(apiKey, "GC1T33T");

    StringWriter writer = new StringWriter();
    Json json = new Json(JsonWriter.OutputType.json);
    json.setWriter(writer);
    searchGC.getRequest(json);

    String actual = writer.toString();
    assertEquals(expected, actual, "Should be equals");
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:15,代码来源:SearchGCTest.java


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