Java Code Examples for com.eclipsesource.json.JsonObject#set()

The following examples show how to use com.eclipsesource.json.JsonObject#set() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessagingIdentity.java    From zencash-swing-wallet-ui with MIT License 6 votes vote down vote up
public JsonObject toJSONObject(boolean bForMesagingProtocol)
{
	JsonObject obj = new JsonObject();
	
	obj.set("nickname",           nonNull(nickname));
	obj.set("sendreceiveaddress", nonNull(sendreceiveaddress));
	obj.set("senderidaddress",    nonNull(senderidaddress));
	obj.set("firstname",          nonNull(firstname));
	obj.set("middlename",         nonNull(middlename));
	obj.set("surname",            nonNull(surname));
	obj.set("email",              nonNull(email));
	obj.set("streetaddress",      nonNull(streetaddress));
	obj.set("facebook",           nonNull(facebook));		
	obj.set("twitter",            nonNull(twitter));
	
	if (!bForMesagingProtocol)
	{
		obj.set("isanonymous",    isAnonymous);
		obj.set("isgroup",        isGroup);
		obj.set("threadid",       nonNull(threadID));
	}
	
	return obj;
}
 
Example 2
Source File: Util.java    From zencash-swing-wallet-ui with MIT License 6 votes vote down vote up
public static JsonObject getJsonErrorMessage(String info)
    throws IOException
{
    JsonObject jInfo = new JsonObject();
    
    // Error message here comes from ZCash 1.0.7+ and is like:
    //zcash-cli getinfo
    //error code: -28
    //error message:
    //Loading block index...
    LineNumberReader lnr = new LineNumberReader(new StringReader(info));
    int errCode =  Integer.parseInt(lnr.readLine().substring(11).trim());
    jInfo.set("code", errCode);
    lnr.readLine();
    jInfo.set("message", lnr.readLine().trim());
    
    return jInfo;
}
 
Example 3
Source File: BoxResourceTest.java    From box-java-sdk with Apache License 2.0 6 votes vote down vote up
/**
 * Unit tests for {@link BoxResource#parseInfo(BoxAPIConnection, JsonObject)}.
 */
@Test
public void testParseInfo() {
    for (Map.Entry<Class<? extends BoxResource>, String> resourceTypeByClassEntry
            : this.resourceTypeByClass.entrySet()) {

        String type = resourceTypeByClassEntry.getValue();
        Class<? extends BoxResource> clazz = resourceTypeByClassEntry.getKey();

        if (BoxEvent.class.isAssignableFrom(clazz)) {
            continue;
        }

        JsonObject jsonObject = new JsonObject();
        jsonObject.set("type", type);
        jsonObject.set("id", "id");

        BoxResource.Info resource = BoxResource.parseInfo(null, jsonObject);
        Assert.assertNotNull(String.format("Resource Info for '%s' type can not be null!", type), resource);
        Assert.assertEquals(type, BoxResource.getResourceType(resource.getResource().getClass()));
    }
}
 
Example 4
Source File: Settings.java    From Cubes with MIT License 6 votes vote down vote up
public static boolean write() {
  FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");
  JsonObject json = new JsonObject();
  for (Map.Entry<String, Setting> entry : settings.entrySet()) {
    json.set(entry.getKey(), entry.getValue().toJson());
  }
  try {
    Writer writer = fileHandle.writer(false);
    json.writeTo(writer, WriterConfig.PRETTY_PRINT);
    writer.close();
  } catch (Exception e) {
    Log.error("Failed to write settings", e);
    fileHandle.delete();
    return false;
  }
  return true;
}
 
