Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. <plugins>
  2. [...]
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-surefire-plugin</artifactId>
  6. <version>2.12.3</version>
  7. <configuration>
  8. <workingDirectory>${project.build.directory}</workingDirectory>
  9. </configuration>
  10. </plugin>
  11. [...]
  12. </plugins>
  13.  
  14. File tmpFile = ...
  15. try {
  16. // deal with tempFile
  17. } finally {
  18. tempFile.delete();
  19. }
  20.  
  21. public class MyTestCase {
  22. private File tmpFile = null;
  23.  
  24. @Before
  25. public void setUp() {
  26. tmpFile = ...;
  27. }
  28.  
  29. @Test
  30. public void setUp() {
  31. // deal with tmpFile
  32. }
  33.  
  34. @After
  35. public void setUp() {
  36. tmpFile.delete();
  37. }
  38. }
  39.  
  40. File file = File.createTempFile( "some-prefix", "some-ext");
  41. file.deleteOnExit();
  42.  
  43. File file = File.createTempFile( "prefix", "ext", new File("/some/dir/path"));
  44.  
  45. <plugin>
  46. <groupId>org.apache.maven.plugins</groupId>
  47. <artifactId>maven-surefire-plugin</artifactId>
  48. <version>2.6</version>
  49. <configuration>
  50. <systemPropertyVariables>
  51. <myOutDir>${project.build.outputDirectory}</myOutDir>
  52. </systemPropertyVariables>
  53. </configuration>
  54. </plugin>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement