BAEL-4088: clean-up.

This commit is contained in:
Tyrell Flurry 2020-05-29 18:23:01 -04:00
parent 012f903fe3
commit 15535cf0cf
2 changed files with 22 additions and 2 deletions

View File

@ -14,6 +14,11 @@
<relativePath>../parent-spring-5</relativePath> <relativePath>../parent-spring-5</relativePath>
</parent> </parent>
<properties>
<junit.version>4.12</junit.version>
<org.springframework.spring-mock.version>2.0.8</org.springframework.spring-mock.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
@ -23,13 +28,13 @@
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId> <artifactId>spring-mock</artifactId>
<version>2.0.8</version> <version>${org.springframework.spring-mock.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version> <version>${junit.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -12,6 +12,11 @@ import org.springframework.web.multipart.MultipartFile;
public class ConvertMultipartFileExample { public class ConvertMultipartFileExample {
/**
* Example of converting a {@link MultipartFile} to a {@link File} using {@link MultipartFile#getBytes()}.
*
* @throws IOException
*/
@Test @Test
public void whenGetBytes_thenOK() throws IOException { public void whenGetBytes_thenOK() throws IOException {
MultipartFile multipartFile = new MockMultipartFile("sourceFile.tmp", "Hello World".getBytes()); MultipartFile multipartFile = new MockMultipartFile("sourceFile.tmp", "Hello World".getBytes());
@ -25,6 +30,11 @@ public class ConvertMultipartFileExample {
os.close(); os.close();
} }
/**
* Example of converting a {@link MultipartFile} to a {@link File} using {@link MultipartFile#getInputStream()}.
*
* @throws IOException
*/
@Test @Test
public void whenGetInputStream_thenOK() throws IOException { public void whenGetInputStream_thenOK() throws IOException {
MultipartFile multipartFile = new MockMultipartFile("sourceFile.tmp", "Hello World".getBytes()); MultipartFile multipartFile = new MockMultipartFile("sourceFile.tmp", "Hello World".getBytes());
@ -40,6 +50,11 @@ public class ConvertMultipartFileExample {
outStream.close(); outStream.close();
} }
/**
* Example of converting a {@link MultipartFile} to a {@link File} using {@link MultipartFile#transferTo(File)}.
*
* @throws IOException
*/
@Test @Test
public void whenTransferTo_thenOK() throws IllegalStateException, IOException { public void whenTransferTo_thenOK() throws IllegalStateException, IOException {
MultipartFile multipartFile = new MockMultipartFile("sourceFile.tmp", "Hello World".getBytes()); MultipartFile multipartFile = new MockMultipartFile("sourceFile.tmp", "Hello World".getBytes());