Package com.jcabi.github

Examples of com.jcabi.github.ReleaseAsset$Smart


     * @throws Exception If a problem occurs.
     */
    @Test
    public void removesAsset() throws Exception {
        final ReleaseAssets assets = release().assets();
        final ReleaseAsset asset = assets.upload(
            "testRemove".getBytes(), "text/plain", "remove.txt"
        );
        MatcherAssert.assertThat(
            assets.iterate(),
            Matchers.<ReleaseAsset>iterableWithSize(1)
        );
        asset.remove();
        MatcherAssert.assertThat(
            assets.iterate(),
            Matchers.emptyIterable()
        );
    }
View Full Code Here


     */
    @Test
    public void canRepresentAsJson() throws Exception {
        final String name = "json.txt";
        final String type = "text/plain";
        final ReleaseAsset asset = release().assets().upload(
            "testJson".getBytes(), type, name
        );
        MatcherAssert.assertThat(
            asset.json().getString("content_type"),
            Matchers.is(type)
        );
        MatcherAssert.assertThat(
            asset.json().getString("name"),
            Matchers.is(name)
        );
    }
View Full Code Here

     * @throws Exception If a problem occurs.
     */
    @Test
    public void canPatchJson() throws Exception {
        final String orig = "orig.txt";
        final ReleaseAsset asset = release().assets().upload(
            "testPatch".getBytes(), "text/plain", orig
        );
        final String attribute = "name";
        MatcherAssert.assertThat(
            asset.json().getString(attribute),
            Matchers.is(orig)
        );
        final String patched = "patched.txt";
        asset.patch(
            Json.createObjectBuilder().add(attribute, patched).build()
        );
        MatcherAssert.assertThat(
            asset.json().getString(attribute),
            Matchers.is(patched)
        );
    }
View Full Code Here

     */
    @Test
    public void fetchesRawRepresentation() throws Exception {
        final String fetch = "fetch";
        final ReleaseAssets assets = release().assets();
        final ReleaseAsset asset = assets.upload(
            fetch.getBytes(), "text/plain", "raw.txt"
        );
        final InputStream raw = new ByteArrayInputStream(
            DatatypeConverter.parseBase64Binary(
                fetch
            )
        );
        MatcherAssert.assertThat(
            IOUtils.toString(asset.raw()),
            Matchers.is(IOUtils.toString(raw))
        );
        asset.remove();
    }
View Full Code Here

     * @throws Exception If a problem occurs.
     */
    @Test
    public void uploadsNewAsset() throws Exception {
        final ReleaseAssets assets = release().assets();
        final ReleaseAsset asset = assets.upload(
            "testUpload".getBytes(), "text/plain", "upload.txt"
        );
        MatcherAssert.assertThat(
            asset.number(),
            Matchers.is(1)
        );
    }
View Full Code Here

     * @throws Exception If a problem occurs.
     */
    @Test
    public void fetchesSingleAsset() throws Exception {
        final ReleaseAssets assets = release().assets();
        final ReleaseAsset asset = assets.upload(
            "testGet".getBytes(), "text/plain", "get.txt"
        );
        MatcherAssert.assertThat(
            assets.get(asset.number()),
            Matchers.is(asset)
        );
    }
View Full Code Here

TOP

Related Classes of com.jcabi.github.ReleaseAsset$Smart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.