Example 5
Source File: TestPlatformJsonDescriptorProvider.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@Override
public Path getPath(Path workDir) throws IOException {
    final Model model = bomArtifact.getPomModel();

    final JsonObject json = Json.object();

    json.set("bom", Json.object().set("groupId", model.getGroupId()).set("artifactId", model.getArtifactId()).set("version",
            model.getVersion()));

    String coreVersion = null;
    for (Dependency dep : model.getDependencyManagement().getDependencies()) {
        if (dep.getArtifactId().equals(ToolsConstants.QUARKUS_CORE_ARTIFACT_ID)
                && dep.getGroupId().equals(ToolsConstants.QUARKUS_CORE_GROUP_ID)) {
            coreVersion = dep.getVersion();
        }
    }
    if (coreVersion == null) {
        throw new IllegalStateException("Failed to locate " + ToolsConstants.QUARKUS_CORE_GROUP_ID + ":"
                + ToolsConstants.QUARKUS_CORE_ARTIFACT_ID + " among the managed dependencies");
    }
    json.set("quarkus-core-version", coreVersion);

    final Path jsonPath = workDir.resolve(bomArtifact.getArtifactFileName());
    try (BufferedWriter writer = Files.newBufferedWriter(jsonPath)) {
        json.writeTo(writer);
    }
    return jsonPath;
}
 
Example 6
Source File: MessagingPanel.java    From zencash-swing-wallet-ui with MIT License 5 votes vote down vote up
public void sendIdentityMessageTo(MessagingIdentity contactIdentity)
	throws InterruptedException, IOException, WalletCallException
{
	// Only a limited set of values is sent over the wire, due to the limit of 330
	// characters. // TODO: use protocol versions with larger messages
	MessagingIdentity ownIdentity = this.messagingStorage.getOwnIdentity();
	JsonObject innerIDObject = new JsonObject();
	innerIDObject.set("nickname",           ownIdentity.getNickname());
	innerIDObject.set("firstname",          ownIdentity.getFirstname());
	innerIDObject.set("surname",            ownIdentity.getSurname());
	innerIDObject.set("senderidaddress",    ownIdentity.getSenderidaddress());
	innerIDObject.set("sendreceiveaddress", ownIdentity.getSendreceiveaddress());
	JsonObject outerObject = new JsonObject();
	outerObject.set("zenmessagingidentity", innerIDObject);
	String identityString = outerObject.toString();
	
	// Check and send the messaging identity as a message
	if (identityString.length() <= 330) // Protocol V1 restriction
	{
		this.sendMessage(identityString, contactIdentity);
	} else
	{
		JOptionPane.showMessageDialog(
			this.parentFrame, 
			"The size of your messaging identity is unfortunately too large to be sent\n" +
			"as a message. Your contact will have to import your messaging identity\n" +
			"manually from a json file...", 
			"Messaging identity size is too large!", JOptionPane.ERROR_MESSAGE);
		return;
	}
}
 
Example 7
Source File: MessagingOptions.java    From zencash-swing-wallet-ui with MIT License 5 votes vote down vote up
public JsonObject toJSONObject()
{
	JsonObject obj = new JsonObject();
	
	obj.set("automaticallyaddusersifnotexplicitlyimported",
			this.automaticallyAddUsersIfNotExplicitlyImported);
	obj.set("amounttosend",	this.amountToSend);
	obj.set("transactionfee",	this.transactionFee);
	
	return obj;
}
 
Example 8
Source File: Message.java    From zencash-swing-wallet-ui with MIT License 5 votes vote down vote up
public JsonObject toJSONObject(boolean forWireProtocol)
{
	JsonObject obj = new JsonObject();
	
	if (this.isAnonymous())
	{
		obj.set("ver",           version);
		obj.set("message",       nonNull(message));
		obj.set("threadid",      nonNull(threadID));
	} else
	{
		obj.set("ver",           version);
		obj.set("from",          nonNull(from));
		obj.set("message",       nonNull(message));
		obj.set("sign",          nonNull(sign));
	}
	
	if (!forWireProtocol)
	{
		obj.set("transactionID", nonNull(transactionID));
		obj.set("time",          this.time.getTime());
		obj.set("direction",     this.direction.toString());
		obj.set("verification",  this.verification.toString());
		obj.set("isanonymous",   isAnonymous);
	}
	
	return obj;
}
 
Example 9
Source File: Configurable.java    From Recaf with MIT License 5 votes vote down vote up
/**
 * @param field
 * 		Field accessor.
 * @param type
 * 		Field type.
 * @param value
 * 		Field value.
 * @param json
 * 		Json to write value to.
 */
