Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
508c6652
authored
May 10, 2021
by
aquilescanta
Committed by
Oliver Woodman
May 10, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add test for PlaybackException
PiperOrigin-RevId: 373026239
parent
beeb6e82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
library/common/src/test/java/com/google/android/exoplayer2/PlaybackExceptionTest.java
library/common/src/test/java/com/google/android/exoplayer2/PlaybackExceptionTest.java
0 → 100644
View file @
508c6652
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer2
;
import
static
com
.
google
.
common
.
truth
.
Truth
.
assertThat
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
java.io.IOException
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
/** Unit tests for {@link PlaybackException}. */
@RunWith
(
AndroidJUnit4
.
class
)
public
class
PlaybackExceptionTest
{
@Test
public
void
roundTripViaBundle_yieldsEqualInstance
()
{
PlaybackException
before
=
new
PlaybackException
(
/* message= */
"test"
,
/* cause= */
new
IOException
(
/* message= */
"io"
),
PlaybackException
.
ERROR_CODE_IO_FILE_NOT_FOUND
);
PlaybackException
after
=
PlaybackException
.
CREATOR
.
fromBundle
(
before
.
toBundle
());
assertPlaybackExceptionsAreEqual
(
before
,
after
);
}
// TODO: Add test for backwards compatibility.
private
static
void
assertPlaybackExceptionsAreEqual
(
PlaybackException
a
,
PlaybackException
b
)
{
assertThat
(
a
.
getMessage
()).
isEqualTo
(
b
.
getMessage
());
assertThat
(
a
.
errorCode
).
isEqualTo
(
b
.
errorCode
);
assertThat
(
a
.
timestampMs
).
isEqualTo
(
b
.
timestampMs
);
assertThat
(
a
.
getCause
().
getClass
()).
isSameInstanceAs
(
b
.
getCause
().
getClass
());
assertThat
(
a
.
getCause
().
getMessage
()).
isEqualTo
(
b
.
getCause
().
getMessage
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment