Skip to content

Commit 9ccfdf1

Browse files
committed
added test
1 parent 8051728 commit 9ccfdf1

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

speech/grpc/src/test/java/com/google/cloud/speech/grpc/demos/AudioRequestFactoryTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,16 @@
1717
package com.google.cloud.speech.grpc.demos;
1818

1919
import com.google.cloud.speech.v1.AudioRequest;
20-
import static org.junit.Assert.assertSame;
20+
import static org.junit.Assert.assertEquals;
2121

2222
import org.junit.Before;
2323
import org.junit.Test;
2424
import org.junit.runner.RunWith;
2525
import org.junit.runners.JUnit4;
2626

27+
import java.io.File;
2728
import java.io.IOException;
2829
import java.net.URI;
29-
import java.nio.file.Path;
30-
import java.nio.file.Paths;
31-
import java.util.List;
3230

3331
/**
3432
* Unit tests for {@link AudioRequestFactory}.
@@ -38,23 +36,23 @@ public class AudioRequestFactoryTest {
3836

3937
@Test
4038
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();
4240
AudioRequest audio = AudioRequestFactory.createRequest(uri);
4341

44-
int numBytes = audio.getContent().toByteArray().length();
42+
int numBytes = audio.getContent().toByteArray().length;
4543

4644
//assert the number of bytes in the audio as 57958
47-
assertSame(numBytes, 57958);
45+
assertEquals(numBytes, 57958);
4846
}
4947

5048
@Test
5149
public void verifyBytesInSizeFromGoogleStorageFile() throws IOException {
5250
URI uri = URI.create("gs://cloud-samples-test/speech/audio.raw");
5351
AudioRequest audio = AudioRequestFactory.createRequest(uri);
5452

55-
int numBytes = audio.getContent().toByteArray().length();
53+
int numBytes = audio.getContent().toByteArray().length;
5654

5755
//assert the number of bytes in the audio as 57958
58-
assertSame(numBytes, 57958);
56+
assertEquals(numBytes, 57958);
5957
}
6058
}

0 commit comments

Comments
 (0)