BAEL-4088: code review comments addressed.

This commit is contained in:
Tyrell Flurry 2020-06-02 16:09:16 -04:00
parent 0f36d61b67
commit 282e9be3f8
2 changed files with 12 additions and 4 deletions

View File

@ -17,6 +17,7 @@
<properties>
<commons-io.version>2.6</commons-io.version>
<junit.version>4.12</junit.version>
<org.assertj.assertj-core.version>3.15.0</org.assertj.assertj-core.version>
<org.springframework.spring-mock.version>2.0.8</org.springframework.spring-mock.version>
</properties>
@ -26,6 +27,12 @@
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${org.assertj.assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>

View File

@ -1,5 +1,7 @@
package com.baeldung.multipart.file;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -7,7 +9,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
@ -29,7 +30,7 @@ public class ConvertMultipartFileExample {
os.write(multipartFile.getBytes());
}
Assert.assertEquals(FileUtils.readFileToString(new File("src/main/resources/targetFile.tmp"), "UTF-8"), "Hello World");
assertThat(FileUtils.readFileToString(new File("src/main/resources/targetFile.tmp"), "UTF-8")).isEqualTo("Hello World");
}
/**
@ -51,7 +52,7 @@ public class ConvertMultipartFileExample {
outStream.write(buffer);
}
Assert.assertEquals(FileUtils.readFileToString(new File("src/main/resources/targetFile.tmp"), "UTF-8"), "Hello World");
assertThat(FileUtils.readFileToString(new File("src/main/resources/targetFile.tmp"), "UTF-8")).isEqualTo("Hello World");
}
/**
@ -67,6 +68,6 @@ public class ConvertMultipartFileExample {
multipartFile.transferTo(file);
Assert.assertEquals(FileUtils.readFileToString(new File("src/main/resources/targetFile.tmp"), "UTF-8"), "Hello World");
assertThat(FileUtils.readFileToString(new File("src/main/resources/targetFile.tmp"), "UTF-8")).isEqualTo("Hello World");
}
}