import static org.hamcrest.text.StringEndsWith.endsWith;\r
import static org.junit.Assert.assertThat;\r
import org.junit.Before;\r
+import org.junit.Rule;\r
import org.junit.Test;\r
import static org.mockito.Matchers.anyObject;\r
import static org.mockito.Matchers.anyString;\r
import static org.mockito.Matchers.argThat;\r
import static org.mockito.Matchers.eq;\r
import static org.mockito.Mockito.*;\r
+\r
+import org.junit.rules.TemporaryFolder;\r
import org.sonar.api.CoreProperties;\r
import org.sonar.api.batch.maven.MavenPlugin;\r
import org.sonar.api.profiles.RulesProfile;\r
import java.util.regex.Pattern;\r
\r
public class FindbugsMavenPluginHandlerTest {\r
- private static final String TARGET_TMP_TESTS = "target/tmp-tests";\r
\r
+ @Rule\r
+ public TemporaryFolder tempFolder = new TemporaryFolder();\r
+ \r
private Project project;\r
private ProjectFileSystem fs;\r
private File fakeSonarConfig;\r
private MavenPlugin plugin;\r
private FindbugsMavenPluginHandler handler;\r
+ private File findbugsTempDir;\r
\r
@Before\r
public void setup() {\r
fakeSonarConfig = mock(File.class);\r
plugin = mock(MavenPlugin.class);\r
handler = createMavenPluginHandler();\r
+ findbugsTempDir = tempFolder.newFolder("findbugs");\r
}\r
\r
@Test\r
}\r
\r
private void assertFindbugsIncludeFileIsSaved() {\r
- File findbugsIncludeFile = new File(TARGET_TMP_TESTS + "/target/sonar/findbugs-include.xml");\r
+ File findbugsIncludeFile = new File(findbugsTempDir + "/target/sonar/findbugs-include.xml");\r
assertThat(findbugsIncludeFile.exists(), is(true));\r
}\r
\r
\r
private void mockProject(String effort) throws URISyntaxException, IOException {\r
when(project.getPom()).thenReturn(new MavenProject());\r
- when(project.getFileSystem()).thenReturn(new SimpleProjectFileSystem(new File(TARGET_TMP_TESTS)));\r
+ when(project.getFileSystem()).thenReturn(new SimpleProjectFileSystem(findbugsTempDir));\r
\r
Configuration conf = mock(Configuration.class);\r
when(project.getConfiguration()).thenReturn(conf);\r