Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into jz-azure
Browse files Browse the repository at this point in the history
  • Loading branch information
space-pope committed Jan 23, 2020
2 parents 0b43137 + 9a0bc88 commit 2452b73
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* place.
* </p>
*/
public final class AndroidSpeechRecognizer implements SpeechProcessor {
public class AndroidSpeechRecognizer implements SpeechProcessor {
private boolean streaming;
private SpeechRecognizer speechRecognizer;
private TaskHandler taskHandler;
Expand Down Expand Up @@ -120,7 +120,7 @@ private void begin() {
});
}

private Intent createRecognitionIntent() {
Intent createRecognitionIntent() {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static org.powermock.api.mockito.PowerMockito.*;

@RunWith(PowerMockRunner.class)
@PrepareForTest({SpeechRecognizer.class, AndroidSpeechRecognizer.class, Bundle.class})
@PrepareForTest({SpeechRecognizer.class, Bundle.class})
public class AndroidSpeechRecognizerTest {

private ContextWrapper emptyAppContext = mock(ContextWrapper.class);
Expand Down Expand Up @@ -70,7 +70,8 @@ private void configureRecognizer(SpeechRecognizer target,
public void testProcess() {
SpeechConfig config = new SpeechConfig();
AndroidSpeechRecognizer speechRecognizer =
new AndroidSpeechRecognizer(config, new TaskHandler(false));
spy(new AndroidSpeechRecognizer(config, new TaskHandler(false)));
doReturn(null).when(speechRecognizer).createRecognitionIntent();
SpeechContext context = new SpeechContext(config);
context.setAndroidContext(mockContext);
EventListener listener = new EventListener();
Expand All @@ -93,7 +94,8 @@ public void testProcess() {
listener.clear();
context.setActive(true);
speechRecognizer =
new AndroidSpeechRecognizer(config, new TaskHandler(false));
spy(new AndroidSpeechRecognizer(config, new TaskHandler(false)));
doReturn(null).when(speechRecognizer).createRecognitionIntent();
speechRecognizer.process(context, frame);
assertNull(listener.transcript);
assertEquals(SpeechRecognizerError.class, listener.error.getClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
Expand All @@ -29,8 +30,12 @@
@RunWith(PowerMockRunner.class)
@PrepareForTest(ExoPlaybackException.class)
public class SpokestackTTSOutputTest {
private LifecycleRegistry lifecycleRegistry =
new LifecycleRegistry(mock(LifecycleOwner.class));
@Mock
@SuppressWarnings("unused")
LifecycleOwner owner;

@InjectMocks
private LifecycleRegistry lifecycleRegistry;

@Mock
private Context mockContext;
Expand Down

0 comments on commit 2452b73

Please sign in to comment.