Сравнивая два bytearrayinputstream, я сталкиваюсь с приведенными ниже ошибками для приведенной ниже функции
код здесь
@Test
public void fileIsSame() throws IOException, InvalidEndpointException, InvalidPortException, InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, InvalidArgumentException, XmlPullParserException {
FileInputStream file = new FileInputStream("/Users/gauris/Documents/samplephoto/pexels-photo-46710.jpeg");
String fileName = "pexels-photo-46710.jpeg";
ByteArrayInputStream uploadByteArrayInputStream = new ByteArrayInputStream(file.toString().getBytes());
minioClient.putObject(bucketName, fileName, uploadByteArrayInputStream, uploadByteArrayInputStream.available(), "application/octet-stream");
String actualresult = IOUtils.toString(uploadByteArrayInputStream, StandardCharsets.UTF_8);
InputStream stream = minioClient.getObject(bucketName, fileName);
byte currentXMLBytes[] = stream.toString().getBytes(); //convert inputStream to byteArrayInputStream;
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(currentXMLBytes);
String Expectedresult = IOUtils.toString(stream, StandardCharsets.UTF_8);
System.out.println("expected: "+Expectedresult);
System.out.println("actual: "+ actualresult);
//Arrays.equals((uploadByteArrayInputStream).toByteArray(), (byteInputStream).toByteArray());
assertEquals(byteInputStream.toString(), uploadByteArrayInputStream.toString());
uploadByteArrayInputStream.close();
stream.close();
}
Ошибки
org.junit.ComparisonFailure: expected:<...yteArrayInputStream@[43195e57]> but was:<...yteArrayInputStream@[333291e3]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)