• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BDDAssertions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.assertj.core.api.BDDAssertions的典型用法代码示例。如果您正苦于以下问题:Java BDDAssertions类的具体用法?Java BDDAssertions怎么用?Java BDDAssertions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BDDAssertions类属于org.assertj.core.api包,在下文中一共展示了BDDAssertions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: saveShouldMapCorrectly

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void saveShouldMapCorrectly() throws Exception {
    Customer customer = new Customer(null, "first", "last", "[email protected]");
    Customer saved = this.testEntityManager.persistFlushFind(customer);

    BDDAssertions.then(saved.getId()).isNotNull();

    BDDAssertions.then(saved.getFirstName()).isEqualToIgnoringCase("first");
    BDDAssertions.then(saved.getFirstName()).isNotBlank();

    BDDAssertions.then(saved.getLastName()).isEqualToIgnoringCase("last");
    BDDAssertions.then(saved.getLastName()).isNotBlank();

    BDDAssertions.then(saved.getEmail()).isEqualToIgnoringCase("[email protected]");
    BDDAssertions.then(saved.getLastName()).isNotBlank();

}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:cdct,代码行数:18,代码来源:CustomerRepositoryTest.java


示例2: repositorySaveShouldMapCorrectly

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void repositorySaveShouldMapCorrectly() {

    Customer customer = new Customer(null, "first", "last", "[email protected]");
    Customer saved = this.repository.save(customer);

    BDDAssertions.then(saved.getId()).isNotNull();

    BDDAssertions.then(saved.getFirstName()).isEqualToIgnoringCase("first");
    BDDAssertions.then(saved.getFirstName()).isNotBlank();

    BDDAssertions.then(saved.getLastName()).isEqualToIgnoringCase("last");
    BDDAssertions.then(saved.getLastName()).isNotBlank();

    BDDAssertions.then(saved.getEmail()).isEqualToIgnoringCase("[email protected]");
    BDDAssertions.then(saved.getLastName()).isNotBlank();
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:cdct,代码行数:18,代码来源:CustomerRepositoryTest.java


示例3: customerByIdShouldReturnACustomer

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void customerByIdShouldReturnACustomer() {

    WireMock.stubFor(WireMock.get(WireMock.urlMatching("/customers/1"))
            .willReturn(
                    WireMock.aResponse()
                            .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE)
                            .withStatus(HttpStatus.OK.value())
                            .withBody(asJson(customerById))
            ));

    Customer customer = client.getCustomerById(1L);
    BDDAssertions.then(customer.getFirstName()).isEqualToIgnoringCase("first");
    BDDAssertions.then(customer.getLastName()).isEqualToIgnoringCase("last");
    BDDAssertions.then(customer.getEmail()).isEqualToIgnoringCase("email");
    BDDAssertions.then(customer.getId()).isEqualTo(1L);
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:testing-101,代码行数:18,代码来源:CustomerClientWiremockTest.java


示例4: clientCanTalkToService

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void clientCanTalkToService() {

    cf.applications()
            .pushManifest(
                    PushApplicationManifestRequest
                            .builder()
                            .manifest(ApplicationManifestUtils.read(this.manifest.toPath()).get(0))
                            .build())
            .block();

    Customer customerById = this.client.getCustomerById(1L);
    BDDAssertions.then(customerById.getId()).isEqualTo(1L);
    BDDAssertions.then(customerById.getFirstName()).isEqualTo("a");
    BDDAssertions.then(customerById.getLastName()).isEqualTo("a");
    BDDAssertions.then(customerById.getEmail()).isEqualTo("[email protected]");
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:testing-101,代码行数:18,代码来源:CustomerItApplicationTests.java


示例5: should_create_a_valid_span_from_custom_headers

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void should_create_a_valid_span_from_custom_headers() {
	final Span newSpan = this.tracer.createSpan("new_span");
	ResponseEntity<Map> responseEntity = null;
	try {
		RequestEntity<?> requestEntity = RequestEntity
				.get(URI.create("http://localhost:" + this.config.port + "/headers"))
				.build();
		responseEntity = this.restTemplate.exchange(requestEntity, Map.class);

		} finally {
		this.tracer.close(newSpan);
	}
	await().atMost(5, SECONDS).untilAsserted(() -> {
		then(this.accumulator.getSpans().stream().filter(
				span -> span.getSpanId() == newSpan.getSpanId()).findFirst().get())
				.hasTraceIdEqualTo(newSpan.getTraceId());
	});
	BDDAssertions.then(responseEntity.getBody())
			.containsEntry("correlationid", Span.idToHex(newSpan.getTraceId()))
			.containsKey("myspanid")
			.as("input request headers");
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:25,代码来源:TraceFilterCustomExtractorTests.java


示例6: should_close_span_upon_failure_callback

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_close_span_upon_failure_callback()
		throws ExecutionException, InterruptedException {
	ListenableFuture<ResponseEntity<String>> future;
	try {
		future = this.asyncRestTemplate
				.getForEntity("http://localhost:" + port() + "/blowsup", String.class);
		future.get();
		BDDAssertions.fail("should throw an exception from the controller");
	} catch (Exception e) {

	}

	Awaitility.await().untilAsserted(() -> {
		then(new ArrayList<>(this.accumulator.getSpans()).stream()
				.filter(span -> span.logs().stream().filter(log -> Span.CLIENT_RECV.equals(log.getEvent()))
						.findFirst().isPresent()).findFirst().get()).matches(
				span -> span.getAccumulatedMicros() >= TimeUnit.MILLISECONDS.toMicros(100))
				.hasATagWithKey(Span.SPAN_ERROR_TAG_NAME);
		then(this.tracer.getCurrentSpan()).isNull();
		then(ExceptionUtils.getLastException()).isNull();
	});
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-sleuth,代码行数:24,代码来源:TraceWebAsyncClientAutoConfigurationTests.java


示例7: test

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
public void test() {
    final SQSProjectSettings holder = new SQSProjectSettings();
    BDDAssertions.then(holder.getInfo("serverId")).isNull();

    holder.setInfo("serverId", XMLBasedSQSInfoHelper.createServerInfo("serverId"));
    BDDAssertions.then(holder.getInfo("serverId")).isNotNull();
    BDDAssertions.then(holder.getInfo("serverId2")).isNull();

    holder.setInfo("serverId2", XMLBasedSQSInfoHelper.createServerInfo("serverId2"));
    BDDAssertions.then(holder.getInfo("serverId")).isNotNull();
    BDDAssertions.then(holder.getInfo("serverId2")).isNotNull();

    holder.remove("serverId");
    holder.remove("serverId2");
    BDDAssertions.then(holder.getInfo("serverId")).isNull();
    BDDAssertions.then(holder.getInfo("serverId2")).isNull();
}
 
开发者ID:JetBrains,项目名称:TeamCity.SonarQubePlugin,代码行数:18,代码来源:SQSProjectSettingsTest.java


示例8: should_remove_from_both

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
public void should_remove_from_both() throws IOException {
    final SQSManagerImpl sqsManager = mock(SQSManagerImpl.class);
    final SQSManagerProjectFeatures sqsManagerProjectFeatures = mock(SQSManagerProjectFeatures.class);
    final MigratingSQSManager migratingSQSManager = new MigratingSQSManager(sqsManager, sqsManagerProjectFeatures, mock(ConfigActionFactory.class));

    final BaseSQSInfo any = new BaseSQSInfo("any");

    when(sqsManagerProjectFeatures.removeServer(any(), any())).thenReturn(new SQSManager.SQSActionResult(any, null, ""));
    when(sqsManager.removeServer(any(), any())).thenReturn(new SQSManager.SQSActionResult(any, null, ""));

    final SQSManager.SQSActionResult result = migratingSQSManager.removeServer(myProject, "any");
    verify(sqsManagerProjectFeatures, times(1)).removeServer(myProject, "any");
    verify(sqsManager, times(1)).removeServer(myProject, "any");
    BDDAssertions.then(result.getBeforeAction()).isNotNull();
    BDDAssertions.then(result.isError()).isFalse();

    reset(sqsManagerProjectFeatures, sqsManager);
    when(sqsManagerProjectFeatures.removeServer(any(), any())).thenReturn(new SQSManager.SQSActionResult(null, null, "", true));
    when(sqsManager.removeServer(any(), any())).thenReturn(new SQSManager.SQSActionResult(null, null, "", true));

    final SQSManager.SQSActionResult result2 = migratingSQSManager.removeServer(myProject, "any");
    verify(sqsManagerProjectFeatures, times(1)).removeServer(myProject, "any");
    verify(sqsManager, times(1)).removeServer(myProject, "any");
    BDDAssertions.then(result2.getBeforeAction()).isNull();
    BDDAssertions.then(result2.isError()).isTrue();
}
 
开发者ID:JetBrains,项目名称:TeamCity.SonarQubePlugin,代码行数:27,代码来源:MigratingSQSManagerTest.java


示例9: should_first_fail_then_succeed_to_process_tax_factor_for_person

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_first_fail_then_succeed_to_process_tax_factor_for_person() throws ConnectException {
    // given
    willThrow(new ConnectException()).willNothing().given(taxFactorService).updateMeanTaxFactor(any(Person.class), anyDouble());
 
 // when
 when(systemUnderTest).processTaxDataFor(new Person());

 // then
    then(caughtException()).hasCauseInstanceOf(ConnectException.class);

 // when
 boolean success = systemUnderTest.processTaxDataFor(new Person());

 // then
    BDDAssertions.then(success).isTrue();
}
 
开发者ID:marcingrzejszczak,项目名称:mockito-cookbook,代码行数:18,代码来源:PersonDataUpdatorTestNgTest.java


示例10: customerByIdShouldReturnACustomer

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void customerByIdShouldReturnACustomer() {

    Customer customer = client.getCustomerById(1L);
    BDDAssertions.then(customer.getFirstName()).isEqualToIgnoringCase("first");
    BDDAssertions.then(customer.getLastName()).isEqualToIgnoringCase("last");
    BDDAssertions.then(customer.getEmail()).isEqualToIgnoringCase("email");
    BDDAssertions.then(customer.getId()).isEqualTo(1L);
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:cdct,代码行数:10,代码来源:CustomerClientWiremockTest.java


示例11: customerByIdShouldReturnACustomer

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void customerByIdShouldReturnACustomer() {

    this.mockRestServiceServer
            .expect(ExpectedCount.manyTimes(), requestTo("http://localhost:8080/customers/1"))
            .andExpect(method(HttpMethod.GET))
            .andRespond(withSuccess(this.customerById, MediaType.APPLICATION_JSON_UTF8));

    Customer customer = client.getCustomerById(1L);
    BDDAssertions.then(customer.getFirstName()).isEqualToIgnoringCase("first");
    BDDAssertions.then(customer.getLastName()).isEqualToIgnoringCase("last");
    BDDAssertions.then(customer.getEmail()).isEqualToIgnoringCase("email");
    BDDAssertions.then(customer.getId()).isEqualTo(1L);
    this.mockRestServiceServer.verify();
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:cdct,代码行数:16,代码来源:CustomerClientRestServiceServerTest.java


示例12: newInstanceWithValidValuesShouldReturnARecord

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void newInstanceWithValidValuesShouldReturnARecord() {
    Customer customer = new Customer(1L, "first", "last", "[email protected]");
    BDDAssertions.then(customer.getFirstName()).isEqualToIgnoringCase("first");
    BDDAssertions.then(customer.getLastName()).isEqualToIgnoringCase("last");
    BDDAssertions.then(customer.getEmail()).isEqualToIgnoringCase("[email protected]");
    BDDAssertions.then(customer.getId()).isNotNull();
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:cdct,代码行数:9,代码来源:CustomerTest.java


示例13: should_return_charge_collection

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_return_charge_collection() {
	Charges charges = manager.listAllCharges("foo");

	BDDAssertions.then(charges.getCharges())
			.hasSize(25);
}
 
开发者ID:marcingrzejszczak,项目名称:the-legacy-app,代码行数:8,代码来源:CustomerWithStubRunnerProxyTests.java


示例14: should_return_charge_collection

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_return_charge_collection() {
	String object = new RestTemplate()
			.getForObject("http://localhost:7654/", String.class);

	BDDAssertions.then(object).contains("dsyer");
}
 
开发者ID:marcingrzejszczak,项目名称:the-legacy-app,代码行数:8,代码来源:OnlineModeTests.java


示例15: should_return_charge_collection

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_return_charge_collection() {
	Charges charges = manager.listAllCharges("foo");

	BDDAssertions.then(charges.getCharges())
			.extracting("customer")
			.containsExactly("a", "b", "c");
}
 
开发者ID:marcingrzejszczak,项目名称:the-legacy-app,代码行数:9,代码来源:CustomerRentalHistoryManagerImplTests.java


示例16: should_not_update_pom_when_project_is_not_on_the_versions_list

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_not_update_pom_when_project_is_not_on_the_versions_list() throws Exception {
	File springCloudReleasePom = file("/projects/spring-cloud-release");

	BDDAssertions
			.then(this.pomUpdater.shouldProjectBeUpdated(springCloudReleasePom, this.versions)).isFalse();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:8,代码来源:PomUpdaterTests.java


示例17: should_update_pom_when_project_is_not_on_the_versions_list

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_update_pom_when_project_is_not_on_the_versions_list() throws Exception {
	File springCloudSleuthPom = file("/projects/spring-cloud-sleuth");

	BDDAssertions
			.then(this.pomUpdater.shouldProjectBeUpdated(springCloudSleuthPom, this.versions)).isTrue();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:8,代码来源:PomUpdaterTests.java


示例18: should_not_update_child_pom_when_project_is_not_on_the_versions_list

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_not_update_child_pom_when_project_is_not_on_the_versions_list() throws Exception {
	File springCloudReleasePom = file("/projects/spring-cloud-release");

	BDDAssertions
			.then(this.pomUpdater.shouldProjectBeUpdated(springCloudReleasePom, this.versions)).isFalse();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:8,代码来源:PomUpdaterTests.java


示例19: should_update_child_pom_when_project_is_not_on_the_versions_list

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_update_child_pom_when_project_is_not_on_the_versions_list() throws Exception {
	File springCloudSleuthPom = file("/projects/spring-cloud-sleuth");

	BDDAssertions
			.then(this.pomUpdater.shouldProjectBeUpdated(springCloudSleuthPom, this.versions)).isTrue();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:8,代码来源:PomUpdaterTests.java


示例20: should_override_a_pom_when_there_was_a_change_in_the_model

import org.assertj.core.api.BDDAssertions; //导入依赖的package包/类
@Test
public void should_override_a_pom_when_there_was_a_change_in_the_model() throws Exception {
	File beforeProcessing = pom("/projects/project/children", "pom_matching_properties.xml");
	File afterProcessing = tmpFile("/project/children/pom_matching_properties.xml");
	ModelWrapper model = this.pomUpdater.updateModel(model("spring-cloud-sleuth"), afterProcessing, this.versions);

	File processedPom = this.pomUpdater.overwritePomIfDirty(model, Versions.EMPTY_VERSION, afterProcessing);

	String processedPomText = asString(processedPom);
	String beforeProcessingText = asString(beforeProcessing);
	BDDAssertions.then(processedPomText).isNotEqualTo(beforeProcessingText);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:13,代码来源:PomUpdaterTests.java



注:本文中的org.assertj.core.api.BDDAssertions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IInputStreamOpener类代码示例发布时间:2022-05-22
下一篇:
Java JobConsoleLogger类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap