1616package com .google .android .exoplayer2 .ext .opus ;
1717
1818import static com .google .common .truth .Truth .assertThat ;
19+ import static org .junit .Assume .assumeTrue ;
1920
2021import androidx .annotation .Nullable ;
2122import androidx .test .ext .junit .runners .AndroidJUnit4 ;
2627import com .google .common .collect .ImmutableList ;
2728import java .nio .ByteBuffer ;
2829import java .nio .ByteOrder ;
29- import org .junit .Before ;
3030import org .junit .Test ;
3131import org .junit .runner .RunWith ;
3232
@@ -69,11 +69,6 @@ protected void loadLibrary(String name) {
6969 private static final ImmutableList <byte []> FULL_INITIALIZATION_DATA =
7070 ImmutableList .of (HEADER , CUSTOM_PRE_SKIP_BYTES , CUSTOM_SEEK_PRE_ROLL_BYTES );
7171
72- @ Before
73- public void setUp () {
74- assertThat (LOADER .isAvailable ()).isTrue ();
75- }
76-
7772 @ Test
7873 public void getChannelCount () {
7974 int channelCount = OpusDecoder .getChannelCount (HEADER );
@@ -120,6 +115,7 @@ public void getDiscardPaddingSamples_negativeSampleLength_returnZero() {
120115
121116 @ Test
122117 public void decode_removesPreSkipFromOutput () throws OpusDecoderException {
118+ assumeTrue (LOADER .isAvailable ());
123119 OpusDecoder decoder =
124120 new OpusDecoder (
125121 /* numInputBuffers= */ 0 ,
@@ -139,6 +135,7 @@ public void decode_removesPreSkipFromOutput() throws OpusDecoderException {
139135 @ Test
140136 public void decode_whenDiscardPaddingDisabled_returnsDiscardPadding ()
141137 throws OpusDecoderException {
138+ assumeTrue (LOADER .isAvailable ());
142139 OpusDecoder decoder =
143140 new OpusDecoder (
144141 /* numInputBuffers= */ 0 ,
@@ -159,6 +156,7 @@ public void decode_whenDiscardPaddingDisabled_returnsDiscardPadding()
159156
160157 @ Test
161158 public void decode_whenDiscardPaddingEnabled_removesDiscardPadding () throws OpusDecoderException {
159+ assumeTrue (LOADER .isAvailable ());
162160 OpusDecoder decoder =
163161 new OpusDecoder (
164162 /* numInputBuffers= */ 0 ,
0 commit comments