本文整理了Java中org.assertj.core.api.AbstractIterableAssert.containsExactly()
方法的一些代码示例,展示了AbstractIterableAssert.containsExactly()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractIterableAssert.containsExactly()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractIterableAssert
类名称:AbstractIterableAssert
方法名:containsExactly
暂无
代码示例来源:origin: org.assertj/assertj-core
/**
* {@inheritDoc}
*/
@Override
public SELF containsExactlyElementsOf(Iterable<? extends ELEMENT> iterable) {
return containsExactly(toArray(iterable));
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* {@inheritDoc}
*/
@Override
public SELF containsExactlyElementsOf(Iterable<? extends ELEMENT> iterable) {
return containsExactly(toArray(iterable));
}
代码示例来源:origin: springside/springside4
@Test
public void sortAndSearch() {
List<String> list = ListUtil.newArrayList("d", "a", "c", "b", "e", "i", "g");
ListUtil.sort(list);
assertThat(list).hasSize(7).containsExactly("a", "b", "c", "d", "e", "g", "i");
ListUtil.shuffle(list);
ListUtil.shuffle(list, new Random());
System.out.println("shuffle list:" + list);
ListUtil.sort(list, Ordering.natural());
assertThat(list).hasSize(7).containsExactly("a", "b", "c", "d", "e", "g", "i");
assertThat(ListUtil.binarySearch(list, "b")).isEqualTo(1);
assertThat(ListUtil.binarySearch(list, "b", Ordering.natural())).isEqualTo(1);
assertThat(ListUtil.binarySearch(list, "x")).isEqualTo(-8);
// reverse
List list8 = ListUtil.reverse(list);
assertThat(list8).hasSize(7).containsExactly("i", "g", "e", "d", "c", "b", "a");
// sortReverse
ListUtil.shuffle(list8);
ListUtil.sortReverse(list8);
assertThat(list8).hasSize(7).containsExactly("i", "g", "e", "d", "c", "b", "a");
ListUtil.shuffle(list8);
ListUtil.sortReverse(list8, Ordering.natural());
assertThat(list8).hasSize(7).containsExactly("i", "g", "e", "d", "c", "b", "a");
}
代码示例来源:origin: lingochamp/okdownload
@Test
public void handleMessage_syncId() throws IOException {
final Message message = new Message();
message.what = 1;
executor.handleMessage(message);
verify(agent).syncCacheToDB(eq(1));
assertThat(freeToDBIdList).containsExactly(1);
}
}
代码示例来源:origin: lingochamp/okdownload
@Test
public void handleMessage_syncBunchId() throws IOException {
final Message message = new Message();
message.what = WHAT_SYNC_BUNCH_ID;
message.obj = idList;
executor.handleMessage(message);
verify(agent).syncCacheToDB(eq(idList));
assertThat(freeToDBIdList).containsExactly(1, 2, 3);
}
代码示例来源: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: lingochamp/okdownload
@Test
public void inspectCompleted_collection() throws IOException {
mockOkDownload();
final DownloadStrategy downloadStrategy = OkDownload.with().downloadStrategy();
final CallbackDispatcher callbackDispatcher = OkDownload.with().callbackDispatcher();
final DownloadListener listener = callbackDispatcher.dispatch();
final DownloadTask task = mock(DownloadTask.class);
when(task.isPassIfAlreadyCompleted()).thenReturn(true);
when(task.getId()).thenReturn(0);
when(task.getUrl()).thenReturn("url");
when(task.getParentFile()).thenReturn(existFile.getParentFile());
final BreakpointStore store = OkDownload.with().breakpointStore();
doReturn(existFile.getName()).when(store).getResponseFilename("url");
doReturn(true).when(downloadStrategy).validFilenameFromStore(task);
final Collection<DownloadTask> completedCollection = new ArrayList<>();
assertThat(dispatcher.inspectCompleted(task, completedCollection)).isTrue();
verify(listener, never()).taskEnd(eq(task), any(EndCause.class), nullable(Exception.class));
assertThat(completedCollection).containsExactly(task);
}
代码示例来源:origin: lingochamp/okdownload
@Test
public void enqueue_tasksWithNetworkNotAvailable() throws IOException {
mockOkDownload();
final CallbackDispatcher callbackDispatcher = OkDownload.with().callbackDispatcher();
final DownloadStrategy downloadStrategy = OkDownload.with().downloadStrategy();
DownloadTask[] tasks = new DownloadTask[]{mock(DownloadTask.class), mock(
DownloadTask.class), mock(DownloadTask.class)};
doThrow(UnknownHostException.class).when(downloadStrategy).inspectNetworkAvailable();
dispatcher.enqueue(tasks);
final ArgumentCaptor<Collection<DownloadTask>> listCaptor = ArgumentCaptor
.forClass(Collection.class);
verify(callbackDispatcher, never())
.endTasks(any(Collection.class), any(Collection.class), any(Collection.class));
assertThat(readyAsyncCalls).isEmpty();
verify(dispatcher, never()).getExecutorService();
final ArgumentCaptor<Exception> causeCaptor = ArgumentCaptor.forClass(Exception.class);
verify(callbackDispatcher).endTasksWithError(listCaptor.capture(), causeCaptor.capture());
assertThat(listCaptor.getValue()).containsExactly(tasks);
assertThat(causeCaptor.getValue()).isExactlyInstanceOf(UnknownHostException.class);
}
代码示例来源:origin: lingochamp/okdownload
verify(callbackDispatcher).endTasksWithCanceled(callbackCanceledList.capture());
assertThat(callbackCanceledList.getValue())
.containsExactly(readyASyncCallTask, runningAsyncCallTask, runningSyncCallTask);
代码示例来源:origin: eclipse-vertx/vert.x
assertThat(command.states).hasSize(3).containsExactly(Thread.State.NEW, Thread.State.BLOCKED,
Thread.State.RUNNABLE);
assertThat(command.ints).hasSize(3).containsExactly(1, 2, 3);
assertThat(command.strings).hasSize(1).containsExactly("a");
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void should_return_query_plan_of_wrapped_policy() {
when(wrappedPolicy.newQueryPlan(any(String.class), any(Statement.class)))
.thenReturn(Iterators.forArray(host1, host2, host3));
HostFilterPolicy policy = new HostFilterPolicy(wrappedPolicy, null);
assertThat(policy.newQueryPlan("keyspace", mock(Statement.class)))
.containsExactly(host1, host2, host3);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void should_respect_topological_order() {
// given
TokenAwarePolicy policy = new TokenAwarePolicy(childPolicy, TOPOLOGICAL);
policy.init(cluster, null);
// when
Iterator<Host> queryPlan = policy.newQueryPlan("keyspace", statement);
// then
assertThat(queryPlan).containsExactly(host1, host2, host4, host3);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
@Test(groups = "unit")
public void should_respect_child_policy_order() {
// given
TokenAwarePolicy policy = new TokenAwarePolicy(childPolicy, NEUTRAL);
policy.init(cluster, null);
// when
Iterator<Host> queryPlan = policy.newQueryPlan("keyspace", statement);
// then
assertThat(queryPlan).containsExactly(host2, host1, host4, host3);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
assertThat(pool.trash).containsExactly(connection1);
assertThat(pool.trash).containsExactly(connection1);
assertThat(connection1.inFlight.get()).isEqualTo(50);
assertThat(connection2.inFlight.get()).isEqualTo(50);
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
assertThat(pool.trash).containsExactly(connection1);
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
assertThat(pool.trash).containsExactly(connection1);
assertThat(connection1.inFlight.get()).isEqualTo(51);
assertThat(connection1.isClosed()).isFalse();
代码示例来源:origin: io.vertx/vertx-core
assertThat(command.states).hasSize(3).containsExactly(Thread.State.NEW, Thread.State.BLOCKED,
Thread.State.RUNNABLE);
assertThat(command.ints).hasSize(3).containsExactly(1, 2, 3);
assertThat(command.strings).hasSize(1).containsExactly("a");
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
assertThat(initHostsCaptor.getValue()).containsExactly(host1);
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core
UserType fooType = cluster2.getMetadata().getKeyspace("ks").getUserType("foo");
assertThat(fooType.getFieldNames()).containsExactly("i");
内容来源于网络,如有侵权,请联系作者删除!