Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Trutz2011-04-26 19:29:47 +0000
committerChristian Trutz2011-04-26 19:29:47 +0000
commit9e2b2c9b75ddec007dedbc5c5885be3628e3dd6b (patch)
treee2705947ed41d31392cc8a5c6dab53d5eb586fe6 /org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github
parent6fead739c1c3ba4fba54aba78050ddeaf7f4fa4d (diff)
downloadegit-github-9e2b2c9b75ddec007dedbc5c5885be3628e3dd6b.tar.gz
egit-github-9e2b2c9b75ddec007dedbc5c5885be3628e3dd6b.tar.xz
egit-github-9e2b2c9b75ddec007dedbc5c5885be3628e3dd6b.zip
Unit tests for GistService
Change-Id: I74702f0208baed0dd7903bd6bbfbffb28a54283d Signed-off-by: Christian Trutz <christian.trutz@gmail.com>
Diffstat (limited to 'org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github')
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
index 4153d2a6..0a2fa4cf 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GistService.java
@@ -58,6 +58,7 @@ public class GistService {
* @throws IOException
*/
public List<Gist> getGists(String user) throws IOException {
+ Assert.isNotNull(user, "User cannot be null");
StringBuilder uri = new StringBuilder(IGitHubConstants.SEGMENT_USERS);
uri.append('/').append(user);
uri.append(IGitHubConstants.SEGMENT_GISTS).append(
@@ -75,11 +76,14 @@ public class GistService {
* @throws IOException
*/
public Gist createGist(Gist gist) throws IOException {
+ Assert.isNotNull(gist, "Gist cannot be null");
StringBuilder uri = new StringBuilder();
User user = gist.getUser();
if (user != null) {
+ String login = user.getLogin();
+ Assert.isNotNull(login, "User login name cannot be null");
uri.append(IGitHubConstants.SEGMENT_USERS);
- uri.append('/').append(user.getLogin());
+ uri.append('/').append(login);
}
uri.append(IGitHubConstants.SEGMENT_GISTS).append(
IGitHubConstants.SUFFIX_JSON);

Back to the top