@Test
public void shouldCreateDirInsideAppIfTempDirAreNotAvailable() throws Exception {

	DefaultMultipartConfig configSpy = (DefaultMultipartConfig) spy(config);
	doThrow(new IOException()).when(configSpy).createTempFile();
	
	interceptor = new CommonsUploadMultipartInterceptor(request, parameters, configSpy, validator, mockCreator);

	final List<FileItem> elements = new ArrayList<FileItem>();
	elements.add(new MockFileItem("myfile", "foo.txt", "bar".getBytes()));

	when(request.getContentType()).thenReturn("multipart/form-data");
	when(request.getMethod()).thenReturn("POST");
	when(mockUpload.parseRequest(request)).thenReturn(elements);

	interceptor.intercept(stack, method, instance);
	
	verify(configSpy).createDirInsideApplication();
}