java类android.support.annotation.VisibleForTesting的实例源码

BitmapPreFillRunner.java 文件源码 项目:GitHub 阅读 33 收藏 0 点赞 0 评论 0
@VisibleForTesting
BitmapPreFillRunner(BitmapPool bitmapPool, MemoryCache memoryCache, PreFillQueue allocationOrder,
    Clock clock, Handler handler) {
  this.bitmapPool = bitmapPool;
  this.memoryCache = memoryCache;
  this.toPrefill = allocationOrder;
  this.clock = clock;
  this.handler = handler;
}
AttachmentDownloadJob.java 文件源码 项目:PeSanKita-android 阅读 28 收藏 0 点赞 0 评论 0
@VisibleForTesting
SignalServiceAttachmentPointer createAttachmentPointer(MasterSecret masterSecret, Attachment attachment)
    throws InvalidPartException
{
  if (TextUtils.isEmpty(attachment.getLocation())) {
    throw new InvalidPartException("empty content id");
  }

  if (TextUtils.isEmpty(attachment.getKey())) {
    throw new InvalidPartException("empty encrypted key");
  }

  try {
    AsymmetricMasterSecret asymmetricMasterSecret = MasterSecretUtil.getAsymmetricMasterSecret(context, masterSecret);
    long                   id                     = Long.parseLong(attachment.getLocation());
    byte[]                 key                    = MediaKey.getDecrypted(masterSecret, asymmetricMasterSecret, attachment.getKey());
    String                 relay                  = null;

    if (TextUtils.isEmpty(attachment.getRelay())) {
      relay = attachment.getRelay();
    }

    return new SignalServiceAttachmentPointer(id, null, null, key, relay, Optional.<byte[]>absent());
  } catch (InvalidMessageException | IOException e) {
    Log.w(TAG, e);
    throw new InvalidPartException(e);
  }
}
LoginActivity.java 文件源码 项目:cat-is-a-dog 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Only called from test, creates and returns a new {@link SimpleIdlingResource}.
 */
@VisibleForTesting
@NonNull
public IdlingResource getIdlingResource() {
    if (mIdlingResource == null) {
        mIdlingResource = new SimpleIdlingResource();
    }
    return mIdlingResource;
}
PhialButton.java 文件源码 项目:Phial 阅读 37 收藏 0 点赞 0 评论 0
@VisibleForTesting
static int getIconSize(int maxSize, int intrinsicSize) {
    if (intrinsicSize == -1 || intrinsicSize > maxSize) {
        return maxSize;
    }
    return intrinsicSize;
}
Engine.java 文件源码 项目:GitHub 阅读 30 收藏 0 点赞 0 评论 0
@VisibleForTesting
void shutdown() {
  shutdownAndAwaitTermination(diskCacheExecutor);
  shutdownAndAwaitTermination(sourceExecutor);
  shutdownAndAwaitTermination(sourceUnlimitedExecutor);
  shutdownAndAwaitTermination(animationExecutor);
}
DownloadProcessor.java 文件源码 项目:playTorrent 阅读 30 收藏 0 点赞 0 评论 0
@VisibleForTesting()
public void connectLocalHostPeer() throws UnknownHostException, ConnectException {
    // find local address
    InetAddress local = InetAddress.getLocalHost();
    Peer downloadPeer = new Peer("10.0.2.2", 49152);
    mPeerMap.put(local.getHostAddress(), downloadPeer);
    downloadPeer.setPeerListener(mPeerEventListener);
    handFoundPeerList();
}
AnnotationParser.java 文件源码 项目:silly-android 阅读 31 收藏 0 点赞 0 评论 0
/**
 * Verifies that the given field is a {@link View} or crashes.
 *
 * @param field  The field you are checking
 * @param object The object instance holding the field
 * @throws IllegalArgumentException When field is not a {@link View}
 */
@VisibleForTesting
static void verifyTypeOfView(@NonNull final Field field, @NonNull final Object object) {
    try {
        field.setAccessible(true);
        Object value = field.get(object);
        if (value instanceof View || View.class.isAssignableFrom(field.getType())) {
            return;
        }
    } catch (IllegalAccessException ignored) {}
    throw new IllegalArgumentException("Field \n\t'" + String.valueOf(field) + "\n is not a View, instead it is a " + field.getType().getSimpleName());
}
CredentialClient.java 文件源码 项目:OpenYOLO-Android 阅读 60 收藏 0 点赞 0 评论 0
@VisibleForTesting
CredentialClient(
        @NonNull Context context,
        @NonNull CredentialClientOptions options) {
    validate(context, notNullValue(), NullPointerException.class);
    validate(options, notNullValue(), NullPointerException.class);

    mApplicationContext = context.getApplicationContext();
    mDeviceState = options.getDeviceState();
}
ViewPagerAnimator.java 文件源码 项目:ViewPagerAnimator 阅读 35 收藏 0 点赞 0 评论 0
@VisibleForTesting
static ViewPagerAnimator<Integer> ofInt(ViewPager viewPager,
                                        Provider<Integer> provider,
                                        Property<Integer> property,
                                        TypeEvaluator<Integer> evaluator,
                                        Interpolator interpolator) {
    return new ViewPagerAnimator<>(viewPager, provider, property, evaluator, interpolator);
}
BaseMVPDialogFragment.java 文件源码 项目:mvp-core 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Call the presenter callbacks for onStop
 */
@VisibleForTesting
void doStop()
{
    assert mPresenter != null;

    mPresenter.onStop();

    mPresenter.onViewDetached();
}


问题


面经


文章

微信
公众号

扫码关注公众号