default void saveType(FieldWrapper field, Class<?> type, Object value, JsonObject json) {
	if (type.equals(ConfKeybinding.Binding.class)) {
		JsonArray array = Json.array();
		ConfKeybinding.Binding list = field.get();
		// Don't write if empty/null
		if (list == null || list.isEmpty())
			return;
		// Write keys
		list.forEach(array::add);
		json.set(field.key(), array);
	}
}
 
Example 10
Source File: MessagingPanel.java    From zencash-swing-wallet-ui with MIT License 4 votes vote down vote up
public void addMessagingGroup()
{
	try
	{
		CreateGroupDialog cgd = new CreateGroupDialog(
			this, this.parentFrame, this.messagingStorage, this.errorReporter, this.clientCaller, this.labelStorage);
		cgd.setVisible(true);
		
		if (!cgd.isOKPressed())
		{
			return;
		}
		
		// So a group is created - we need to ask the user if he wishes to send an identity message 
		MessagingIdentity createdGroup = cgd.getCreatedGroup();
		
		int sendIDChoice = JOptionPane.showConfirmDialog(
			this.parentFrame, 
			"Do you wish to send a limited sub-set of your contact details to group\n" + 
			createdGroup.getDiplayString() + "\n" +
			"This will allow other group members to know your messaging identity.",
			"Send contact details?", JOptionPane.YES_NO_OPTION);
			
		// TODO: code duplication with import
		if (sendIDChoice == JOptionPane.YES_OPTION)
		{
			// Only a limited set of values is sent over the wire, due to the limit of 330
			// characters. // TODO: use protocol versions with larger messages
			MessagingIdentity ownIdentity = this.messagingStorage.getOwnIdentity();
			JsonObject innerIDObject = new JsonObject();
			innerIDObject.set("nickname",           ownIdentity.getNickname());
			innerIDObject.set("firstname",          ownIdentity.getFirstname());
			innerIDObject.set("surname",            ownIdentity.getSurname());
			innerIDObject.set("senderidaddress",    ownIdentity.getSenderidaddress());
			innerIDObject.set("sendreceiveaddress", ownIdentity.getSendreceiveaddress());
			JsonObject outerObject = new JsonObject();
			outerObject.set("zenmessagingidentity", innerIDObject);
			String identityString = outerObject.toString();
			
			// Check and send the messaging identity as a message
			if (identityString.length() <= 330) // Protocol V1 restriction
			{
				this.sendMessage(identityString, createdGroup);
			} else
			{
				JOptionPane.showMessageDialog(
					this.parentFrame, 
					"The size of your messaging identity is unfortunately too large to be sent\n" +
					"as a message.", 
					"Messaging identity size is too large!", JOptionPane.ERROR_MESSAGE);
				return;
			}
		}
	} catch (Exception ex)
	{
		this.errorReporter.reportError(ex, false);
	}
}
 
Example 11
Source File: ZCashClientCaller.java    From zencash-swing-wallet-ui with MIT License 4 votes vote down vote up
public synchronized String sendMessage(String from, String to, double amount, double fee, String memo)
	throws WalletCallException, IOException, InterruptedException
{
	String hexMemo = Util.encodeHexString(memo);
	JsonObject toArgument = new JsonObject();
	toArgument.set("address", to);
	if (hexMemo.length() >= 2)
	{
		toArgument.set("memo", hexMemo.toString());
	}
	
	DecimalFormatSymbols decSymbols = new DecimalFormatSymbols(Locale.ROOT);

	// TODO: The JSON Builder has a problem with double values that have no fractional part
	// it serializes them as integers that ZCash does not accept. This will work with the 
	// fractional amounts always used for messaging
	toArgument.set("amount", new DecimalFormat("########0.00######", decSymbols).format(amount));

	JsonArray toMany = new JsonArray();
	toMany.add(toArgument);
	
	String toManyArrayStr =	toMany.toString();		
	String[] sendCashParameters = new String[]
    {
	    this.zcashcli.getCanonicalPath(), "z_sendmany", wrapStringParameter(from),
	    wrapStringParameter(toManyArrayStr),
	    // Default min confirmations for the input transactions is 1
	    "1",
	    // transaction fee
	    new DecimalFormat("########0.00######", decSymbols).format(fee)
	};
			
	// Create caller to send cash
    CommandExecutor caller = new CommandExecutor(sendCashParameters);
    String strResponse = caller.execute();

	if (strResponse.trim().toLowerCase(Locale.ROOT).startsWith("error:") ||
		strResponse.trim().toLowerCase(Locale.ROOT).startsWith("error code:"))
	{
	  	throw new WalletCallException("Error response from wallet: " + strResponse);
	}

	Log.info("Sending cash message with the following command: " +
               sendCashParameters[0] + " " + sendCashParameters[1] + " " +
               sendCashParameters[2] + " " + sendCashParameters[3] + " " +
               sendCashParameters[4] + " " + sendCashParameters[5] + "." +
               " Got result: [" + strResponse + "]");

	return strResponse.trim();
}
 
