コード例 #1
0
  @Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);
    mBitmapMemoryCacheGetProducer =
        new BitmapMemoryCacheGetProducer(mMemoryCache, mCacheKeyFactory, mInputProducer);
    mCloseableImage1 = mock(CloseableImage.class);
    mFinalImageReference = CloseableReference.of(mCloseableImage1);
    when(mCloseableImage1.getQualityInfo()).thenReturn(ImmutableQualityInfo.FULL_QUALITY);

    when(mProducerContext.getImageRequest()).thenReturn(mImageRequest);
    when(mProducerContext.getListener()).thenReturn(mProducerListener);
    when(mProducerContext.getId()).thenReturn(mRequestId);
    when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
    when(mProducerContext.getLowestPermittedRequestLevel())
        .thenReturn(ImageRequest.RequestLevel.FULL_FETCH);
    when(mProducerContext.getCallerContext()).thenReturn(PRODUCER_NAME);
    when(mCacheKeyFactory.getBitmapCacheKey(mImageRequest, PRODUCER_NAME)).thenReturn(mCacheKey);
  }
コード例 #2
0
  @BeforeClass
  public void setup() {
    MockitoAnnotations.initMocks(this);

    referenceResolver.setApplicationContext(applicationContext);

    when(applicationContext.getBean("jmsTemplate", JmsTemplate.class)).thenReturn(jmsTemplate);
    when(applicationContext.getBean("jmsQueue", Destination.class)).thenReturn(jmsQueue);
    when(applicationContext.getBean("replyQueue", Destination.class)).thenReturn(replyQueue);
    when(applicationContext.getBean("messageConverter", JmsMessageConverter.class))
        .thenReturn(messageConverter);
    when(applicationContext.getBean("replyMessageCorrelator", MessageCorrelator.class))
        .thenReturn(messageCorrelator);
    when(applicationContext.getBean("connectionFactory", ConnectionFactory.class))
        .thenReturn(connectionFactory);
    when(applicationContext.getBean("jmsConnectionFactory", ConnectionFactory.class))
        .thenReturn(jmsConnectionFactory);
    when(applicationContext.getBean("testActor", TestActor.class)).thenReturn(testActor);
  }
コード例 #3
0
  @Before
  public void setUp()
      throws AddressException, DateException, PhoneException, CPFException, RGException,
          PersonException {

    MockitoAnnotations.initMocks(this);

    date = new Date(05, 06, 1996);
    address = new Address("Rua 3 ", "6B", "", "72323411", "Brasilia");
    phone1 = new Phone("61", "83265622");
    phone2 = new Phone("61", "32551111");
    cpf = new CPF("51464638403");
    rg = new RG("8598298", "SSP", "DF");
    email = "*****@*****.**";
    courses = new ArrayList<String>();
    packages = new ArrayList<String>();

    value = new Integer(100000);
  }
コード例 #4
0
  @Before
  public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    mExecutor = new TestExecutorService(new FakeClock());
    mLocalVideoThumbnailProducer = new LocalVideoThumbnailProducer(mExecutor);
    mFile = new File(Robolectric.application.getExternalFilesDir(null), TEST_FILENAME);

    mockStatic(ThumbnailUtils.class);
    mProducerContext =
        new SettableProducerContext(
            mImageRequest,
            mRequestId,
            mProducerListener,
            mock(Object.class),
            ImageRequest.RequestLevel.FULL_FETCH,
            false,
            false,
            Priority.MEDIUM);
    when(mImageRequest.getSourceFile()).thenReturn(mFile);
  }
コード例 #5
0
  @Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);
    mEncodedMemoryCacheProducer =
        new EncodedMemoryCacheProducer(mMemoryCache, mCacheKeyFactory, mNextProducer);
    mCacheKey = new SimpleCacheKey("http://dummy.uri");
    mPooledByteBuffer1 = mock(PooledByteBuffer.class);
    mPooledByteBuffer2 = mock(PooledByteBuffer.class);
    mFinalImageReference = CloseableReference.of(mPooledByteBuffer1);
    mIntermediateImageReference = CloseableReference.of(mPooledByteBuffer2);
    mFinalImageReferenceClone = mFinalImageReference.clone();
    mFinalEncodedImage = new EncodedImage(mFinalImageReference);
    mIntermediateEncodedImage = new EncodedImage(mIntermediateImageReference);
    mFinalEncodedImageClone = new EncodedImage(mFinalImageReferenceClone);

    when(mMemoryCache.cache(mCacheKey, mFinalImageReference)).thenReturn(mFinalImageReferenceClone);
    when(mProducerContext.getImageRequest()).thenReturn(mImageRequest);
    when(mProducerContext.getListener()).thenReturn(mProducerListener);
    when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true);
    when(mProducerContext.getId()).thenReturn(mRequestId);
    when(mProducerContext.getLowestPermittedRequestLevel())
        .thenReturn(ImageRequest.RequestLevel.FULL_FETCH);
    when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest)).thenReturn(mCacheKey);
  }
コード例 #6
0
 @Before
 public void setUp() throws URISyntaxException {
   MockitoAnnotations.initMocks(this);
 }
コード例 #7
0
 @BeforeMethod
 public void setUp(Method method) {
   MockitoAnnotations.initMocks(this);
   this.restDocumentation.beforeTest(getClass(), method.getName());
 }