package com.box.sdk;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.junit.experimental.categories.Category;

public class BoxGroupTest {
    @Test
    @Category(IntegrationTest.class)
    public void createGroupSucceeds() {
        final String groupName = "[createGroupSucceeds] Test Group";
        BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken());
        BoxGroup.Info createdGroupInfo = BoxGroup.createGroup(api, groupName);

        assertThat(createdGroupInfo.getName(), equalTo(groupName));

        createdGroupInfo.getResource().delete();
    }
}

@@ -15,16 +15,50 @@
 x.sdk;%0A%0A
+import java.text.ParseException;%0A%0A
 import s
@@ -116,570 +116,2524 @@
 org.
-junit.Assert.assertThat;%0A%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0A%0Apublic class BoxGroupTest %7B%0A    @Test%0A    @Category(IntegrationTest.class)%0A    public void createGroupSucceeds() %7B%0A        final String groupName = %22%5BcreateGroupSucceeds%5D Test Group%22;%0A        BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken());%0A        BoxGroup.Info createdGroupInfo = BoxGroup.createGroup(api, groupName);%0A%0A        assertThat(createdGroupInfo.getName(), equalTo(groupName));%0A%0A        createdGroupInfo.getResource().delete(
+hamcrest.Matchers.is;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.skyscreamer.jsonassert.JSONCompareMode.*;%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0A%0Aimport static com.github.tomakehurst.wiremock.client.WireMock.*;%0A%0Aimport com.eclipsesource.json.JsonObject;%0Aimport com.github.tomakehurst.wiremock.client.WireMock;%0Aimport com.github.tomakehurst.wiremock.junit.WireMockRule;%0A%0Apublic class BoxGroupTest %7B%0A    @Rule%0A    public WireMockRule wireMockRule = new WireMockRule(8080);%0A%0A    @Test%0A    @Category(IntegrationTest.class)%0A    public void createGroupSucceeds() %7B%0A        final String groupName = %22%5BcreateGroupSucceeds%5D Test Group%22;%0A        BoxAPIConnection api = new BoxAPIConnection(TestConfig.getAccessToken());%0A        BoxGroup.Info createdGroupInfo = BoxGroup.createGroup(api, groupName);%0A%0A        assertThat(createdGroupInfo.getName(), equalTo(groupName));%0A%0A        createdGroupInfo.getResource().delete();%0A    %7D%0A%0A    @Test%0A    @Category(UnitTest.class)%0A    public void createGroupSendsCorrectRequestAndParsesResponseCorrectly() throws ParseException %7B%0A        BoxAPIConnection api = new BoxAPIConnection(%22%22);%0A        api.setBaseURL(%22http://localhost:8080/%22);%0A%0A        final String name = %22Test Group%22;%0A%0A        JsonObject mockJSON = new JsonObject()%0A            .add(%22type%22, %22group%22)%0A            .add(%22id%22, %22305742%22)%0A            .add(%22name%22, name)%0A            .add(%22created_at%22, %222015-01-05T16:08:27-08:00%22)%0A            .add(%22modified_at%22, %222015-01-05T16:08:27-08:00%22);%0A%0A        stubFor(post(urlEqualTo(%22/groups%22))%0A            .willReturn(aResponse()%0A                .withHeader(%22Content-Type%22, %22application/json%22)%0A                .withBody(mockJSON.toString())));%0A%0A        BoxGroup.Info groupInfo = BoxGroup.createGroup(api, name);%0A        assertThat(groupInfo.getID(), is(equalTo(mockJSON.get(%22id%22).asString())));%0A        assertThat(groupInfo.getName(), is(equalTo(mockJSON.get(%22name%22).asString())));%0A        assertThat(groupInfo.getCreatedAt(), is(equalTo(BoxDateFormat.parse(mockJSON.get(%22created_at%22).asString()))));%0A        assertThat(groupInfo.getModifiedAt(), is(equalTo(BoxDateFormat.parse(mockJSON.get(%22modified_at%22).asString()))));%0A%0A        JsonObject expectedJSON = new JsonObject()%0A            .add(%22name%22, name);%0A%0A        verify(postRequestedFor(urlEqualTo(%22/groups%22))%0A            .withHeader(%22Content-Type%22, WireMock.equalTo(%22application/json%22))%0A            .withRequestBody(equalToJson(expectedJSON.toString(), LENIENT))
 );%0A 

Add unit test for creating a group