Example 12
Source File: BoxFolderTest.java    From box-java-sdk with Apache License 2.0 4 votes vote down vote up
@Test
@Category(UnitTest.class)
public void testChunkedUploadWithCorrectPartSizeAndAttributes() throws IOException, InterruptedException {
    String javaVersion = System.getProperty("java.version");
    Assume.assumeFalse("Test is not run for JDK 7", javaVersion.contains("1.7"));
    String sessionResult = "";
    String uploadResult = "";
    String commitResult = "";
    final String preflightURL = "/files/content";
    final String sessionURL = "/files/upload_sessions";
    final String uploadURL = "/files/upload_sessions/D5E3F8ADA11A38F0A66AD0B64AACA658";
    final String commitURL = "/files/upload_sessions/D5E3F8ADA11A38F0A66AD0B64AACA658/commit";
    BoxFileTest.FakeStream stream = new BoxFileTest.FakeStream("aaaaa");

    sessionResult = TestConfig.getFixture("BoxFile/CreateUploadSession201");
    uploadResult = TestConfig.getFixture("BoxFile/UploadPartOne200");
    commitResult = TestConfig.getFixture("BoxFile/CommitUploadWithAttributes201");

    JsonObject idObject = new JsonObject()
            .add("id", "12345");

    JsonObject preflightObject = new JsonObject()
            .add("name", "testfile.txt")
            .add("size", 5)
            .add("parent", idObject);

    JsonObject sessionObject = new JsonObject()
            .add("folder_id", "12345")
            .add("file_size", 5)
            .add("file_name", "testfile.txt");

    JsonObject partOne = new JsonObject()
            .add("part_id", "CFEB5BA9")
            .add("offset", 0)
            .add("size", 5);

    JsonArray parts = new JsonArray()
            .add(partOne);

    Map<String, String> fileAttributes = new HashMap<String, String>();
    fileAttributes.put("content_modified_at", "2017-04-08T00:58:08Z");

    JsonObject fileAttributesJson = new JsonObject();
    for (String attrKey : fileAttributes.keySet()) {
        fileAttributesJson.set(attrKey, fileAttributes.get(attrKey));
    }

    JsonObject commitObject = new JsonObject()
            .add("parts", parts)
            .add("attributes", fileAttributesJson);

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.options(WireMock.urlPathEqualTo(preflightURL))
                .withRequestBody(WireMock.equalToJson(preflightObject.toString()))
                .willReturn(WireMock.aResponse()
                        .withHeader("Content-Type", "application/json")
                        .withStatus(200)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(sessionURL))
            .withRequestBody(WireMock.equalToJson(sessionObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(sessionResult)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.put(WireMock.urlPathEqualTo(uploadURL))
            .withHeader("Digest", WireMock.containing("sha=31HjfCaaqU04+T5Te/biAgshQGw="))
            .withHeader("Content-Type", WireMock.containing("application/octet-stream"))
            .withHeader("Content-Range", WireMock.containing("bytes 0-4/5"))
            .withRequestBody(WireMock.equalTo("aaaaa"))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(uploadResult)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(commitURL))
            .withHeader("Content-Type", WireMock.equalTo("application/json"))
            .withRequestBody(WireMock.containing(commitObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(commitResult)));

    BoxFolder folder = new BoxFolder(this.api, "12345");
    BoxFile.Info uploadedFile = folder.uploadLargeFile(stream, "testfile.txt", 5, fileAttributes);

    Assert.assertEquals("1111111", uploadedFile.getID());
    Assert.assertEquals("[email protected]", uploadedFile.getModifiedBy().getLogin());
    Assert.assertEquals("Test User", uploadedFile.getOwnedBy().getName());
    Assert.assertEquals("folder", uploadedFile.getParent().getType());
    Assert.assertEquals("testfile.txt", uploadedFile.getName());
    Assert.assertEquals(1491613088000L, uploadedFile.getContentModifiedAt().getTime());
}
 
Example 13
Source File: BoxFolderTest.java    From box-java-sdk with Apache License 2.0 4 votes vote down vote up
@Test
@Category(UnitTest.class)
public void testChunkedParallelUploadWithCorrectPartSizeAndAttributes() throws IOException, InterruptedException {
    String javaVersion = System.getProperty("java.version");
    Assume.assumeFalse("Test is not run for JDK 7", javaVersion.contains("1.7"));
    String sessionResult = "";
    String uploadResult = "";
    String commitResult = "";
    final String preflightURL = "/files/content";
    final String sessionURL = "/files/upload_sessions";
    final String uploadURL = "/files/upload_sessions/D5E3F8ADA11A38F0A66AD0B64AACA658";
    final String commitURL = "/files/upload_sessions/D5E3F8ADA11A38F0A66AD0B64AACA658/commit";
    BoxFileTest.FakeStream stream = new BoxFileTest.FakeStream("aaaaa");

    sessionResult = TestConfig.getFixture("BoxFile/CreateUploadSession201");
    uploadResult = TestConfig.getFixture("BoxFile/UploadPartOne200");
    commitResult = TestConfig.getFixture("BoxFile/CommitUploadWithAttributes201");

    JsonObject idObject = new JsonObject()
            .add("id", "12345");

    JsonObject preflightObject = new JsonObject()
            .add("name", "testfile.txt")
            .add("size", 5)
            .add("parent", idObject);

    JsonObject sessionObject = new JsonObject()
            .add("folder_id", "12345")
            .add("file_size", 5)
            .add("file_name", "testfile.txt");

    JsonObject partOne = new JsonObject()
            .add("part_id", "CFEB5BA9")
            .add("offset", 0)
            .add("size", 5);

    JsonArray parts = new JsonArray()
            .add(partOne);

    Map<String, String> fileAttributes = new HashMap<String, String>();
    fileAttributes.put("content_modified_at", "2017-04-08T00:58:08Z");

    JsonObject fileAttributesJson = new JsonObject();
    for (String attrKey : fileAttributes.keySet()) {
        fileAttributesJson.set(attrKey, fileAttributes.get(attrKey));
    }

    JsonObject commitObject = new JsonObject()
            .add("parts", parts)
            .add("attributes", fileAttributesJson);

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.options(WireMock.urlPathEqualTo(preflightURL))
            .withRequestBody(WireMock.equalToJson(preflightObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withStatus(200)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(sessionURL))
            .withRequestBody(WireMock.equalToJson(sessionObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(sessionResult)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.put(WireMock.urlPathEqualTo(uploadURL))
            .withHeader("Digest", WireMock.containing("sha=31HjfCaaqU04+T5Te/biAgshQGw="))
            .withHeader("Content-Type", WireMock.containing("application/octet-stream"))
            .withHeader("Content-Range", WireMock.containing("bytes 0-4/5"))
            .withRequestBody(WireMock.equalTo("aaaaa"))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(uploadResult)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(commitURL))
            .withHeader("Content-Type", WireMock.equalTo("application/json"))
            .withRequestBody(WireMock.containing(commitObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(commitResult)));

    BoxFolder folder = new BoxFolder(this.api, "12345");
    BoxFile.Info uploadedFile = folder.uploadLargeFile(stream, "testfile.txt",
            5, 2, 60, TimeUnit.SECONDS, fileAttributes);

    Assert.assertEquals("1111111", uploadedFile.getID());
    Assert.assertEquals("[email protected]", uploadedFile.getModifiedBy().getLogin());
    Assert.assertEquals("Test User", uploadedFile.getOwnedBy().getName());
    Assert.assertEquals("folder", uploadedFile.getParent().getType());
    Assert.assertEquals("testfile.txt", uploadedFile.getName());
    Assert.assertEquals(1491613088000L, uploadedFile.getContentModifiedAt().getTime());
}
 
Example 14
Source File: BoxFileTest.java    From box-java-sdk with Apache License 2.0 4 votes vote down vote up
@Test
@Category(UnitTest.class)
public void testChunkedVersionUploadWithCorrectPartSizeAndAttributes() throws IOException, InterruptedException {
    String sessionResult = "";
    String uploadResult = "";
    String commitResult = "";
    final String sessionURL = "/files/1111111/upload_sessions";
    final String uploadURL = "/files/upload_sessions/D5E3F8ADA11A38F0A66AD0B64AACA658";
    final String commitURL = "/files/upload_sessions/D5E3F8ADA11A38F0A66AD0B64AACA658/commit";
    FakeStream stream = new FakeStream("aaaaa");

    sessionResult = TestConfig.getFixture("BoxFile/CreateUploadSession201");
    uploadResult = TestConfig.getFixture("BoxFile/UploadPartOne200");
    commitResult = TestConfig.getFixture("BoxFile/CommitUploadWithAttributes201");

    JsonObject sessionObject = new JsonObject()
            .add("file_size", 5);

    JsonObject partOne = new JsonObject()
            .add("part_id", "CFEB5BA9")
            .add("offset", 0)
            .add("size", 5);

    JsonArray parts = new JsonArray()
            .add(partOne);

    Map<String, String> fileAttributes = new HashMap<String, String>();
    fileAttributes.put("content_modified_at", "2017-04-08T00:58:08Z");

    JsonObject fileAttributesJson = new JsonObject();
    for (String attrKey : fileAttributes.keySet()) {
        fileAttributesJson.set(attrKey, fileAttributes.get(attrKey));
    }

    JsonObject commitObject = new JsonObject()
            .add("parts", parts)
            .add("attributes", fileAttributesJson);

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(sessionURL))
            .withRequestBody(WireMock.equalToJson(sessionObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(sessionResult)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.put(WireMock.urlPathEqualTo(uploadURL))
            .withHeader("Digest", WireMock.containing("sha=31HjfCaaqU04+T5Te/biAgshQGw="))
            .withHeader("Content-Type", WireMock.containing("application/octet-stream"))
            .withHeader("Content-Range", WireMock.containing("bytes 0-4/5"))
            .withRequestBody(WireMock.equalTo("aaaaa"))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(uploadResult)));

    WIRE_MOCK_CLASS_RULE.stubFor(WireMock.post(WireMock.urlPathEqualTo(commitURL))
            .withHeader("Content-Type", WireMock.equalTo("application/json"))
            .withRequestBody(WireMock.containing(commitObject.toString()))
            .willReturn(WireMock.aResponse()
                    .withHeader("Content-Type", "application/json")
                    .withBody(commitResult)));

    BoxFile file = new BoxFile(this.api, "1111111");
    BoxFile.Info uploadedFile = file.uploadLargeFile(stream, 5, fileAttributes);

    Assert.assertEquals("1111111", uploadedFile.getID());
    Assert.assertEquals("[email protected]", uploadedFile.getModifiedBy().getLogin());
    Assert.assertEquals("Test User", uploadedFile.getOwnedBy().getName());
    Assert.assertEquals("folder", uploadedFile.getParent().getType());
    Assert.assertEquals("testfile.txt", uploadedFile.getName());
    Assert.assertEquals(1491613088000L, uploadedFile.getContentModifiedAt().getTime());
}