package io.iron.ironmq;

import java.io.IOException;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

public class IronMQTest {
    private String projectId;
    private String token;

    @Before public void setup() {
        projectId = System.getenv("IRON_PROJECT_ID");
        token = System.getenv("IRON_TOKEN");
        Assume.assumeTrue(projectId != null && token != null);
    }

    @Test public void testClient() throws IOException {
        Client c = new Client(projectId, token, Cloud.ironAWSUSEast);
        Queue q = c.queue("test-queue");

        q.clear();

        Assert.assertEquals(0, q.getSize());

        final String body = "Hello, IronMQ!";

        String id = q.push(body);

        Assert.assertEquals(1, q.getSize());

        Message msg = q.get();
        Assert.assertEquals(body, msg.getBody());
        Assert.assertEquals(id, msg.getId());
        q.deleteMessage(msg);
    }

    @Test(expected=HTTPException.class) public void testErrorResponse() throws IOException {
        // intentionally invalid project/token combination
        Client c = new Client("4444444444444", "aaaaaa", Cloud.ironAWSUSEast);
        Queue q = c.queue("test-queue");

        q.push("test");
    }
}

@@ -176,268 +176,8 @@
 t %7B%0A
-    private String projectId;%0A    private String token;%0A%0A    @Before public void setup() %7B%0A        projectId = System.getenv(%22IRON_PROJECT_ID%22);%0A        token = System.getenv(%22IRON_TOKEN%22);%0A        Assume.assumeTrue(projectId != null && token != null);%0A    %7D%0A%0A
     
@@ -262,45 +262,8 @@
 ent(
-projectId, token, Cloud.ironAWSUSEast
 );%0A 

Make test use configuration logic