Add a space in the ParserException message

PiperOrigin-RevId: 668870991
This commit is contained in:
ibaker 2024-08-29 03:49:20 -07:00 committed by Copybara-Service
parent 3587afc9d7
commit 05cbbffbd7
3 changed files with 11 additions and 10 deletions

View File

@ -113,7 +113,7 @@ public class ParserException extends IOException {
@Override
public String getMessage() {
return super.getMessage()
+ "{contentIsMalformed="
+ " {contentIsMalformed="
+ contentIsMalformed
+ ", dataType="
+ dataType

View File

@ -20,6 +20,7 @@ import static androidx.media3.extractor.VorbisUtil.verifyVorbisHeaderCapturePatt
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
import androidx.media3.common.C;
import androidx.media3.common.ParserException;
import androidx.media3.common.util.ParsableByteArray;
import androidx.media3.test.utils.TestUtil;
@ -116,8 +117,9 @@ public final class VorbisUtilTest {
VorbisUtil.verifyVorbisHeaderCapturePattern(0x99, header, false);
fail();
} catch (ParserException e) {
assertThat(e.getMessage())
.isEqualTo("expected header type 99{contentIsMalformed=true, dataType=1}");
assertThat(e).hasMessageThat().contains("expected header type 99");
assertThat(e.contentIsMalformed).isTrue();
assertThat(e.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
}
}
@ -137,8 +139,9 @@ public final class VorbisUtilTest {
VorbisUtil.verifyVorbisHeaderCapturePattern(0x01, header, false);
fail();
} catch (ParserException e) {
assertThat(e.getMessage())
.isEqualTo("expected characters 'vorbis'{contentIsMalformed=true, dataType=1}");
assertThat(e).hasMessageThat().contains("expected characters 'vorbis'");
assertThat(e.contentIsMalformed).isTrue();
assertThat(e.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
}
}

View File

@ -157,13 +157,11 @@ public class ImageAssetLoaderTest {
});
ParserException parserException = (ParserException) exceptionRef.get().getCause();
assertThat(parserException.contentIsMalformed).isFalse();
assertThat(parserException.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
assertThat(parserException)
.hasMessageThat()
.isEqualTo(
"Attempted to load a Bitmap from unsupported MIME type:"
+ " image/gif{contentIsMalformed=false, dataType=1}");
.contains("Attempted to load a Bitmap from unsupported MIME type: image/gif");
assertThat(parserException.contentIsMalformed).isFalse();
assertThat(parserException.dataType).isEqualTo(C.DATA_TYPE_MEDIA);
}
private static AssetLoader getAssetLoader(AssetLoader.Listener listener, String uri) {