Skip to content
This repository
Browse code

Small refactoring.

  • Loading branch information...
commit 140077fe60f57b7eedd0845c729aaf86bc5aeca6 1 parent 790570c
Célio Cidral Jr authored May 13, 2012
13  tomighty-swing/src/test/java/org/tomighty/plugin/impl/DefaultPluginManagerTest.java
@@ -20,13 +20,12 @@
20 20
 import org.junit.Test;
21 21
 import org.tomighty.bus.Bus;
22 22
 import org.tomighty.io.Directory;
23  
-import org.tomighty.io.FileSystemDirectory;
24 23
 import org.tomighty.plugin.*;
25 24
 
26 25
 import java.awt.*;
27  
-import java.util.ArrayList;
28 26
 import java.util.Set;
29 27
 
  28
+import static java.util.Arrays.asList;
30 29
 import static org.junit.Assert.*;
31 30
 import static org.mockito.Mockito.*;
32 31
 
@@ -57,20 +56,18 @@ public MenuItem getMenuItem() {
57 56
 
58 57
     @Before
59 58
     public void setUp() throws Exception {
60  
-
61 59
         //Initialize Stubs so we can test the relevant methods without getting NPEs ;)
62 60
         PluginPackFactory pluginPackFactoryMock = mock(PluginPackFactory.class);
63 61
 
64  
-        Directory directoryMock = mock(Directory.class);
65  
-        when(directoryMock.subdirs()).thenReturn(new ArrayList<Directory>() {{
66  
-            add(new FileSystemDirectory(null));
67  
-        }});
  62
+        Directory pluginsDirectory = mock(Directory.class);
  63
+        Directory somePluginSubdirectory = mock(Directory.class);
  64
+        when(pluginsDirectory.subdirs()).thenReturn(asList(somePluginSubdirectory));
68 65
 
69 66
         PluginLoader loaderMock = mock(PluginLoader.class);
70 67
         when(loaderMock.load(any(PluginPack.class))).thenReturn(new PluginStub());
71 68
 
72 69
         defaultPluginManager = new DefaultPluginManager(loaderMock, pluginPackFactoryMock, mock(Bus.class));
73  
-        defaultPluginManager.loadPluginsFrom(directoryMock);
  70
+        defaultPluginManager.loadPluginsFrom(pluginsDirectory);
74 71
 
75 72
     }
76 73
 

0 notes on commit 140077f

Please sign in to comment.
Something went wrong with that request. Please try again.