[jbosstools-issues] [JBoss JIRA] (JBIDE-18053) Add Powermock to the target platform

Jeff Cantrill (JIRA) issues at jboss.org
Thu Aug 7 14:18:30 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-18053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12991374#comment-12991374 ] 

Jeff Cantrill commented on JBIDE-18053:
---------------------------------------

[~phantomjinx] [~adietish]  I don't really want to preach too extensively about unit testing best practices, but generally it is most desirable to isolate your test code from interface points which you have limited control (e.g. the file system, network) or leave behind undesirable artifacts or require you to clean-up.  Unit tests are supposed to allow you to quickly test code without dependency on such interfaces.  Powermock extends the great features of mockito by allowing stubbing of constructor methods without forcing you to introduce an interface or factory method; these kind of classes, in this specific case, would just be extraneous.  Powermock also allows you to stub static methods.  We, IMO, should prefer the use of mocking and stubbing in unit tests where appropriate over relying on OS functions; thats what integration tests are for.

> Add Powermock to the target platform
> ------------------------------------
>
>                 Key: JBIDE-18053
>                 URL: https://issues.jboss.org/browse/JBIDE-18053
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: build
>    Affects Versions: 4.2.x
>            Reporter: Jeff Cantrill
>            Assignee: Nick Boldt
>             Fix For: 4.2.0.CR1
>
>
> Reason:  To improving testing by allowing the stubbing of scenerios like "new File(path).exists()" which require bytecode modifications in order to accomplish.  Example of intended use: https://gist.github.com/jcantrill/fd83c27d3fc542742ec7
>   License and owner:  Apache 2.0 / https://github.com/jayway
>   Original repo: https://github.com/jayway/powermock
>   JBoss mirror: Unknown
>   Sources: Unknown
>   Affected projects:
>   Include in JBDS: *No*
>   Type of dependency: testing
>   List of bundles added/removed:
> {code}
> + <unit id="org.powermock.mockito-junit.feature.feature.group" version="1.5.4.1"/>
> + <unit id="org.objenesis" version="2.1.0"/>
> + <unit id="javassist" version="3.18.1.GA"/>
> {code}
>   If applicable:
>     non-p2 repository:
>     non-p2 ids:



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jbosstools-issues mailing list