17
17
package com .google .cloud .speech .grpc .demos ;
18
18
19
19
import com .google .cloud .speech .v1 .AudioRequest ;
20
- import static org .junit .Assert .assertSame ;
20
+ import static org .junit .Assert .assertEquals ;
21
21
22
22
import org .junit .Before ;
23
23
import org .junit .Test ;
24
24
import org .junit .runner .RunWith ;
25
25
import org .junit .runners .JUnit4 ;
26
26
27
+ import java .io .File ;
27
28
import java .io .IOException ;
28
29
import java .net .URI ;
29
- import java .nio .file .Path ;
30
- import java .nio .file .Paths ;
31
- import java .util .List ;
32
30
33
31
/**
34
32
* Unit tests for {@link AudioRequestFactory}.
@@ -38,23 +36,23 @@ public class AudioRequestFactoryTest {
38
36
39
37
@ Test
40
38
public void verifyBytesInSizeFromLocalFile () throws IOException {
41
- URI uri = new File ("speech/grpc/ resources/audio.raw" ).toURI ();
39
+ URI uri = new File ("resources/audio.raw" ).toURI ();
42
40
AudioRequest audio = AudioRequestFactory .createRequest (uri );
43
41
44
- int numBytes = audio .getContent ().toByteArray ().length () ;
42
+ int numBytes = audio .getContent ().toByteArray ().length ;
45
43
46
44
//assert the number of bytes in the audio as 57958
47
- assertSame (numBytes , 57958 );
45
+ assertEquals (numBytes , 57958 );
48
46
}
49
47
50
48
@ Test
51
49
public void verifyBytesInSizeFromGoogleStorageFile () throws IOException {
52
50
URI uri = URI .create ("gs://cloud-samples-test/speech/audio.raw" );
53
51
AudioRequest audio = AudioRequestFactory .createRequest (uri );
54
52
55
- int numBytes = audio .getContent ().toByteArray ().length () ;
53
+ int numBytes = audio .getContent ().toByteArray ().length ;
56
54
57
55
//assert the number of bytes in the audio as 57958
58
- assertSame (numBytes , 57958 );
56
+ assertEquals (numBytes , 57958 );
59
57
}
60
58
}
0 commit comments