org.assertj.core.api.AbstractIterableAssert.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(75)

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

AbstractIterableAssert.isEmpty介绍

暂无

代码示例

代码示例来源:origin: lingochamp/okdownload

@Test
public void handleMessage_removeInfo() {
  final Message message = new Message();
  message.what = WHAT_REMOVE_INFO;
  message.arg1 = 1;
  freeToDBIdList.add(1);
  executor.handleMessage(message);
  verify(agent).removeInfo(eq(1));
  assertThat(freeToDBIdList).isEmpty();
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void handleMessage_removeFreeBunchId() {
  final Message message = new Message();
  message.what = WHAT_REMOVE_FREE_BUNCH_ID;
  message.obj = idList;
  freeToDBIdList.addAll(idList);
  executor.handleMessage(message);
  assertThat(freeToDBIdList).isEmpty();
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void handleMessage_removeFreeId() {
  final Message message = new Message();
  message.what = WHAT_REMOVE_FREE_ID;
  message.arg1 = 1;
  freeToDBIdList.add(1);
  executor.handleMessage(message);
  assertThat(freeToDBIdList).isEmpty();
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void inspectForConflict_sameTask_isFinishing() {
  final DownloadTask task = mock(DownloadTask.class);
  final DownloadCall call = mock(DownloadCall.class);
  when(call.equalsTask(task)).thenReturn(true);
  when(call.isFinishing()).thenReturn(true);
  final Collection<DownloadCall> calls = new ArrayList<>();
  final Collection<DownloadTask> sameTaskList = new ArrayList<>();
  final Collection<DownloadTask> fileBusyList = new ArrayList<>();
  calls.add(call);
  assertThat(dispatcher.inspectForConflict(task, calls, sameTaskList, fileBusyList))
      .isFalse();
  assertThat(fileBusyList).isEmpty();
  assertThat(sameTaskList).isEmpty();
  assertThat(finishingCalls).hasSize(1);
}

代码示例来源:origin: facebook/litho

@Test
public void testDataRenderedCallbacksAreNotTriggered() {
 final ChangeSetCompleteCallback changeSetCompleteCallback =
   mock(ChangeSetCompleteCallback.class);
 final ComponentsLogger componentsLogger = mock(ComponentsLogger.class);
 final ComponentContext componentContext =
   new ComponentContext(RuntimeEnvironment.application, "", componentsLogger);
 final RecyclerBinder recyclerBinder =
   new RecyclerBinder.Builder().rangeRatio(RANGE_RATIO).build(componentContext);
 for (int i = 0; i < 40; i++) {
  recyclerBinder.notifyChangeSetComplete(true, changeSetCompleteCallback);
 }
 final RecyclerView recyclerView = mock(LithoRecylerView.class);
 when(recyclerView.hasPendingAdapterUpdates()).thenReturn(true);
 when(recyclerView.isAttachedToWindow()).thenReturn(true);
 when(recyclerView.getWindowVisibility()).thenReturn(View.VISIBLE);
 when(recyclerView.getAlpha()).thenReturn(1f);
 when(recyclerView.getVisibility()).thenReturn(View.VISIBLE);
 when(recyclerView.getGlobalVisibleRect(any(Rect.class))).thenReturn(true);
 recyclerBinder.mount(recyclerView);
 recyclerBinder.notifyChangeSetComplete(true, changeSetCompleteCallback);
 verify(componentsLogger).emitMessage(eq(ComponentsLogger.LogLevel.ERROR), anyString());
 assertThat(recyclerBinder.mDataRenderedCallbacks).isEmpty();
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void inspectForConflict_sameTask() throws IOException {
  mockOkDownload();
  final CallbackDispatcher callbackDispatcher = OkDownload.with().callbackDispatcher();
  final DownloadListener listener = callbackDispatcher.dispatch();
  DownloadTask task = mock(DownloadTask.class);
  final Collection<DownloadCall> calls = new ArrayList<>();
  final Collection<DownloadTask> sameTaskList = new ArrayList<>();
  final Collection<DownloadTask> fileBusyList = new ArrayList<>();
  final DownloadCall call = mock(DownloadCall.class);
  when(call.equalsTask(task)).thenReturn(true);
  calls.add(call);
  assertThat(dispatcher.inspectForConflict(task, calls, sameTaskList, fileBusyList)).isTrue();
  assertThat(sameTaskList).containsExactly(task);
  assertThat(fileBusyList).isEmpty();
  verify(listener, never()).taskEnd(eq(task), any(EndCause.class), nullable(Exception.class));
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void inspectForConflict_fileBusy() throws IOException {
  mockOkDownload();
  final CallbackDispatcher callbackDispatcher = OkDownload.with().callbackDispatcher();
  final DownloadListener listener = callbackDispatcher.dispatch();
  DownloadTask task = mock(DownloadTask.class);
  final Collection<DownloadCall> calls = new ArrayList<>();
  final Collection<DownloadTask> sameTaskList = new ArrayList<>();
  final Collection<DownloadTask> fileBusyList = new ArrayList<>();
  final DownloadCall call = mock(DownloadCall.class);
  final File file = mock(File.class);
  when(task.getFile()).thenReturn(file);
  when(call.getFile()).thenReturn(file);
  calls.add(call);
  assertThat(dispatcher.inspectForConflict(task, calls, sameTaskList, fileBusyList)).isTrue();
  assertThat(sameTaskList).isEmpty();
  assertThat(fileBusyList).containsExactly(task);
  verify(listener, never()).taskEnd(eq(task), any(EndCause.class), nullable(Exception.class));
}

代码示例来源:origin: facebook/litho

@Test
public void testDataRenderedCallbacksIsEmptyWithInsertAfterMount() {
 final RecyclerView recyclerView = mock(RecyclerView.class);
 final ChangeSetCompleteCallback changeSetCompleteCallback =
   mock(ChangeSetCompleteCallback.class);
 final RecyclerBinder recyclerBinder =
   new RecyclerBinder.Builder().rangeRatio(RANGE_RATIO).build(mComponentContext);
 // Mount view before insertions
 recyclerBinder.mount(recyclerView);
 final ArrayList<RenderInfo> renderInfos = new ArrayList<>();
 for (int i = 0; i < 5; i++) {
  final Component component =
    TestDrawableComponent.create(mComponentContext).widthPx(100).heightPx(100).build();
  renderInfos.add(ComponentRenderInfo.create().component(component).build());
 }
 recyclerBinder.insertRangeAt(0, renderInfos);
 recyclerBinder.notifyChangeSetComplete(true, changeSetCompleteCallback);
 assertThat(recyclerBinder.mDataRenderedCallbacks).isEmpty();
}

代码示例来源:origin: facebook/litho

@Test
public void testDataRenderedCallbacksIsEmptyWithAsyncInsertAfterMount() {
 final RecyclerView recyclerView = mock(RecyclerView.class);
 final ChangeSetCompleteCallback changeSetCompleteCallback =
   mock(ChangeSetCompleteCallback.class);
 final RecyclerBinder recyclerBinder =
   new RecyclerBinder.Builder().rangeRatio(RANGE_RATIO).build(mComponentContext);
 // Mount view before insertions
 recyclerBinder.mount(recyclerView);
 final ArrayList<RenderInfo> renderInfos = new ArrayList<>();
 for (int i = 0; i < 5; i++) {
  final Component component =
    TestDrawableComponent.create(mComponentContext).widthPx(100).heightPx(100).build();
  renderInfos.add(ComponentRenderInfo.create().component(component).build());
 }
 recyclerBinder.insertRangeAtAsync(0, renderInfos);
 recyclerBinder.notifyChangeSetCompleteAsync(true, changeSetCompleteCallback);
 recyclerBinder.measure(
   new Size(), makeSizeSpec(1000, EXACTLY), makeSizeSpec(1000, EXACTLY), null);
 assertThat(recyclerBinder.mDataRenderedCallbacks).isEmpty();
}

代码示例来源:origin: facebook/litho

String testElt5 = null;
assertThat(set).isEmpty();
assertThat(set).isEmpty();
assertThat(set)
  .doesNotContain(testElt1)
  .isEmpty();
assertThat(checkIterator(set)).isTrue();
  .doesNotContain(testElt3)
  .doesNotContain(testElt4)
  .isEmpty();
assertThat(checkIterator(set)).isTrue();
assertThat(set).doesNotContain(testElt2);
assertThat(set).doesNotContain(testElt3);
assertThat(set).isEmpty();
assertThat(set).isEmpty();
assertThat(checkIterator(set)).isTrue();

代码示例来源:origin: f2prateek/rx-preferences

public void assertNoEvents() {
 assertThat(events).isEmpty();
}

代码示例来源:origin: f2prateek/rx-preferences

@Test public void defaultDefaultValue() {
 assertThat(rxPreferences.getBoolean("foo1").defaultValue()).isFalse();
 assertThat(rxPreferences.getFloat("foo3").defaultValue()).isZero();
 assertThat(rxPreferences.getInteger("foo4").defaultValue()).isZero();
 assertThat(rxPreferences.getLong("foo5").defaultValue()).isZero();
 assertThat(rxPreferences.getString("foo6").defaultValue()).isEqualTo("");
 assertThat(rxPreferences.getStringSet("foo7").defaultValue()).isEmpty();
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(pool.trash).isEmpty();
assertThat(connection1.inFlight.get()).isEqualTo(50);
assertThat(connection2.inFlight.get()).isEqualTo(51);

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

assertThat(pool.trash).isEmpty();
assertThat(connection1.isClosed()).isTrue();

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short", dataProvider = "newKeyspaceName")
public void should_notify_of_keyspace_drop(String keyspace) throws InterruptedException {
 execute(CREATE_KEYSPACE, keyspace);
 for (SchemaChangeListener listener : listeners) {
  ArgumentCaptor<KeyspaceMetadata> added = ArgumentCaptor.forClass(KeyspaceMetadata.class);
  verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onKeyspaceAdded(added.capture());
  assertThat(added.getValue()).hasName(handleId(keyspace));
 }
 for (Metadata m : metadatas())
  assertThat(m.getReplicas(keyspace, Bytes.fromHexString("0xCAFEBABE"))).isNotEmpty();
 execute(CREATE_TABLE, keyspace); // to test table drop notifications
 execute(DROP_KEYSPACE, keyspace);
 for (SchemaChangeListener listener : listeners) {
  ArgumentCaptor<TableMetadata> table = ArgumentCaptor.forClass(TableMetadata.class);
  verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onTableRemoved(table.capture());
  assertThat(table.getValue()).hasName("table1").isInKeyspace(handleId(keyspace));
  ArgumentCaptor<KeyspaceMetadata> ks = ArgumentCaptor.forClass(KeyspaceMetadata.class);
  verify(listener, timeout(NOTIF_TIMEOUT_MS).times(1)).onKeyspaceRemoved(ks.capture());
  assertThat(ks.getValue()).hasName(handleId(keyspace));
 }
 for (Metadata m : metadatas()) {
  assertThat(m.getKeyspace(keyspace)).isNull();
  assertThat(m.getReplicas(keyspace, Bytes.fromHexString("0xCAFEBABE"))).isEmpty();
 }
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

logs.disableFor(Session.class);
assertThat(session.getState().getConnectedHosts()).isEmpty();
InetSocketAddress host = ccm().addressOfNode(1);
assertThat(logs.get())

代码示例来源:origin: io.vertx/vertx-service-discovery

@After
public void tearDown() {
 discovery.close();
 AtomicBoolean completed = new AtomicBoolean();
 vertx.close((v) -> completed.set(true));
 await().untilAtomic(completed, is(true));
 assertThat(discovery.bindings()).isEmpty();
}

代码示例来源:origin: com.hubspot.jinjava/jinjava

@Test
 public void itResetsGlobalContextAfterRender() {

  Jinjava jinjava = new Jinjava();
  Context globalContext = jinjava.getGlobalContext();

  RenderResult result = jinjava.renderForResult("{{ foo + 1 }}", ImmutableMap.of("foo", 1));

  assertThat(result.getOutput()).isEqualTo("2");
  assertThat(result.getContext().getResolvedExpressions()).containsOnly("foo + 1");
  assertThat(result.getContext().getResolvedValues()).containsOnly("foo");
  assertThat(globalContext.getResolvedExpressions()).isEmpty();
  assertThat(globalContext.getResolvedValues()).isEmpty();
 }
}

代码示例来源:origin: apache/archiva

@Test
public void testSearchArtifactsByKeyExact()
  throws Exception
{
  createArtifactWithData();
  Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( "url", TEST_URL, TEST_REPO_ID, true );
  assertThat( artifactsByProperty ).isNotNull().isNotEmpty();
  artifactsByProperty = repository.searchArtifacts( "org.name", "pache", TEST_REPO_ID, true );
  assertThat( artifactsByProperty ).isNotNull().isEmpty();
}

代码示例来源:origin: allegro/hermes

@Test
public void shouldNotDeleteFromUnchangedView() {
  // given
  SubscriptionName s1 = anySubscriptionName();
  SubscriptionAssignmentView current = assignmentView().withAssignment(s1, "c1").build();
  SubscriptionAssignmentView target = assignmentView().withAssignment(s1, "c1").build();
  // when
  SubscriptionAssignmentView deletions = current.deletions(target);
  // then
  assertThat(deletions.getSubscriptions()).isEmpty();
}

相关文章

微信公众号

最新文章

更多