Skip to content

Commit 1991dd9

Browse files
hoisieglide-copybara-robot
authored andcommitted
Migrate from Robolectric's Util.readBytes to Guava ByteStreams
Robolectric's Util.readBytes is being removed. PiperOrigin-RevId: 826666376
1 parent 37a9550 commit 1991dd9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

library/test/src/test/java/com/bumptech/glide/load/resource/bitmap/DefaultImageHeaderParserTest.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
1111
import com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool;
1212
import com.bumptech.glide.testutil.TestResourceUtil;
13+
import com.google.common.io.ByteStreams;
1314
import java.io.ByteArrayInputStream;
1415
import java.io.FilterInputStream;
1516
import java.io.IOException;
@@ -19,7 +20,6 @@
1920
import org.junit.Test;
2021
import org.junit.runner.RunWith;
2122
import org.robolectric.RobolectricTestRunner;
22-
import org.robolectric.util.Util;
2323

2424
@RunWith(RobolectricTestRunner.class)
2525
public class DefaultImageHeaderParserTest {
@@ -505,7 +505,8 @@ public void run(
505505

506506
@Test
507507
public void testCanParseRealAnimatedWebpFile() throws IOException {
508-
byte[] data = Util.readBytes(TestResourceUtil.openResource(getClass(), "animated_webp.webp"));
508+
byte[] data =
509+
ByteStreams.toByteArray(TestResourceUtil.openResource(getClass(), "animated_webp.webp"));
509510
runTest(
510511
data,
511512
new ParserTestCase() {
@@ -822,7 +823,8 @@ public void run(
822823

823824
@Test
824825
public void testCanParseRealAnimatedAvifFile() throws IOException {
825-
byte[] data = Util.readBytes(TestResourceUtil.openResource(getClass(), "animated_avif.avif"));
826+
byte[] data =
827+
ByteStreams.toByteArray(TestResourceUtil.openResource(getClass(), "animated_avif.avif"));
826828
runTest(
827829
data,
828830
new ParserTestCase() {
@@ -866,7 +868,7 @@ public void run(
866868
@Test
867869
public void testHandlesParsingOrientationWithMinimalExifSegment() throws IOException {
868870
byte[] data =
869-
Util.readBytes(TestResourceUtil.openResource(getClass(), "short_exif_sample.jpg"));
871+
ByteStreams.toByteArray(TestResourceUtil.openResource(getClass(), "short_exif_sample.jpg"));
870872
runTest(
871873
data,
872874
new ParserTestCase() {
@@ -1016,7 +1018,8 @@ public void getOrientation_withExifSegmentAndPreambleBetweenLengthAndExpected_re
10161018
@Test
10171019
public void hasJpegMpf_withGainmapFile_returnsTrue() throws IOException {
10181020
byte[] data =
1019-
Util.readBytes(TestResourceUtil.openResource(getClass(), "small_gainmap_image.jpg"));
1021+
ByteStreams.toByteArray(
1022+
TestResourceUtil.openResource(getClass(), "small_gainmap_image.jpg"));
10201023
runTest(
10211024
data,
10221025
new ParserTestCase() {
@@ -1038,7 +1041,7 @@ public void run(
10381041
@Test
10391042
public void hasJpegMpf_withNonGainmapFile_returnsFalse() throws IOException {
10401043
byte[] data =
1041-
Util.readBytes(TestResourceUtil.openResource(getClass(), "short_exif_sample.jpg"));
1044+
ByteStreams.toByteArray(TestResourceUtil.openResource(getClass(), "short_exif_sample.jpg"));
10421045
runTest(
10431046
data,
10441047
new ParserTestCase() {

0 commit comments

Comments
 (0)