|
1 | 1 | package org.scm4j.vcs.svn; |
2 | 2 |
|
| 3 | +import static org.junit.Assert.assertEquals; |
| 4 | +import static org.junit.Assert.assertNotNull; |
| 5 | +import static org.junit.Assert.assertNull; |
| 6 | +import static org.junit.Assert.assertTrue; |
| 7 | +import static org.junit.Assert.fail; |
| 8 | +import static org.mockito.Matchers.any; |
| 9 | +import static org.mockito.Matchers.anyBoolean; |
| 10 | +import static org.mockito.Matchers.anyLong; |
| 11 | +import static org.mockito.Matchers.anyString; |
| 12 | +import static org.mockito.Matchers.isNull; |
| 13 | +import static org.mockito.Mockito.doCallRealMethod; |
| 14 | +import static org.mockito.Mockito.doReturn; |
| 15 | +import static org.mockito.Mockito.doThrow; |
| 16 | +import static org.mockito.Mockito.mock; |
| 17 | +import static org.mockito.Mockito.reset; |
| 18 | +import static org.mockito.Mockito.spy; |
| 19 | +import static org.mockito.Mockito.verify; |
| 20 | + |
| 21 | +import java.io.File; |
| 22 | +import java.io.IOException; |
| 23 | +import java.io.OutputStream; |
| 24 | +import java.lang.reflect.Field; |
| 25 | +import java.lang.reflect.InvocationTargetException; |
| 26 | +import java.lang.reflect.Method; |
| 27 | +import java.lang.reflect.Modifier; |
| 28 | +import java.util.Arrays; |
| 29 | +import java.util.Collection; |
| 30 | +import java.util.List; |
| 31 | + |
3 | 32 | import org.junit.After; |
4 | 33 | import org.junit.Test; |
5 | 34 | import org.mockito.Matchers; |
|
10 | 39 | import org.scm4j.vcs.api.abstracttest.VCSAbstractTest; |
11 | 40 | import org.scm4j.vcs.api.exceptions.EVCSException; |
12 | 41 | import org.scm4j.vcs.api.workingcopy.IVCSRepositoryWorkspace; |
13 | | -import org.tmatesoft.svn.core.*; |
| 42 | +import org.tmatesoft.svn.core.ISVNLogEntryHandler; |
| 43 | +import org.tmatesoft.svn.core.SVNDepth; |
| 44 | +import org.tmatesoft.svn.core.SVNDirEntry; |
| 45 | +import org.tmatesoft.svn.core.SVNErrorCode; |
| 46 | +import org.tmatesoft.svn.core.SVNErrorMessage; |
| 47 | +import org.tmatesoft.svn.core.SVNException; |
| 48 | +import org.tmatesoft.svn.core.SVNNodeKind; |
| 49 | +import org.tmatesoft.svn.core.SVNProperties; |
| 50 | +import org.tmatesoft.svn.core.SVNURL; |
14 | 51 | import org.tmatesoft.svn.core.auth.ISVNProxyManager; |
15 | 52 | import org.tmatesoft.svn.core.auth.SVNAuthentication; |
16 | 53 | import org.tmatesoft.svn.core.auth.SVNPasswordAuthentication; |
17 | 54 | import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions; |
18 | 55 | import org.tmatesoft.svn.core.io.SVNRepository; |
19 | | -import org.tmatesoft.svn.core.wc.*; |
20 | | - |
21 | | -import java.io.File; |
22 | | -import java.io.IOException; |
23 | | -import java.io.OutputStream; |
24 | | -import java.lang.reflect.Field; |
25 | | -import java.lang.reflect.InvocationTargetException; |
26 | | -import java.lang.reflect.Method; |
27 | | -import java.lang.reflect.Modifier; |
28 | | -import java.util.ArrayList; |
29 | | -import java.util.Arrays; |
30 | | -import java.util.Collection; |
31 | | -import java.util.List; |
32 | | - |
33 | | -import static org.junit.Assert.*; |
34 | | -import static org.mockito.Matchers.any; |
35 | | -import static org.mockito.Matchers.anyBoolean; |
36 | | -import static org.mockito.Matchers.anyLong; |
37 | | -import static org.mockito.Matchers.anyString; |
38 | | -import static org.mockito.Matchers.isNull; |
39 | | -import static org.mockito.Mockito.*; |
| 56 | +import org.tmatesoft.svn.core.wc.SVNClientManager; |
| 57 | +import org.tmatesoft.svn.core.wc.SVNCommitClient; |
| 58 | +import org.tmatesoft.svn.core.wc.SVNStatusClient; |
| 59 | +import org.tmatesoft.svn.core.wc.SVNStatusType; |
| 60 | +import org.tmatesoft.svn.core.wc.SVNWCClient; |
40 | 61 |
|
41 | 62 | public class SVNVCSTest extends VCSAbstractTest { |
42 | 63 |
|
@@ -154,7 +175,7 @@ private void testExceptionThrowing(Exception testException, Method m, Object[] p |
154 | 175 | reset(svn); |
155 | 176 | doThrow(testException).when(svn).checkout(any(SVNURL.class), any(File.class), (String) isNull()); |
156 | 177 | doThrow(testException).when(svn).getBranchUrl(null); |
157 | | - doThrow(testException).when(svn).listEntries(Matchers.<List<String>>any(), anyString(), anyString()); |
| 178 | + doThrow(testException).when(svn).listEntries(anyString(), anyString()); |
158 | 179 | doThrow(testException).when(svn).getBranchFirstCommit(null); |
159 | 180 | doThrow(testException).when(svn).revToSVNEntry(anyString(), any(Long.class)); |
160 | 181 | try { |
@@ -186,7 +207,7 @@ private boolean wasMockedMethodInvoked() throws Exception { |
186 | 207 | } catch (WantedButNotInvoked e1) { |
187 | 208 | } |
188 | 209 | try { |
189 | | - verify(svn).listEntries(Matchers.<List<String>>any(), anyString(), anyString()); |
| 210 | + verify(svn).listEntries(anyString(), anyString()); |
190 | 211 | return true; |
191 | 212 | } catch (WantedButNotInvoked e1) { |
192 | 213 | } |
@@ -311,20 +332,6 @@ public void setFileContentWCCorruption() throws Exception { |
311 | 332 | assertTrue(mockedLWC.getCorrupted()); |
312 | 333 | } |
313 | 334 |
|
314 | | - |
315 | | - @Test |
316 | | - public void testAddTrunkIfExistsExceptions() throws Exception { |
317 | | - SVNRepository mockedRepo = spy(svn.getSVNRepository()); |
318 | | - svn.setSVNRepository(mockedRepo); |
319 | | - doThrow(testSVNException).when(mockedRepo).checkPath(anyString(),anyLong()); |
320 | | - try { |
321 | | - svn.addTrunkIfExists(null); |
322 | | - fail(); |
323 | | - } catch (EVCSException e) { |
324 | | - checkEVCSException(e); |
325 | | - } |
326 | | - } |
327 | | - |
328 | 335 | private void checkEVCSException(EVCSException e) { |
329 | 336 | assertTrue(e.getCause() instanceof SVNException); |
330 | 337 | assertTrue(e.getCause().getMessage().contains(testSVNException.getMessage())); |
@@ -394,14 +401,12 @@ public void testListEntriesSorting() throws Exception { |
394 | 401 | doReturn(Arrays.asList(entry1, entry2)).when(mockedRepo).getDir(anyString(), anyLong(), any(SVNProperties.class), |
395 | 402 | Matchers.<Collection<SVNDirEntry>>any()); |
396 | 403 |
|
397 | | - List<String> entries = new ArrayList<>(); |
398 | | - svn.listEntries(entries, "", ""); |
| 404 | + List<String> entries = svn.listEntries("", ""); |
399 | 405 | assertEquals(entries.get(0), entry1.getName()); |
400 | 406 | assertEquals(entries.get(1), entry2.getName()); |
401 | 407 | doReturn(Arrays.asList(entry1, entry1)).when(mockedRepo).getDir(anyString(), anyLong(), any(SVNProperties.class), |
402 | 408 | Matchers.<Collection<SVNDirEntry>>any()); |
403 | | - entries = new ArrayList<>(); |
404 | | - svn.listEntries(entries, "", ""); |
| 409 | + entries = svn.listEntries("", ""); |
405 | 410 | assertEquals(entries.get(0), entry1.getName()); |
406 | 411 | assertEquals(entries.get(1), entry1.getName()); |
407 | 412 | } |
@@ -431,6 +436,6 @@ public void testListEntriesNone() throws Exception { |
431 | 436 | SVNRepository mockedRepo = spy(svn.getSVNRepository()); |
432 | 437 | svn.setSVNRepository(mockedRepo); |
433 | 438 | doReturn(SVNNodeKind.NONE).when(mockedRepo).checkPath(anyString(), anyLong()); |
434 | | - svn.listEntries(null, null, null); // expecting no NPE |
| 439 | + svn.listEntries(null, null); // expecting no NPE |
435 | 440 | } |
436 | 441 | } |
0 commit comments