This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of ssh://github.com/synapticloop/backblaze-b2-j…
…ava-api
- Loading branch information
Showing
10 changed files
with
377 additions
and
116 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/java/synapticloop/b2/response/B2FileInfoResponseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package synapticloop.b2.response; | ||
|
||
import org.json.JSONObject; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class B2FileInfoResponseTest { | ||
|
||
@Test | ||
public void testGetFileInfo() throws Exception { | ||
final String json = | ||
" {\n" + | ||
" \"action\": \"upload\",\n" + | ||
" \"contentSha1\": \"f66ccfc5920c4527a3473cac8418e759fc991a1c\",\n" + | ||
" \"contentType\": \"image/jpeg\",\n" + | ||
" \"fileId\": \"4_zd866c2e0ac0d7d4855110b15_f10583db69f768e88_d20160122_m203004_c000_v0001016_t0021\",\n" + | ||
" \"fileInfo\": {\n" + | ||
" \"meta1\": \"This is some text for meta1.\",\n" + | ||
" \"meta2\": \"This is some more text for meta2.\",\n" + | ||
" \"unicorns-and-rainbows\": \"test header\"\n" + | ||
" },\n" + | ||
" \"fileName\": \"IMG_4666.jpg\",\n" + | ||
" \"size\": 1828156,\n" + | ||
" \"uploadTimestamp\": 1453494604000\n" + | ||
" }"; | ||
final B2FileInfoResponse response = new B2FileInfoResponse(new JSONObject(json)); | ||
assertNotNull(response); | ||
assertNotNull(response.getFileId()); | ||
assertNull(response.getContentLength()); | ||
assertNotNull(response.getAction()); | ||
assertNotNull(response.getFileName()); | ||
assertNotNull(response.getContentSha1()); | ||
assertNotNull(response.getSize()); | ||
assertNotNull(response.getFileInfo()); | ||
assertFalse(response.getFileInfo().isEmpty()); | ||
assertNotNull(response.getFileInfo().get("meta1")); | ||
assertNotNull(response.getFileInfo().get("meta1")); | ||
assertNotNull(response.getFileInfo().get("meta2")); | ||
assertNotNull(response.getFileInfo().get("unicorns-and-rainbows")); | ||
} | ||
} |
Oops, something went wrong.