Skip to content

Commit 8bd5cde

Browse files
author
Denis
committed
test refactor
1 parent 25b3d14 commit 8bd5cde

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/test/java/com/projectkaiser/scm/vcs/GitVCSTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.kohsuke.github.GitHub;
2323
import org.mockito.Mockito;
2424

25+
import com.projectkaiser.scm.vcs.api.IVCS;
2526
import com.projectkaiser.scm.vcs.api.abstracttest.VCSAbstractTest;
2627
import com.projectkaiser.scm.vcs.api.workingcopy.IVCSLockedWorkingCopy;
2728
import com.projectkaiser.scm.vcs.api.workingcopy.IVCSRepositoryWorkspace;
@@ -160,12 +161,13 @@ protected String getVCSRepoUrl() {
160161
}
161162

162163
@Override
163-
protected void createVCS(IVCSRepositoryWorkspace mockedVCSRepo) {
164-
vcs = Mockito.spy(new GitVCS(mockedVCSRepo));
164+
protected IVCS getVCS(IVCSRepositoryWorkspace mockedVCSRepo) {
165+
IVCS vcs = Mockito.spy(new GitVCS(mockedVCSRepo));
165166
vcs.setCredentials(GITHUB_USER, GITHUB_PASS);
166167
if (PROXY_HOST != null) {
167168
vcs.setProxy(PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASS);
168169
}
170+
return vcs;
169171
}
170172

171173
@Override
@@ -174,7 +176,7 @@ protected Set<String> getBranches() throws IOException {
174176
}
175177

176178
@Override
177-
protected Set<String> getCommitMessagesRemote(String branchName) throws Exception {
179+
protected Set<String> getCommitMessagesRemote(String branchName) throws Exception {
178180
try (IVCSLockedWorkingCopy wc = localVCSRepo.getVCSLockedWorkingCopy()) {
179181
try (Git git = ((GitVCS) vcs).getLocalGit(wc)) {
180182
Iterable<RevCommit> logs = git
@@ -202,9 +204,5 @@ protected void setMakeFailureOnVCSReset(Boolean doMakeFailure) {
202204
mockedGit = null;
203205
}
204206
}
205-
206-
207-
208-
209207
}
210208

0 commit comments

Comments
 (0)