use of com.aliyun.oss.model.AppendObjectRequest in project aliyun-oss-java-sdk by aliyun.
the class CRCChecksumTest method testAppendObjectCRCNegative.
@Test
public void testAppendObjectCRCNegative() {
String key = "append-object-crc-neg";
String content = "Hello OSS, Hi OSS.";
try {
AppendObjectRequest appendObjectRequest = new AppendObjectRequest(bucketName, key, new ByteArrayInputStream(content.getBytes())).withPosition(0L);
appendObjectRequest.setInitCRC(1L);
ossClient.appendObject(appendObjectRequest);
Assert.fail("Append object should not be successful.");
} catch (Exception e) {
Assert.assertTrue(e instanceof InconsistentException);
ossClient.deleteObject(bucketName, key);
System.out.println(e);
}
}
Aggregations