package com.github.dreambrother.hackernews.client;

import com.github.dreambrother.hackernews.exceptions.VkException;
import org.junit.Ignore;
import org.junit.Test;

import static com.github.dreambrother.hackernews.fixture.HackernewsItems.oneItem;

@Ignore("Token is invalid on CI server")
public class VkClientImplIntTest {

    private static final String TOKEN_URL = "https://oauth.vk.com/authorize?client_id=4245307&scope=wall,offline&redirect_uri=https://oauth.vk.com/blank.html&display=page&v=5.14&response_type=token";
    private String token = "";
    private String communityId = "-78812350";

    private VkClientImpl sut = new VkClientImpl();

    public VkClientImplIntTest() {
        sut.setToken(token);
        sut.setCommunityId(communityId);
    }

    @Test
    public void shouldPublishNews() {
        sut.publish(oneItem());
    }

    @Test(expected = VkException.class)
    public void shouldThrowExceptionInCaseOfError() {
        VkClientImpl invalidClient = new VkClientImpl();
        invalidClient.setToken("invalid");
        invalidClient.setCommunityId("invalid");

        invalidClient.publish(oneItem());
    }
}

@@ -41,24 +41,86 @@
 ws.client;%0A%0A
+import com.github.dreambrother.hackernews.dto.HackernewsItem;%0A
 import com.g
@@ -1202,11 +1202,334 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void shouldPublishNewsWithDollarSign() %7B%0A        HackernewsItem item = new HackernewsItem();%0A        item.setId(1L);%0A        item.setScore(100);%0A        item.setTitle(%22Test $%22);%0A        item.setUrl(%22http://blog.ycombinator.com/$500k-of-azure-credit-for-yc-startups%22);%0A        sut.publish(item);%0A    %7D
 %0A%7D%0A

test for publication with dollar sign