@@ -196,17 +196,17 @@ public void testExceptions() throws Exception {
196
196
private void testExceptionThrowingNoMock (Exception testException , Method m , Object [] params ) throws Exception {
197
197
try {
198
198
m .invoke (vcs , params );
199
- if (wasGetLocalGitInvoked (vcs )) {
199
+ if (! m . getName (). equals ( "checkout" ) && wasGetLocalGitInvoked (vcs )) {
200
200
fail ();
201
201
}
202
202
} catch (InvocationTargetException e ) {
203
- if (wasGetLocalGitInvoked (vcs )) {
203
+ if (! m . getName (). equals ( "checkout" ) && wasGetLocalGitInvoked (vcs )) {
204
204
// InvocationTargetException <- EVCSException <- GitAPIException
205
205
assertTrue (e .getCause ().getCause ().getClass ().isAssignableFrom (testException .getClass ()));
206
206
assertTrue (e .getCause ().getMessage ().contains (testException .getMessage ()));
207
207
}
208
208
} catch (Exception e ) {
209
- if (wasGetLocalGitInvoked (vcs )) {
209
+ if (! m . getName (). equals ( "checkout" ) && wasGetLocalGitInvoked (vcs )) {
210
210
fail ();
211
211
}
212
212
}
@@ -287,6 +287,18 @@ public void testGetLastTagUnannotatedTag() throws Exception {
287
287
assertEquals (tag .getRelatedCommit (), vcs .getHeadCommit (null ));
288
288
}
289
289
290
+ @ Test
291
+ public void testGetTagsUnannotated () throws Exception {
292
+ createUnannotatedTag (null , TAG_NAME_1 );
293
+ List <VCSTag > tags = vcs .getTags ();
294
+ assertTrue (tags .size () == 1 );
295
+ VCSTag tag = tags .get (0 );
296
+ assertNull (tag .getAuthor ());
297
+ assertNull (tag .getTagMessage ());
298
+ assertEquals (tag .getTagName (), TAG_NAME_1 );
299
+ assertEquals (tag .getRelatedCommit (), vcs .getHeadCommit (null ));
300
+ }
301
+
290
302
public void createUnannotatedTag (String branchName , String tagName ) throws Exception {
291
303
try (IVCSLockedWorkingCopy wc = localVCSRepo .getVCSLockedWorkingCopy ();
292
304
Git localGit = git .getLocalGit (wc );
@@ -330,5 +342,18 @@ public void testGetLastTagExceptions() throws Exception {
330
342
Mockito .doThrow (eCommon ).when (git ).getLocalGit (mockedLWC );
331
343
testExceptionThrowingNoMock (eCommon , vcs .getClass ().getDeclaredMethod ("getLastTag" ), new Object [0 ]);
332
344
}
345
+
346
+ @ Test
347
+ public void testCheckoutExceptions () throws Exception {
348
+ Exception eCommon = new Exception ("test common exception" );
349
+ Mockito .doThrow (eCommon ).when (git ).getLocalGit ((String ) null );
350
+ try {
351
+ git .checkout (null , null );
352
+ fail ();
353
+ } catch (RuntimeException e ) {
354
+ assertTrue (e .getCause ().getClass ().isAssignableFrom (eCommon .getClass ()));
355
+ assertTrue (e .getCause ().getMessage ().contains (eCommon .getMessage ()));
356
+ }
357
+ }
333
358
}
334
359
0 commit comments