Fix usage of internal mockito API
The StubberImpl now takes an argument. Set it to default. Test: m -j TtsTests Change-Id: Id1175bd40489c7dee2c8c0993a65836d86e38cb3
This commit is contained in:
@@ -28,6 +28,7 @@ import org.mockito.internal.stubbing.StubberImpl;
|
|||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
import org.mockito.stubbing.Stubber;
|
import org.mockito.stubbing.Stubber;
|
||||||
|
import org.mockito.quality.Strictness;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -210,12 +211,16 @@ public class TextToSpeechTests extends InstrumentationTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class CountDownBehaviour extends StubberImpl {
|
public static abstract class CountDownBehaviour extends StubberImpl {
|
||||||
|
public CountDownBehaviour(Strictness strictness) {
|
||||||
|
super(strictness);
|
||||||
|
}
|
||||||
|
|
||||||
/** Used to mock methods that return a result. */
|
/** Used to mock methods that return a result. */
|
||||||
public abstract Stubber andReturn(Object result);
|
public abstract Stubber andReturn(Object result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CountDownBehaviour doCountDown(final CountDownLatch latch) {
|
public static CountDownBehaviour doCountDown(final CountDownLatch latch) {
|
||||||
return new CountDownBehaviour() {
|
return new CountDownBehaviour(Strictness.WARN) {
|
||||||
@Override
|
@Override
|
||||||
public <T> T when(T mock) {
|
public <T> T when(T mock) {
|
||||||
return Mockito.doAnswer(new Answer<Void>() {
|
return Mockito.doAnswer(new Answer<Void>() {
|
||||||
@@ -229,7 +234,7 @@ public class TextToSpeechTests extends InstrumentationTestCase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Stubber andReturn(final Object result) {
|
public Stubber andReturn(final Object result) {
|
||||||
return new StubberImpl() {
|
return new StubberImpl(Strictness.WARN) {
|
||||||
@Override
|
@Override
|
||||||
public <T> T when(T mock) {
|
public <T> T when(T mock) {
|
||||||
return Mockito.doAnswer(new Answer<Object>() {
|
return Mockito.doAnswer(new Answer<Object>() {
|
||||||
|
|||||||
Reference in New Issue
Block a user