@@ -196,17 +196,17 @@ public void testExceptions() throws Exception {
196196 private void testExceptionThrowingNoMock (Exception testException , Method m , Object [] params ) throws Exception {
197197 try {
198198 m .invoke (vcs , params );
199- if (wasGetLocalGitInvoked (vcs )) {
199+ if (! m . getName (). equals ( "checkout" ) && wasGetLocalGitInvoked (vcs )) {
200200 fail ();
201201 }
202202 } catch (InvocationTargetException e ) {
203- if (wasGetLocalGitInvoked (vcs )) {
203+ if (! m . getName (). equals ( "checkout" ) && wasGetLocalGitInvoked (vcs )) {
204204 // InvocationTargetException <- EVCSException <- GitAPIException
205205 assertTrue (e .getCause ().getCause ().getClass ().isAssignableFrom (testException .getClass ()));
206206 assertTrue (e .getCause ().getMessage ().contains (testException .getMessage ()));
207207 }
208208 } catch (Exception e ) {
209- if (wasGetLocalGitInvoked (vcs )) {
209+ if (! m . getName (). equals ( "checkout" ) && wasGetLocalGitInvoked (vcs )) {
210210 fail ();
211211 }
212212 }
@@ -287,6 +287,18 @@ public void testGetLastTagUnannotatedTag() throws Exception {
287287 assertEquals (tag .getRelatedCommit (), vcs .getHeadCommit (null ));
288288 }
289289
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+
290302 public void createUnannotatedTag (String branchName , String tagName ) throws Exception {
291303 try (IVCSLockedWorkingCopy wc = localVCSRepo .getVCSLockedWorkingCopy ();
292304 Git localGit = git .getLocalGit (wc );
@@ -330,5 +342,18 @@ public void testGetLastTagExceptions() throws Exception {
330342 Mockito .doThrow (eCommon ).when (git ).getLocalGit (mockedLWC );
331343 testExceptionThrowingNoMock (eCommon , vcs .getClass ().getDeclaredMethod ("getLastTag" ), new Object [0 ]);
332344 }
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+ }
333358}
334359
0 commit comments