return new MockMultipartFile("file", filename, "text/plain", content.getBytes())
}
+ def createZipMultipartFileFromResource(resourcePath) {
+ return new MockMultipartFile("file", "test.zip", "application/zip",
+ getClass().getResource(resourcePath).getBytes())
+ }
+
+ def createMultipartFileForIOException(extension) {
+ def multipartFile = Mock(MockMultipartFile)
+ multipartFile.getOriginalFilename() >> "TEST." + extension
+ multipartFile.getBytes() >> { throw new IOException() }
+ multipartFile.getInputStream() >> { throw new IOException() }
+ return multipartFile
+ }
+
def performCreateSchemaSetRequest(multipartFile) {
return mvc.perform(
- multipart(schemaSetsEndpoint)
+ multipart("$basePath$schemaSetsEndpoint")
.file(multipartFile)
.param('schema-set-name', 'test-schema-set')
).andReturn().response