You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2020/05/11 17:42:00 UTC

[jira] [Comment Edited] (SCM-939) Assume SCM is present

    [ https://issues.apache.org/jira/browse/SCM-939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17104459#comment-17104459 ] 

Michael Osipov edited comment on SCM-939 at 5/11/20, 5:41 PM:
--------------------------------------------------------------

Problem is PlexusTestCase.setUp catches AssumptionViolatedException and converts it into an AssertionFailure. This is your weekly reminder never to catch java.lang.Exception.

{{}}{{try}}
{{ {}}
{{ configuration = getCustomConfiguration();}}{{if ( configuration == null )}}
{{ {}}
{{ configuration = getConfiguration();}}
{{ }}}
{{ }}}
{{ catch ( Exception e )}}
{{ {}}
{{ System.out.println( "Error with configuration:" );}}{{System.out.println( "configuration = " + configuration );}}{{fail( e.getMessage() );}}
{{ }}}


was (Author: elharo):
Problem is PlexusTestCase.setUp catches AssumptionViolatedException and converts it into an AssertionFailure. This is your wekkly reminder never to catch java.lang.Exception.

{{}}{{try}}
{{ {}}
{{ configuration = getCustomConfiguration();}}{{if ( configuration == null )}}
{{ {}}
{{ configuration = getConfiguration();}}
{{ }}}
{{ }}}
{{ catch ( Exception e )}}
{{ {}}
{{ System.out.println( "Error with configuration:" );}}{{System.out.println( "configuration = " + configuration );}}{{fail( e.getMessage() );}}
{{ }}}

> Assume SCM is present
> ---------------------
>
>                 Key: SCM-939
>                 URL: https://issues.apache.org/jira/browse/SCM-939
>             Project: Maven SCM
>          Issue Type: Bug
>            Reporter: Elliotte Rusty Harold
>            Priority: Minor
>
> We have a lot of tests that do something like this:
>  
> if ( !ScmTestCase.isSystemCmd( SvnScmTestUtils.SVN_COMMAND_LINE ) )
>  {
>  ScmTestCase.printSystemCmdUnavail( SvnScmTestUtils.SVN_COMMAND_LINE, getName() );
>  return;
>  }
>  
> We should instead use org.*junit*.*Assume* here so these are marked as skipped rather than passed.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)