[forge-dev] Working outside of a project during test case execution.

Lincoln Baxter, III lincolnbaxter at gmail.com
Thu Mar 8 11:12:58 EST 2012


Specifically, this code in your test case does the trick:


   @Test
   public void testGitPluginNoProject() throws Exception
   {
       getShell().setCurrentResource(createTempFolder());
       ...
   }

As long as you are extending from AbstractShellTest, these functions will
be available.

On Thu, Mar 8, 2012 at 10:30 AM, Lincoln Baxter, III <
lincolnbaxter at gmail.com> wrote:

> Hey guys,
>
> I saw this come up during the meeting, and wanted to share the answer. It
> should be straightforward to simulate working "outside" of a project in a
> test case. Just create a temp folder (using the Java file API) then either
> CD to that folder, or get a resource handle to it by @Injecting the
> ResourceFactory, then set that resource as the current resource using:
>
> shell.setCurrentResource(directory);
>>
>
> This is the best way I can think of to achieve this. If it's not working,
> then there's a bug somewhere, probably a nasty one :)
>
> ~Lincoln
>
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>



-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20120308/aa926e14/attachment.html 


More information about the forge-dev mailing list