本文整理汇总了Java中org.apache.commons.io.IOUtils.contentEquals方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.contentEquals方法的具体用法?Java IOUtils.contentEquals怎么用?Java IOUtils.contentEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.io.IOUtils
的用法示例。
在下文中一共展示了IOUtils.contentEquals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTest
import org.apache.commons.io.IOUtils; //导入方法依赖的package包/类
@Test
public void getTest() throws IOException {
String id;
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
id = pdfFile.getId();
}
FileRef fileRef = repository.get(id);
assertThat(fileRef, is(notNullValue()));
assertThat(fileRef.getName(), is("test.pdf"));
assertThat(fileRef.getContentType(), is("application/pdf"));
assertThat(fileRef.getSize(), is(greaterThan(0L)));
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
IOUtils.contentEquals(stream, stream2);
}
}
示例2: resetTest
import org.apache.commons.io.IOUtils; //导入方法依赖的package包/类
@Test
public void resetTest() throws IOException {
String id;
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
id = pdfFile.getId();
}
FileRef fileRef = repository.get(id);
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
IOUtils.contentEquals(stream, stream2);
}
repository.reset(fileRef);
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
IOUtils.contentEquals(stream, stream2);
}
}
示例3: deleteMissingFileTest
import org.apache.commons.io.IOUtils; //导入方法依赖的package包/类
@Test
public void deleteMissingFileTest() throws IOException {
String id;
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
id = pdfFile.getId();
}
FileRef fileRef = repository.get(id);
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
IOUtils.contentEquals(stream, stream2);
}
repository.del(fileRef);
repository.del(fileRef);
assertThrown(() -> repository.get(id))
.isInstanceOf(MissingObject.class);
}
示例4: deleteTest
import org.apache.commons.io.IOUtils; //导入方法依赖的package包/类
@Test
public void deleteTest() throws IOException {
String id;
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf")) {
FileRef pdfFile = repository.create(stream, "test.pdf", "application/pdf", false);
id = pdfFile.getId();
}
FileRef fileRef = repository.get(id);
try (InputStream stream = resource("cz/inqool/uas/file/test.pdf"); InputStream stream2 = fileRef.getStream()) {
IOUtils.contentEquals(stream, stream2);
}
repository.del(fileRef);
assertThrown(() -> repository.get(id))
.isInstanceOf(MissingObject.class);
}
示例5: verifyFilesOnEqual
import org.apache.commons.io.IOUtils; //导入方法依赖的package包/类
@Override
public void verifyFilesOnEqual(String filePath, File lastDownloadedFile) throws IOException, SAXException, ParserConfigurationException {
Reader expectedFile = new FileReader(lastDownloadedFile);
Reader actualFile = new FileReader(filePath);
boolean isEquals = IOUtils.contentEquals(expectedFile, actualFile);
Assert.assertTrue("File must be equal on 100%", isEquals);
}