本文整理了Java中org.assertj.core.api.AbstractCharSequenceAssert.isSameAs()
方法的一些代码示例,展示了AbstractCharSequenceAssert.isSameAs()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractCharSequenceAssert.isSameAs()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractCharSequenceAssert
类名称:AbstractCharSequenceAssert
方法名:isSameAs
暂无
代码示例来源:origin: SonarSource/sonarqube
@Test
public void shouldMergeParentProperties() {
// Use a random value to avoid VM optimization that would create constant String and make s1 and s2 the same object
int i = (int) Math.random() * 10;
String s1 = "value" + i;
String s2 = "value" + i;
Map<String, String> parentProps = new HashMap<>();
parentProps.put("toBeMergeProps", "fooParent");
parentProps.put("existingChildProp", "barParent");
parentProps.put("duplicatedProp", s1);
parentProps.put("sonar.projectDescription", "Desc from Parent");
Map<String, String> childProps = new HashMap<>();
childProps.put("existingChildProp", "barChild");
childProps.put("otherProp", "tutuChild");
childProps.put("duplicatedProp", s2);
ProjectReactorBuilder.mergeParentProperties(childProps, parentProps);
assertThat(childProps).hasSize(4);
assertThat(childProps.get("toBeMergeProps")).isEqualTo("fooParent");
assertThat(childProps.get("existingChildProp")).isEqualTo("barChild");
assertThat(childProps.get("otherProp")).isEqualTo("tutuChild");
assertThat(childProps.get("sonar.projectDescription")).isNull();
assertThat(childProps.get("duplicatedProp")).isSameAs(parentProps.get("duplicatedProp"));
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void getRawSourceHash_reads_lines_from_SourceLinesRepository_only_the_first_time() {
when(mockedSourceLinesRepository.readLines(FILE_COMPONENT)).thenReturn(CloseableIterator.from(Arrays.asList(SOME_LINES).iterator()));
String rawSourceHash = mockedUnderTest.getRawSourceHash(FILE_COMPONENT);
String rawSourceHash1 = mockedUnderTest.getRawSourceHash(FILE_COMPONENT);
assertThat(rawSourceHash).isSameAs(rawSourceHash1);
verify(mockedSourceLinesRepository, times(1)).readLines(FILE_COMPONENT);
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void sameObject() {
String s1 = "a";
String s2 = s1;
assertThat(s1).isSameAs(s2);
assertThat(compare(s1, s2)).isZero();
assertThat(compare(s1, s2)).isZero();
}
代码示例来源:origin: SonarSource/sonarqube
@Test
public void verify_getters_of_ProjectAnalysis_object_passed_to_PostProjectAnalysisTask() {
underTest.withOrganization(organization).withCeTask(ceTask).withProject(project).withQualityGate(qualityGate).withAnalysisUuid(analysisUuid).at(someDate);
underTest.execute();
PostProjectAnalysisTask.ProjectAnalysis projectAnalysis = captorPostProjectAnalysisTask.projectAnalysis;
assertThat(projectAnalysis).isNotNull();
assertThat(projectAnalysis.getOrganization().get()).isSameAs(organization);
assertThat(projectAnalysis.getCeTask()).isSameAs(ceTask);
assertThat(projectAnalysis.getProject()).isSameAs(project);
assertThat(projectAnalysis.getDate()).isSameAs(someDate);
assertThat(projectAnalysis.getQualityGate()).isSameAs(qualityGate);
assertThat(projectAnalysis.getAnalysis().get().getAnalysisUuid()).isSameAs(analysisUuid);
}
代码示例来源:origin: facebook/litho
@Test
public void testAccessibilityRoleDescription() {
final CharSequence roleDescription = "Test Role Description";
mNodeInfo.setAccessibilityRoleDescription(roleDescription);
assertThat(roleDescription).isSameAs(mNodeInfo.getAccessibilityRoleDescription());
mUpdatedNodeInfo.updateWith(mNodeInfo);
assertThat(roleDescription).isSameAs(mUpdatedNodeInfo.getAccessibilityRoleDescription());
mNodeInfo.release();
assertThat(mNodeInfo.getAccessibilityRoleDescription()).isNull();
}
代码示例来源:origin: facebook/litho
@Test
public void testAccessibilityRole() {
@AccessibilityRole.AccessibilityRoleType final String role = AccessibilityRole.BUTTON;
mNodeInfo.setAccessibilityRole(role);
assertThat(role).isSameAs(mNodeInfo.getAccessibilityRole());
mUpdatedNodeInfo.updateWith(mNodeInfo);
assertThat(role).isSameAs(mUpdatedNodeInfo.getAccessibilityRole());
mNodeInfo.release();
assertThat(mNodeInfo.getAccessibilityRole()).isNull();
}
代码示例来源:origin: facebook/litho
@Test
public void testComponentOnClick() {
final Class activityClassToLaunch = PlaygroundActivity.class;
final DemoListItemComponent.Builder builder =
DemoListItemComponent.create(mComponentsRule.getContext())
.model(new DemoListActivity.DemoListDataModel("My Component", activityClassToLaunch))
.currentIndices(null);
// For this test, we mount the view and dispatch the event through the regular
// Android event mechanism.
final LithoView lithoView = ComponentTestHelper.mountComponent(builder);
lithoView.performClick();
final Intent nextIntent =
shadowOf(mComponentsRule.getContext().getAndroidContext())
.getShadowApplication()
.getNextStartedActivity();
assertThat(nextIntent.getComponent().getClassName()).isSameAs(activityClassToLaunch.getName());
}
代码示例来源:origin: facebook/litho
assertThat(newContentDescription).isSameAs(oldContentDescription);
assertThat(oldBackground).isSameAs(newBackground);
代码示例来源:origin: facebook/litho
@Test
public void testComponentOnSyntheticEventClick() {
final Class activityClassToLaunch = PlaygroundActivity.class;
final Component component =
DemoListItemComponent.create(mComponentsRule.getContext())
.model(new DemoListActivity.DemoListDataModel("My Component", activityClassToLaunch))
.currentIndices(null)
.build();
// Here, we make use of Litho's internal event infrastructure and manually dispatch the event.
final ComponentContext componentContext =
withComponentScope(mComponentsRule.getContext(), component);
component
.getEventDispatcher()
.dispatchOnEvent(DemoListItemComponent.onClick(componentContext), new ClickEvent());
final Intent nextIntent =
shadowOf(mComponentsRule.getContext().getAndroidContext())
.getShadowApplication()
.getNextStartedActivity();
assertThat(nextIntent.getComponent().getClassName()).isSameAs(activityClassToLaunch.getName());
}
}
代码示例来源:origin: facebook/litho
@Test
public void testGetters() {
assertThat(mMountItem.getComponent()).isSameAs((Component) mComponent);
assertThat(mMountItem.getHost()).isSameAs(mComponentHost);
assertThat(mMountItem.getBaseContent()).isSameAs(mContent);
assertThat(mMountItem.getMountableContent()).isSameAs(mContent);
assertThat(mMountItem.getNodeInfo().getContentDescription()).isSameAs(mContentDescription);
assertThat(mMountItem.getNodeInfo().getClickHandler()).isSameAs(mClickHandler);
assertThat(mMountItem.getNodeInfo().getFocusChangeHandler()).isSameAs(mFocusChangeHandler);
assertThat(mMountItem.getNodeInfo().getTouchHandler()).isSameAs(mTouchHandler);
assertThat(mMountItem.getLayoutFlags()).isEqualTo(mFlags);
assertThat(mMountItem.getImportantForAccessibility())
.isEqualTo(IMPORTANT_FOR_ACCESSIBILITY_YES);
}
代码示例来源:origin: spring-projects/spring-ldap
public Object lookup(String dn) {
assertThat(dn).isSameAs(expectedName);
return expectedResult;
}
};
代码示例来源:origin: Nike-Inc/wingtips
@Test
public void unescapeJson_returns_same_instance_if_no_backspace_chars_exist() {
// given
String orig = UUID.randomUUID().toString();
// expect
assertThat(SpanParser.unescapeJson(orig)).isSameAs(orig);
}
代码示例来源:origin: Nike-Inc/wingtips
@Test
public void escapeJson_returns_same_instance_if_no_chars_need_escaping() {
// given
String orig = UUID.randomUUID().toString();
// expect
assertThat(SpanParser.escapeJson(orig)).isSameAs(orig);
}
代码示例来源:origin: Nike-Inc/fastbreak
@Test
public void executeBlockingCall_calls_handleEvent_and_returns_event_from_supplier() throws Exception {
// given
String uuid = UUID.randomUUID().toString();
Callable<String> supplier = () -> uuid;
// when
String result = cbSpy.executeBlockingCall(supplier);
// then
verify(cbSpy).handleEvent(uuid);
assertThat(result).isSameAs(uuid);
}
代码示例来源:origin: Nike-Inc/riposte
@Test
public void findSingleEndpointForExecution_returns_matching_endpoint() {
// given
doReturn(Optional.of(defaultPath)).when(matcherMock).matchesPath(any(RequestInfo.class));
doReturn(true).when(matcherMock).matchesMethod(any(RequestInfo.class));
// when
Pair<Endpoint<?>, String> result = handlerSpy.findSingleEndpointForExecution(requestInfoMock);
// then
assertThat(result.getKey()).isSameAs(endpointMock);
assertThat(result.getValue()).isSameAs(defaultPath);
}
代码示例来源:origin: Nike-Inc/fastbreak
@Test
public void kitchen_sink_constructor_uses_non_empty_arguments_passed_in() {
// given
ScheduledExecutorService scheduler = mock(ScheduledExecutorService.class);
ExecutorService scne = mock(ExecutorService.class);
Integer maxFailures = 42;
Duration resetTimeout = Duration.ofSeconds(42);
Optional<Duration> callTimeout = Optional.of(Duration.ofSeconds(4242));
String id = UUID.randomUUID().toString();
// when
CircuitBreakerForHttpStatusCode cb =
new CircuitBreakerForHttpStatusCode(Optional.of(scheduler), Optional.of(scne), Optional.of(maxFailures),
Optional.of(resetTimeout), callTimeout, Optional.of(id));
// then
assertThat(cb.scheduler).isSameAs(scheduler);
assertThat(cb.stateChangeNotificationExecutor).isSameAs(scne);
assertThat(cb.maxConsecutiveFailuresAllowed).isSameAs(maxFailures);
assertThat(cb.resetTimeoutNanos).isEqualTo(resetTimeout.toNanos());
assertThat(cb.callTimeoutNanos).isEqualTo(callTimeout.map(Duration::toNanos));
assertThat(cb.id).isSameAs(id);
assertThat(cb.breakingEventStrategy).isSameAs(cb.DEFAULT_HTTP_RESPONSE_BREAKING_EVENT_STRATEGY);
assertThat(cb.breakingExceptionStrategy).isSameAs(cb.DEFAULT_BREAKING_EXCEPTION_STRATEGY);
}
代码示例来源:origin: Nike-Inc/fastbreak
@Test
public void kitchen_sink_constructor_uses_non_empty_arguments_passed_in() {
// given
ScheduledExecutorService scheduler = mock(ScheduledExecutorService.class);
ExecutorService scne = mock(ExecutorService.class);
Integer maxFailures = 42;
Duration resetTimeout = Duration.ofSeconds(42);
Optional<Duration> callTimeout = Optional.of(Duration.ofSeconds(4242));
String id = UUID.randomUUID().toString();
BreakingEventStrategy<String> eventStrategy = mock(BreakingEventStrategy.class);
BreakingExceptionStrategy errorStrategy = mock(BreakingExceptionStrategy.class);
// when
CircuitBreakerImpl<String> cb =
new CircuitBreakerImpl<>(
Optional.of(scheduler), Optional.of(scne), Optional.of(maxFailures), Optional.of(resetTimeout),
callTimeout, Optional.of(id), Optional.of(eventStrategy), Optional.of(errorStrategy)
);
// then
assertThat(cb.scheduler).isSameAs(scheduler);
assertThat(cb.stateChangeNotificationExecutor).isSameAs(scne);
assertThat(cb.maxConsecutiveFailuresAllowed).isSameAs(maxFailures);
assertThat(cb.resetTimeoutNanos).isEqualTo(resetTimeout.toNanos());
assertThat(cb.callTimeoutNanos).isEqualTo(callTimeout.map(Duration::toNanos));
assertThat(cb.id).isSameAs(id);
assertThat(cb.breakingEventStrategy).isSameAs(eventStrategy);
assertThat(cb.breakingExceptionStrategy).isSameAs(errorStrategy);
}
代码示例来源:origin: Nike-Inc/fastbreak
assertThat(cb.resetTimeoutNanos).isEqualTo(resetTimeout.toNanos());
assertThat(cb.callTimeoutNanos).isEqualTo(Optional.of(callTimeout.toNanos()));
assertThat(cb.id).isSameAs(id);
assertThat(cb.breakingEventStrategy).isSameAs(eventStrategy);
assertThat(cb.breakingExceptionStrategy).isSameAs(errorStrategy);
内容来源于网络,如有侵权,请联系作者删除!