@Test(expected=IllegalArgumentException.class) public void testWithTemporalDirectory$failIfNoWritable() { new MockUp<File>() { @Mock boolean canWrite() { return false; } }; File directory=new File(System.getProperty("java.io.tmpdir")); Deployment.newInstance().withTemporalDirectory(directory); }
Deployment withTemporalDirectory(File temporalDirectory) { checkNotNull(temporalDirectory,"Temporal directory cannot be null"); checkArgument(temporalDirectory.isDirectory(),"Path %s cannot be used as a temporal directory (it is not a directory)",temporalDirectory.getAbsolutePath()); checkArgument(temporalDirectory.canWrite(),"Path %s cannot be used as a temporal directory (cannot be written)",temporalDirectory.getAbsolutePath()); this.temporalDirectory=temporalDirectory; return this; }
Deployment { Deployment withTemporalDirectory(File temporalDirectory) { checkNotNull(temporalDirectory,"Temporal directory cannot be null"); checkArgument(temporalDirectory.isDirectory(),"Path %s cannot be used as a temporal directory (it is not a directory)",temporalDirectory.getAbsolutePath()); checkArgument(temporalDirectory.canWrite(),"Path %s cannot be used as a temporal directory (cannot be written)",temporalDirectory.getAbsolutePath()); this.temporalDirectory=temporalDirectory; return this; } }
Deployment { Deployment withTemporalDirectory(File temporalDirectory) { checkNotNull(temporalDirectory,"Temporal directory cannot be null"); checkArgument(temporalDirectory.isDirectory(),"Path %s cannot be used as a temporal directory (it is not a directory)",temporalDirectory.getAbsolutePath()); checkArgument(temporalDirectory.canWrite(),"Path %s cannot be used as a temporal directory (cannot be written)",temporalDirectory.getAbsolutePath()); this.temporalDirectory=temporalDirectory; return this; } private  Deployment(String contextPath, File temporalDirectory); }
Deployment { Deployment withTemporalDirectory(File temporalDirectory) { checkNotNull(temporalDirectory,"Temporal directory cannot be null"); checkArgument(temporalDirectory.isDirectory(),"Path %s cannot be used as a temporal directory (it is not a directory)",temporalDirectory.getAbsolutePath()); checkArgument(temporalDirectory.canWrite(),"Path %s cannot be used as a temporal directory (cannot be written)",temporalDirectory.getAbsolutePath()); this.temporalDirectory=temporalDirectory; return this; } private  Deployment(String contextPath, File temporalDirectory);  }
Deployment { Deployment withTemporalDirectory(File temporalDirectory) { checkNotNull(temporalDirectory,"Temporal directory cannot be null"); checkArgument(temporalDirectory.isDirectory(),"Path %s cannot be used as a temporal directory (it is not a directory)",temporalDirectory.getAbsolutePath()); checkArgument(temporalDirectory.canWrite(),"Path %s cannot be used as a temporal directory (cannot be written)",temporalDirectory.getAbsolutePath()); this.temporalDirectory=temporalDirectory; return this; } private  Deployment(String contextPath, File temporalDirectory);   }