Commit b22fb80a authored by zaky's avatar zaky

Merge branch 'master' of https://github.com/timols/java-gitlab-api

Conflicts:
	src/test/java/org/gitlab/api/GitlabAPITest.java
parents 47a049b8 1040100a
......@@ -343,7 +343,18 @@ public class GitlabAPI {
}
public GitlabGroup getGroup(Integer groupId) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + groupId;
return getGroup(groupId.toString());
}
/**
* Get a group by path
*
* @param path Path of the group
* @return
* @throws IOException
*/
public GitlabGroup getGroup(String path) throws IOException {
String tailUrl = GitlabGroup.URL + "/" + path;
return retrieve().to(tailUrl, GitlabGroup.class);
}
......
......@@ -2,6 +2,7 @@ package org.gitlab.api;
import org.gitlab.api.models.GitlabBuildVariable;
import org.gitlab.api.models.GitlabProject;
import org.gitlab.api.models.GitlabGroup;
import org.gitlab.api.models.GitlabUser;
import org.junit.Before;
import org.junit.Ignore;
......@@ -166,6 +167,27 @@ public class GitlabAPITest {
}
@Test
public void testGetGroupByPath() throws IOException {
// Given
String name = "groupName";
String path = "groupPath";
GitlabGroup originalGroup = api.createGroup(name, path);
// When
GitlabGroup group = api.getGroup(path);
// Then:
assertNotNull(group);
assertEquals(originalGroup.getId(), group.getId());
assertEquals(originalGroup.getName(), group.getName());
assertEquals(originalGroup.getPath(), group.getPath());
// Cleanup
api.deleteGroup(group.getId());
}
private String randVal(String postfix) {
return rand + "_" + postfix;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment