diff options
author | Matthias Sohn | 2011-05-09 15:26:46 +0000 |
---|---|---|
committer | Matthias Sohn | 2011-05-09 15:26:46 +0000 |
commit | dce76310f81ca8f097a0260957a0fa7177775945 (patch) | |
tree | 36d907e896d8d1877c2d12b2246bba88fa461215 /org.eclipse.mylyn.github.tests | |
parent | ac188dc96601e23790e43b66578f46a56c755716 (diff) | |
download | egit-github-dce76310f81ca8f097a0260957a0fa7177775945.tar.gz egit-github-dce76310f81ca8f097a0260957a0fa7177775945.tar.xz egit-github-dce76310f81ca8f097a0260957a0fa7177775945.zip |
Fix line endings
Change-Id: I4e635bea33f18eb31846f6aa2a2ad72c90ec2171
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.mylyn.github.tests')
7 files changed, 353 insertions, 353 deletions
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java index f22dc029..95491636 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/CommentTest.java @@ -1,47 +1,47 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * Unit tests for {@link Comment}
- */
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class CommentTest {
-
- private static final Gson gson = new GsonBuilder().setDateFormat(
- "yyyy-MM-dd").create();
-
- @Test
- public void getCreatedAt_ReferenceMutableObject() {
- Comment comment = gson.fromJson("{createdAt : '2003-10-10'}",
- Comment.class);
- comment.getCreatedAt().setTime(0);
- assertTrue(comment.getCreatedAt().getTime() != 0);
- }
-
- @Test
- public void getUpdatedAt_ReferenceMutableObject() {
- Comment comment = gson.fromJson("{updatedAt : '2003-10-10'}",
- Comment.class);
- comment.getUpdatedAt().setTime(0);
- assertTrue(comment.getUpdatedAt().getTime() != 0);
- }
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * Unit tests for {@link Comment} + */ +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class CommentTest { + + private static final Gson gson = new GsonBuilder().setDateFormat( + "yyyy-MM-dd").create(); + + @Test + public void getCreatedAt_ReferenceMutableObject() { + Comment comment = gson.fromJson("{createdAt : '2003-10-10'}", + Comment.class); + comment.getCreatedAt().setTime(0); + assertTrue(comment.getCreatedAt().getTime() != 0); + } + + @Test + public void getUpdatedAt_ReferenceMutableObject() { + Comment comment = gson.fromJson("{updatedAt : '2003-10-10'}", + Comment.class); + comment.getUpdatedAt().setTime(0); + assertTrue(comment.getUpdatedAt().getTime() != 0); + } +} diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java index e12b261d..a8eb4296 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistRevisionTest.java @@ -1,39 +1,39 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * Unit tests for {@link GistRevision}
- */
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class GistRevisionTest {
-
- private static final Gson gson = new GsonBuilder().setDateFormat(
- "yyyy-MM-dd").create();
-
- @Test
- public void getCreatedAt_ReferenceMutableObject() {
- GistRevision gistRevision = gson.fromJson(
- "{committedAt : '2003-10-10'}", GistRevision.class);
- gistRevision.getCommittedAt().setTime(0);
- assertTrue(gistRevision.getCommittedAt().getTime() != 0);
- }
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * Unit tests for {@link GistRevision} + */ +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class GistRevisionTest { + + private static final Gson gson = new GsonBuilder().setDateFormat( + "yyyy-MM-dd").create(); + + @Test + public void getCreatedAt_ReferenceMutableObject() { + GistRevision gistRevision = gson.fromJson( + "{committedAt : '2003-10-10'}", GistRevision.class); + gistRevision.getCommittedAt().setTime(0); + assertTrue(gistRevision.getCommittedAt().getTime() != 0); + } +} diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java index 29d2a15f..af5a0078 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GistTest.java @@ -1,46 +1,46 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * Unit tests for {@link Gist}
- */
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class GistTest {
-
- private static final Gson gson = new GsonBuilder().setDateFormat(
- "yyyy-MM-dd").create();
-
- @Test
- public void getCreatedAt_ReferenceMutableObject() {
- Gist gist = gson.fromJson("{createdAt : '2003-10-10'}", Gist.class);
- gist.getCreatedAt().setTime(0);
- assertTrue(gist.getCreatedAt().getTime() != 0);
- }
-
- @Test
- public void getUpdatedAt_ReferenceMutableObject() {
- Gist gist = gson.fromJson("{updatedAt : '2003-10-10'}", Gist.class);
- gist.getUpdatedAt().setTime(0);
- assertTrue(gist.getUpdatedAt().getTime() != 0);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * Unit tests for {@link Gist} + */ +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class GistTest { + + private static final Gson gson = new GsonBuilder().setDateFormat( + "yyyy-MM-dd").create(); + + @Test + public void getCreatedAt_ReferenceMutableObject() { + Gist gist = gson.fromJson("{createdAt : '2003-10-10'}", Gist.class); + gist.getCreatedAt().setTime(0); + assertTrue(gist.getCreatedAt().getTime() != 0); + } + + @Test + public void getUpdatedAt_ReferenceMutableObject() { + Gist gist = gson.fromJson("{updatedAt : '2003-10-10'}", Gist.class); + gist.getUpdatedAt().setTime(0); + assertTrue(gist.getUpdatedAt().getTime() != 0); + } + +} diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java index 088adb9f..a5748298 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/GitHubClientTest.java @@ -1,27 +1,27 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import org.eclipse.core.runtime.AssertionFailedException;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class GitHubClientTest {
-
- @Test(expected = AssertionFailedException.class)
- public void constructor_NullArgument() {
- new GitHubClient(null);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import org.eclipse.core.runtime.AssertionFailedException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class GitHubClientTest { + + @Test(expected = AssertionFailedException.class) + public void constructor_NullArgument() { + new GitHubClient(null); + } + +} diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java index f52e8887..65d0673b 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/IssueTest.java @@ -1,53 +1,53 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * Unit tests for {@link Issue}
- */
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class IssueTest {
-
- private static final Gson gson = new GsonBuilder().setDateFormat(
- "yyyy-MM-dd").create();
-
- @Test
- public void getCreatedAt_ReferenceMutableObject() {
- Issue issue = gson.fromJson("{createdAt : '2003-10-10'}", Issue.class);
- issue.getCreatedAt().setTime(0);
- assertTrue(issue.getCreatedAt().getTime() != 0);
- }
-
- @Test
- public void getUpdatedAt_ReferenceMutableObject() {
- Issue issue = gson.fromJson("{updatedAt : '2003-10-10'}", Issue.class);
- issue.getUpdatedAt().setTime(0);
- assertTrue(issue.getUpdatedAt().getTime() != 0);
- }
-
- @Test
- public void getClosedAt_ReferenceMutableObject() {
- Issue issue = gson.fromJson("{closedAt : '2003-10-10'}", Issue.class);
- issue.getClosedAt().setTime(0);
- assertTrue(issue.getClosedAt().getTime() != 0);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * Unit tests for {@link Issue} + */ +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class IssueTest { + + private static final Gson gson = new GsonBuilder().setDateFormat( + "yyyy-MM-dd").create(); + + @Test + public void getCreatedAt_ReferenceMutableObject() { + Issue issue = gson.fromJson("{createdAt : '2003-10-10'}", Issue.class); + issue.getCreatedAt().setTime(0); + assertTrue(issue.getCreatedAt().getTime() != 0); + } + + @Test + public void getUpdatedAt_ReferenceMutableObject() { + Issue issue = gson.fromJson("{updatedAt : '2003-10-10'}", Issue.class); + issue.getUpdatedAt().setTime(0); + assertTrue(issue.getUpdatedAt().getTime() != 0); + } + + @Test + public void getClosedAt_ReferenceMutableObject() { + Issue issue = gson.fromJson("{closedAt : '2003-10-10'}", Issue.class); + issue.getClosedAt().setTime(0); + assertTrue(issue.getClosedAt().getTime() != 0); + } + +} diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java index 957b4c5c..8230e71b 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/MilestoneTest.java @@ -1,48 +1,48 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-/**
- * Unit tests for {@link Milestone}
- */
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class MilestoneTest {
-
- private static final Gson gson = new GsonBuilder().setDateFormat(
- "yyyy-MM-dd").create();
-
- @Test
- public void getCreatedAt_ReferenceMutableObject() {
- Milestone milestone = gson.fromJson("{createdAt : '2003-10-10'}",
- Milestone.class);
- milestone.getCreatedAt().setTime(0);
- assertTrue(milestone.getCreatedAt().getTime() != 0);
- }
-
- @Test
- public void getDueOn_ReferenceMutableObject() {
- Milestone milestone = gson.fromJson("{dueOn : '2003-10-10'}",
- Milestone.class);
- milestone.getDueOn().setTime(0);
- assertTrue(milestone.getDueOn().getTime() != 0);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +/** + * Unit tests for {@link Milestone} + */ +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class MilestoneTest { + + private static final Gson gson = new GsonBuilder().setDateFormat( + "yyyy-MM-dd").create(); + + @Test + public void getCreatedAt_ReferenceMutableObject() { + Milestone milestone = gson.fromJson("{createdAt : '2003-10-10'}", + Milestone.class); + milestone.getCreatedAt().setTime(0); + assertTrue(milestone.getCreatedAt().getTime() != 0); + } + + @Test + public void getDueOn_ReferenceMutableObject() { + Milestone milestone = gson.fromJson("{dueOn : '2003-10-10'}", + Milestone.class); + milestone.getDueOn().setTime(0); + assertTrue(milestone.getDueOn().getTime() != 0); + } + +} diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java index 512c0804..4938f64a 100755 --- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java +++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/internal/PullRequestServiceTest.java @@ -1,93 +1,93 @@ -/*******************************************************************************
- * Copyright (c) 2011 Christian Trutz
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Trutz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.github.internal;
-
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.AssertionFailedException;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.runners.MockitoJUnitRunner;
-
-/**
- * Tests for {@link PullRequestServiceTest}
- */
-@SuppressWarnings("restriction")
-@RunWith(MockitoJUnitRunner.class)
-public class PullRequestServiceTest {
-
- @Mock
- private GitHubClient gitHubClient;
-
- @Mock
- private Repository repository;
-
- private PullRequestService pullRequestService;
-
- @Before
- public void before() {
- pullRequestService = new PullRequestService(gitHubClient);
- }
-
- @Test(expected = AssertionFailedException.class)
- public void constructor_NullArgument() {
- new PullRequestService(null);
- }
-
- @Test(expected = AssertionFailedException.class)
- public void getPullRequest_NullRepository() throws IOException {
- pullRequestService.getPullRequest(null, "not null");
- }
-
- @Test(expected = AssertionFailedException.class)
- public void getPullRequest_NullId() throws IOException {
- pullRequestService.getPullRequest(repository, null);
- }
-
- @Test(expected = AssertionFailedException.class)
- public void getPullRequest_NullRepositoryId() throws IOException {
- when(repository.getId()).thenReturn(null);
- pullRequestService.getPullRequest(repository, "test_id");
- }
-
- @Test
- @Ignore
- public void getPullRequest_OK() throws IOException {
- // the OK unit test is not possible with Mockito, but with JMockit
- }
-
- @Test(expected = AssertionFailedException.class)
- public void getPullRequests_NullRepository() throws IOException {
- pullRequestService.getPullRequests(null, "not null");
- }
-
- @Test(expected = AssertionFailedException.class)
- public void getPullRequests_NullState() throws IOException {
- pullRequestService.getPullRequests(repository, null);
- }
-
- @Test(expected = AssertionFailedException.class)
- public void getPullRequests_NullRepositoryId() throws IOException {
- when(repository.getId()).thenReturn(null);
- pullRequestService.getPullRequests(repository, "test_state");
- }
-
- @Test
- @Ignore
- public void getPullRequests_OK() throws IOException {
- // the OK unit test is not possible with Mockito, but with JMockit
- }
-}
+/******************************************************************************* + * Copyright (c) 2011 Christian Trutz + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian Trutz - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.github.internal; + +import static org.mockito.Mockito.when; + +import java.io.IOException; + +import org.eclipse.core.runtime.AssertionFailedException; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +/** + * Tests for {@link PullRequestServiceTest} + */ +@SuppressWarnings("restriction") +@RunWith(MockitoJUnitRunner.class) +public class PullRequestServiceTest { + + @Mock + private GitHubClient gitHubClient; + + @Mock + private Repository repository; + + private PullRequestService pullRequestService; + + @Before + public void before() { + pullRequestService = new PullRequestService(gitHubClient); + } + + @Test(expected = AssertionFailedException.class) + public void constructor_NullArgument() { + new PullRequestService(null); + } + + @Test(expected = AssertionFailedException.class) + public void getPullRequest_NullRepository() throws IOException { + pullRequestService.getPullRequest(null, "not null"); + } + + @Test(expected = AssertionFailedException.class) + public void getPullRequest_NullId() throws IOException { + pullRequestService.getPullRequest(repository, null); + } + + @Test(expected = AssertionFailedException.class) + public void getPullRequest_NullRepositoryId() throws IOException { + when(repository.getId()).thenReturn(null); + pullRequestService.getPullRequest(repository, "test_id"); + } + + @Test + @Ignore + public void getPullRequest_OK() throws IOException { + // the OK unit test is not possible with Mockito, but with JMockit + } + + @Test(expected = AssertionFailedException.class) + public void getPullRequests_NullRepository() throws IOException { + pullRequestService.getPullRequests(null, "not null"); + } + + @Test(expected = AssertionFailedException.class) + public void getPullRequests_NullState() throws IOException { + pullRequestService.getPullRequests(repository, null); + } + + @Test(expected = AssertionFailedException.class) + public void getPullRequests_NullRepositoryId() throws IOException { + when(repository.getId()).thenReturn(null); + pullRequestService.getPullRequests(repository, "test_state"); + } + + @Test + @Ignore + public void getPullRequests_OK() throws IOException { + // the OK unit test is not possible with Mockito, but with JMockit + } +} |