本文整理汇总了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);
}
示例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");
}
示例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);
}
示例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");
}