com.google.common.truth.Subject.isNotNull()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(81)

本文整理了Java中com.google.common.truth.Subject.isNotNull()方法的一些代码示例,展示了Subject.isNotNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Subject.isNotNull()方法的具体详情如下:
包路径:com.google.common.truth.Subject
类名称:Subject
方法名:isNotNull

Subject.isNotNull介绍

[英]Fails if the subject is null.
[中]如果主题为空,则失败。

代码示例

代码示例来源:origin: google/guava

public void testBuilderGenerics_SelfComparable() {
 // testing simple creation
 ImmutableSortedSet.Builder<SelfComparableExample> natural = ImmutableSortedSet.naturalOrder();
 assertThat(natural).isNotNull();
 ImmutableSortedSet.Builder<SelfComparableExample> reverse = ImmutableSortedSet.reverseOrder();
 assertThat(reverse).isNotNull();
}

代码示例来源:origin: google/guava

public void testBuilderGenerics_SuperComparable() {
  // testing simple creation
  ImmutableSortedSet.Builder<SuperComparableExample> natural = ImmutableSortedSet.naturalOrder();
  assertThat(natural).isNotNull();
  ImmutableSortedSet.Builder<SuperComparableExample> reverse = ImmutableSortedSet.reverseOrder();
  assertThat(reverse).isNotNull();
 }
}

代码示例来源:origin: bumptech/glide

@Test
public void loadVideoResourceId_fromInt_decodesFrame() {
 Drawable frame =
   concurrency.get(
     Glide.with(context)
       .load(ResourceIds.raw.video)
       .submit());
 assertThat(frame).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withShapeDrawableResourceId_asDrawable_producesNonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.shape_drawable)
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withStateListDrawableResourceId_asDrawable_producesNonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.state_list_drawable)
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void loadBitmap_asBytes_providesBytesOfBitmap() {
 Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), ResourceIds.raw.canonical);
 byte[] data =
   concurrency.get(
     Glide.with(context)
       .as(byte[].class)
       .load(bitmap)
       .submit());
 assertThat(data).isNotNull();
 assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withShapeDrawableResourceId_asDrawable_withTransformation_validSize_succeeds()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.shape_drawable)
   .apply(bitmapTransform(new RoundedCorners(10)))
   .submit(100, 200)
   .get();
 assertThat(drawable).isNotNull();
 assertThat(drawable.getIntrinsicWidth()).isEqualTo(100);
 assertThat(drawable.getIntrinsicHeight()).isEqualTo(200);
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withBitmapAliasResourceId_asDrawable_withTransformation_producesNonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.bitmap_alias)
   .apply(centerCropTransform())
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withStateListDrawableResourceId_asDrawable_withTransformation_nonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.state_list_drawable)
   .apply(centerCropTransform())
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withVectorDrawableResourceId_asDrawable_withTransformation_nonNullDrawable()
  throws ExecutionException, InterruptedException {
 Drawable drawable = Glide.with(context)
   .load(ResourceIds.drawable.vector_drawable)
   .apply(centerCropTransform())
   .submit()
   .get();
 assertThat(drawable).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void clear_withSingleRequest_nullsOutDrawableInView() {
 concurrency.loadOnMainThread(
   GlideApp.with(context)
     .load(ResourceIds.raw.canonical),
   imageView);
 assertThat(imageView.getDrawable()).isNotNull();
 concurrency.clearOnMainThread(imageView);
 assertThat(imageView.getDrawable()).isNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void loadVideoFilePath_asBytes_providesByteOfFrame() throws IOException {
 byte[] data =
   concurrency.get(
     Glide.with(context)
       .as(byte[].class)
       .load(writeVideoToFile().getAbsolutePath())
       .submit());
 assertThat(data).isNotNull();
 assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withBitmapAliasResourceId_asBitmap_producesNonNullBitmap()
  throws ExecutionException, InterruptedException {
 Bitmap bitmap = Glide.with(context)
   .asBitmap()
   .load(ResourceIds.drawable.bitmap_alias)
   .submit()
   .get();
 assertThat(bitmap).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void loadVideoResourceId_asBitmap_decodesFrame() {
 Bitmap frame =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(ResourceIds.raw.video)
       .submit());
 assertThat(frame).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void loadVideoFileUri_asBytes_withFrameTime_providesByteOfFrame() throws IOException {
 byte[] data =
   concurrency.get(
     GlideApp.with(context)
       .as(byte[].class)
       .load(Uri.fromFile(writeVideoToFile()))
       .frame(TimeUnit.SECONDS.toMicros(1))
       .submit());
 assertThat(data).isNotNull();
 assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void loadVideoFilePath_asBytes_withFrameTime_providesByteOfFrame() throws IOException {
 byte[] data =
   concurrency.get(
     GlideApp.with(context)
       .as(byte[].class)
       .load(writeVideoToFile().getAbsolutePath())
       .frame(TimeUnit.SECONDS.toMicros(1))
       .submit());
 assertThat(data).isNotNull();
 assertThat(BitmapFactory.decodeByteArray(data, 0, data.length)).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withPngDataUriString_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUriString(CompressFormat.PNG))
       .submit());
 assertThat(bitmap).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withJpegAsDataUriString_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUriString(CompressFormat.JPEG))
       .submit());
 assertThat(bitmap).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void load_withPngAsDataUri_returnsBitmap() {
 Bitmap bitmap =
   concurrency.get(
     Glide.with(context)
       .asBitmap()
       .load(getDataUri(CompressFormat.PNG))
       .submit());
 assertThat(bitmap).isNotNull();
}

代码示例来源:origin: bumptech/glide

@Test
public void loadGif_withTransparentGif_sizeOriginal_succeeds()
  throws ExecutionException, InterruptedException {
 GifDrawable gifDrawable =
   concurrencyHelper.get(
     GlideApp.with(context)
       .asGif()
       .load(ResourceIds.raw.transparent_gif)
       .submit());
 assertThat(gifDrawable).isNotNull();
}

相关文章