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

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

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

AbstractListAssert.isSameAs介绍

暂无

代码示例

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

assertThat(delegateMethodDescription.returnType).isEqualTo(returnType);
assertThat(delegateMethodDescription.name).isEqualTo(name);
assertThat(delegateMethodDescription.annotations).isSameAs(annotations);
assertThat(delegateMethodDescription.definedParameterTypes).isSameAs(parameterTypes);
assertThat(delegateMethodDescription.optionalParameterTypes).isSameAs(optionalParameterTypes);
assertThat(delegateMethodDescription.exceptions).isSameAs(exceptions);

代码示例来源:origin: TNG/junit-dataprovider

@Test
public void testGetDataProviderMethodShouldReturnedChachedValueIfExists() {
  // Given:
  final List<FrameworkMethod> expected = asList(dataProviderMethod, testMethod);
  underTest.dataProviderMethods = new HashMap<FrameworkMethod, List<FrameworkMethod>>();
  underTest.dataProviderMethods.put(testMethod, expected);
  // When:
  List<FrameworkMethod> result = underTest.getDataProviderMethods(testMethod);
  // Then:
  assertThat(result).isSameAs(expected);
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void getUserIdHeaderKeys_returns_userIdHeaderKeysFromInitParam_field() {
  // given
  RequestTracingFilter filter = new RequestTracingFilter();
  List<String> expectedUserIdHeaderKeys = Arrays.asList(UUID.randomUUID().toString(),
                             UUID.randomUUID().toString());
  filter.userIdHeaderKeysFromInitParam = expectedUserIdHeaderKeys;
  // when
  List<String> result = filter.getUserIdHeaderKeys();
  // then
  assertThat(result).isSameAs(expectedUserIdHeaderKeys);
}

代码示例来源:origin: TNG/junit-dataprovider

@Test
public void testComputeTestMethodsShouldNotCallGenerateExplodedTestMethodsAndUseCachedResultIfCalledTheSecondTime() {
  // Given:
  final List<FrameworkMethod> expected = new ArrayList<FrameworkMethod>();
  underTest.computedTestMethods = expected;
  doReturn(expected).when(underTest).generateExplodedTestMethodsFor(anyListOf(FrameworkMethod.class));
  // When:
  List<FrameworkMethod> result = underTest.computeTestMethods();
  // Then:
  assertThat(result).isSameAs(expected);
  assertThat(underTest.computedTestMethods).isSameAs(expected);
  verify(underTest).computeTestMethods();
  verifyNoMoreInteractions(underTest);
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void invokeAll_no_timeout_uses_convertToCallableWithTracingList_to_convert_tasks()
  throws InterruptedException {
  // given
  ExecutorServiceWithTracing instanceSpy = spy(instance);
  List<Callable<Object>> origTasks = Arrays.asList(mock(Callable.class), mock(Callable.class));
  List<Callable<Object>> convertMethodResult = mock(List.class);
  doReturn(convertMethodResult).when(instanceSpy).convertToCallableWithTracingList(any(Collection.class));
  List<Future<Object>> expectedResultMock = mock(List.class);
  doReturn(expectedResultMock).when(executorServiceMock).invokeAll(any(Collection.class));
  // when
  List<Future<Object>> result = instanceSpy.invokeAll(origTasks);
  // then
  assertThat(result).isSameAs(expectedResultMock);
  verify(instanceSpy).convertToCallableWithTracingList(origTasks);
  verify(executorServiceMock).invokeAll(convertMethodResult);
  verifyNoMoreInteractions(executorServiceMock);
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void invokeAll_with_timeout_uses_convertToCallableWithTracingList_to_convert_tasks()
  throws InterruptedException {
  // given
  ExecutorServiceWithTracing instanceSpy = spy(instance);
  List<Callable<Object>> origTasks = Arrays.asList(mock(Callable.class), mock(Callable.class));
  List<Callable<Object>> convertMethodResult = mock(List.class);
  doReturn(convertMethodResult).when(instanceSpy).convertToCallableWithTracingList(any(Collection.class));
  List<Future<Object>> expectedResultMock = mock(List.class);
  doReturn(expectedResultMock).when(executorServiceMock)
                .invokeAll(any(Collection.class), anyLong(), any(TimeUnit.class));
  long timeoutValue = 42;
  TimeUnit timeoutTimeUnit = TimeUnit.MINUTES;
  // when
  List<Future<Object>> result = instanceSpy.invokeAll(origTasks, timeoutValue, timeoutTimeUnit);
  // then
  assertThat(result).isSameAs(expectedResultMock);
  verify(instanceSpy).convertToCallableWithTracingList(origTasks);
  verify(executorServiceMock).invokeAll(convertMethodResult, timeoutValue, timeoutTimeUnit);
  verifyNoMoreInteractions(executorServiceMock);
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void invokeAll_no_timeout_passes_through_to_delegate_with_tracing_wrapped_tasks()
  throws InterruptedException {
  // given
  List<Callable<Object>> origTasks = Arrays.asList(mock(Callable.class), mock(Callable.class));
  List<Future<Object>> expectedResultMock = mock(List.class);
  doReturn(expectedResultMock).when(executorServiceMock).invokeAll(any(Collection.class));
  TracingState expectedTracingState = generateTracingStateOnCurrentThread();
  // when
  List<Future<Object>> result = instance.invokeAll(origTasks);
  // then
  assertThat(result).isSameAs(expectedResultMock);
  verify(executorServiceMock).invokeAll(collectionCaptor.capture());
  List<Callable<Object>> actualTasks = (List<Callable<Object>>) collectionCaptor.getValue();
  assertThat(actualTasks).hasSameSizeAs(origTasks);
  for (int i = 0; i < actualTasks.size(); i++) {
    Callable<Object> actualTask = actualTasks.get(i);
    Callable<Object> origTaskMock = origTasks.get(i);
    verifyCallableWithTracingWrapper(actualTask, origTaskMock, expectedTracingState);
  }
  verifyNoMoreInteractions(executorServiceMock);
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void invokeAll_with_timeout_passes_through_to_delegate_with_tracing_wrapped_tasks()
  throws InterruptedException {
  // given
  List<Callable<Object>> origTasks = Arrays.asList(mock(Callable.class), mock(Callable.class));
  List<Future<Object>> expectedResultMock = mock(List.class);
  doReturn(expectedResultMock).when(executorServiceMock)
                .invokeAll(any(Collection.class), anyLong(), any(TimeUnit.class));
  long timeoutValue = 42;
  TimeUnit timeoutTimeUnit = TimeUnit.MINUTES;
  TracingState expectedTracingState = generateTracingStateOnCurrentThread();
  // when
  List<Future<Object>> result = instance.invokeAll(origTasks, timeoutValue, timeoutTimeUnit);
  // then
  assertThat(result).isSameAs(expectedResultMock);
  verify(executorServiceMock).invokeAll(collectionCaptor.capture(), eq(timeoutValue), eq(timeoutTimeUnit));
  List<Callable<Object>> actualTasks = (List<Callable<Object>>) collectionCaptor.getValue();
  assertThat(actualTasks).hasSameSizeAs(origTasks);
  for (int i = 0; i < actualTasks.size(); i++) {
    Callable<Object> actualTask = actualTasks.get(i);
    Callable<Object> origTaskMock = origTasks.get(i);
    verifyCallableWithTracingWrapper(actualTask, origTaskMock, expectedTracingState);
  }
  verifyNoMoreInteractions(executorServiceMock);
}

代码示例来源:origin: Nike-Inc/wingtips

@Test
public void init_method_delegates_to_helpers_to_initialize_fields() throws ServletException {
  // given
  RequestTracingFilter filterSpy = spy(new RequestTracingFilter());
  List<String> expectedUserIdHeaderKeys = Arrays.asList(UUID.randomUUID().toString(),
                             UUID.randomUUID().toString());
  doReturn(expectedUserIdHeaderKeys).when(filterSpy).initializeUserIdHeaderKeys(any(FilterConfig.class));
  doReturn(tagAndNamingStrategy).when(filterSpy).initializeTagAndNamingStrategy(any(FilterConfig.class));
  doReturn(tagAndNamingAdapterMock).when(filterSpy).initializeTagAndNamingAdapter(any(FilterConfig.class));
  // when
  filterSpy.init(filterConfigMock);
  // then
  assertThat(filterSpy.userIdHeaderKeysFromInitParam).isSameAs(expectedUserIdHeaderKeys);
  assertThat(filterSpy.tagAndNamingStrategy).isSameAs(tagAndNamingStrategy);
  assertThat(filterSpy.tagAndNamingAdapter).isSameAs(tagAndNamingAdapterMock);
  verify(filterSpy).init(filterConfigMock);
  verify(filterSpy).initializeUserIdHeaderKeys(filterConfigMock);
  verify(filterSpy).initializeTagAndNamingStrategy(filterConfigMock);
  verify(filterSpy).initializeTagAndNamingAdapter(filterConfigMock);
  verifyNoMoreInteractions(filterSpy);
}

相关文章

微信公众号

最新文章

更多