|
spring-test | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.mock.web.MockMultipartFile
public class MockMultipartFile
Mock implementation of the MultipartFile
interface.
Useful in conjunction with a MockMultipartHttpServletRequest
for testing application controllers that access multipart uploads.
MockMultipartHttpServletRequest
Constructor Summary | |
---|---|
MockMultipartFile(java.lang.String name,
byte[] content)
Create a new MockMultipartFile with the given content. |
|
MockMultipartFile(java.lang.String name,
java.io.InputStream contentStream)
Create a new MockMultipartFile with the given content. |
|
MockMultipartFile(java.lang.String name,
java.lang.String originalFilename,
java.lang.String contentType,
byte[] content)
Create a new MockMultipartFile with the given content. |
|
MockMultipartFile(java.lang.String name,
java.lang.String originalFilename,
java.lang.String contentType,
java.io.InputStream contentStream)
Create a new MockMultipartFile with the given content. |
Method Summary | |
---|---|
byte[] |
getBytes()
|
java.lang.String |
getContentType()
|
java.io.InputStream |
getInputStream()
|
java.lang.String |
getName()
|
java.lang.String |
getOriginalFilename()
|
long |
getSize()
|
boolean |
isEmpty()
|
void |
transferTo(java.io.File dest)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockMultipartFile(java.lang.String name, byte[] content)
name
- the name of the filecontent
- the content of the filepublic MockMultipartFile(java.lang.String name, java.io.InputStream contentStream) throws java.io.IOException
name
- the name of the filecontentStream
- the content of the file as stream
java.io.IOException
- if reading from the stream failedpublic MockMultipartFile(java.lang.String name, java.lang.String originalFilename, java.lang.String contentType, byte[] content)
name
- the name of the fileoriginalFilename
- the original filename (as on the client's machine)contentType
- the content type (if known)content
- the content of the filepublic MockMultipartFile(java.lang.String name, java.lang.String originalFilename, java.lang.String contentType, java.io.InputStream contentStream) throws java.io.IOException
name
- the name of the fileoriginalFilename
- the original filename (as on the client's machine)contentType
- the content type (if known)contentStream
- the content of the file as stream
java.io.IOException
- if reading from the stream failedMethod Detail |
---|
public java.lang.String getName()
getName
in interface org.springframework.web.multipart.MultipartFile
public java.lang.String getOriginalFilename()
getOriginalFilename
in interface org.springframework.web.multipart.MultipartFile
public java.lang.String getContentType()
getContentType
in interface org.springframework.web.multipart.MultipartFile
public boolean isEmpty()
isEmpty
in interface org.springframework.web.multipart.MultipartFile
public long getSize()
getSize
in interface org.springframework.web.multipart.MultipartFile
public byte[] getBytes() throws java.io.IOException
getBytes
in interface org.springframework.web.multipart.MultipartFile
java.io.IOException
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface org.springframework.web.multipart.MultipartFile
java.io.IOException
public void transferTo(java.io.File dest) throws java.io.IOException, java.lang.IllegalStateException
transferTo
in interface org.springframework.web.multipart.MultipartFile
java.io.IOException
java.lang.IllegalStateException
|
spring-test | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |