org.assertj.core.api.BDDAssertions Java Examples

The following examples show how to use org.assertj.core.api.BDDAssertions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZookeeperDiscoveryWithDyingDependenciesTests.java    From spring-cloud-zookeeper with Apache License 2.0 6 votes vote down vote up
private Callable<Boolean> applicationHasStartedOnANewPort(
		final ConfigurableApplicationContext clientContext,
		final Integer serverPortBeforeDying) {
	return new Callable<Boolean>() {
		@Override
		public Boolean call() throws Exception {
			try {
				BDDAssertions.then(callServiceAtPortEndpoint(clientContext))
						.isNotEqualTo(serverPortBeforeDying);
			}
			catch (Exception e) {
				log.error("Exception occurred while trying to call the server", e);
				return false;
			}
			return true;
		}
	};
}
 
Example #2
Source File: SpringSingleProjectAcceptanceTests.java    From spring-cloud-release-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void should_fail_to_perform_a_release_of_consul_when_sc_release_contains_snapshots()
		throws Exception {
	checkoutReleaseTrainBranch("/projects/spring-cloud-release-with-snapshot/",
			"vCamden.SR5.BROKEN");
	File origin = cloneToTemporaryDirectory(this.springCloudConsulProject);
	assertThatClonedConsulProjectIsInSnapshots(origin);
	File project = cloneToTemporaryDirectory(tmpFile("spring-cloud-consul"));
	GitTestUtils.setOriginOnProjectToTmp(origin, project);

	run(this.runner,
			properties("debug=true").properties(new ArgsBuilder(project, this.tmp)
					.releaseTrainUrl("/projects/spring-cloud-release-with-snapshot/")
					.bomBranch("vCamden.SR5.BROKEN").expectedVersion("1.1.2.RELEASE")
					.build()),
			context -> {
				SpringReleaser releaser = context.getBean(SpringReleaser.class);
				BDDAssertions.thenThrownBy(releaser::release).hasMessageContaining(
						"there is at least one SNAPSHOT library version in the Spring Cloud Release project");

			});
}
 
Example #3
Source File: PersonDataUpdatorTestNgTest.java    From mockito-cookbook with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #4
Source File: SchedulerExecutionRepositoryTest.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@Test
public void testdeleteById() throws SchedulerExecutionNotFoundException {
    final SchedulerConfiguration schedulerConfiguration = this.createSchedulerConfiguration("deleteByIdApp");
    final SchedulerExecution schedulerExecution = this.createSchedulerExecution(schedulerConfiguration.getId());

    final SchedulerExecution result = this.getSchedulerExecutionRepository().findById(schedulerExecution.getId());
    BDDAssertions.then(result).isEqualTo(schedulerExecution);

    this.getSchedulerExecutionRepository().delete(result.getId());
    try {
        this.getSchedulerExecutionRepository().findById(result.getId());
        fail("Exception not thrown!");
    } catch (final SchedulerExecutionNotFoundException e) {
        log.debug("Exception caught, every is fine", e);
    }
}
 
Example #5
Source File: CustomerRepositoryTest.java    From bootiful-testing-online-training with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #6
Source File: CustomerRepositoryTest.java    From bootiful-testing-online-training with Apache License 2.0 6 votes vote down vote up
@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();

}
 
Example #7
Source File: LazyTraceScheduledThreadPoolExecutorTests.java    From spring-cloud-sleuth with Apache License 2.0 6 votes vote down vote up
@Test
public void should_not_finalize_the_delegate_since_its_a_shared_instance() {
	AtomicBoolean wasCalled = new AtomicBoolean();
	ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(10) {
		@Override
		protected void finalize() {
			super.finalize();
			wasCalled.set(true);
		}
	};
	BeanFactory beanFactory = BDDMockito.mock(BeanFactory.class);

	new LazyTraceScheduledThreadPoolExecutor(10, beanFactory, executor).finalize();

	BDDAssertions.then(wasCalled).isFalse();
	BDDAssertions.then(executor.isShutdown()).isFalse();
}
 
Example #8
Source File: CustomerClientWiremockTest.java    From bootiful-testing-online-training with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #9
Source File: ContractProjectUpdaterTest.java    From spring-cloud-contract with Apache License 2.0 6 votes vote down vote up
@Test
public void should_push_changes_to_current_branch() throws Exception {
	File stubs = new File(
			GitRepoTests.class.getResource("/git_samples/sample_stubs").toURI());

	this.updater.updateContractProject("hello-world", stubs.toPath());

	// project, not origin, cause we're making one more clone of the local copy
	try (Git git = openGitProject(this.project)) {
		RevCommit revCommit = git.log().call().iterator().next();
		then(revCommit.getShortMessage())
				.isEqualTo("Updating project [hello-world] with stubs");
		// I have no idea but the file gets deleted after pushing
		git.reset().setMode(ResetCommand.ResetType.HARD).call();
	}
	BDDAssertions.then(new File(this.project,
			"META-INF/com.example/hello-world/0.0.2/mappings/someMapping.json"))
			.exists();
	BDDAssertions.then(this.gitRepo.gitFactory.provider).isNull();
	BDDAssertions.then(this.outputCapture.toString())
			.contains("No custom credentials provider will be set");
}
 
Example #10
Source File: ProjectsToReleaseGroupsTests.java    From spring-cloud-release-tools with Apache License 2.0 6 votes vote down vote up
@Test
void releaseGroup() {
	ReleaserProperties properties = new ReleaserProperties();
	properties.getMetaRelease().setReleaseGroups(Arrays.asList("c,d", "e,f,g"));
	ProjectsToRun projectsToRun = projectsToRun();

	List<ReleaseGroup> groups = new ProjectsToReleaseGroups(properties)
			.toReleaseGroup(projectsToRun);

	BDDAssertions.then(groups).hasSize(5);
	BDDAssertions.then(projectNames(0, groups)).containsExactly("a");
	BDDAssertions.then(projectNames(1, groups)).containsExactly("b");
	BDDAssertions.then(projectNames(2, groups)).containsExactly("d", "c");
	BDDAssertions.then(projectNames(3, groups)).containsExactly("e", "f", "g");
	BDDAssertions.then(projectNames(4, groups)).containsExactly("h");
}
 
Example #11
Source File: StubsStubDownloaderTests.java    From spring-cloud-contract with Apache License 2.0 6 votes vote down vote up
@Test
public void should_pick_stubs_from_a_given_location_for_a_find_producer_with_gav() {
	String path = url.getPath();
	StubRunnerOptions options = new StubRunnerOptionsBuilder()
			.withStubRepositoryRoot("stubs://file://" + path)
			.withProperties(propsWithFindProducer()).build();
	StubsStubDownloader downloader = new StubsStubDownloader(options);

	Map.Entry<StubConfiguration, File> entry = downloader
			.downloadAndUnpackStubJar(new StubConfiguration("lv.spring:cloud:bye"));

	BDDAssertions.then(entry).isNotNull();
	File stub = new File(entry.getValue().getPath(),
			"lv/spring/cloud/bye/lv_bye.json");
	BDDAssertions.then(stub).exists();
}
 
Example #12
Source File: ReleaseTrainContentsUpdaterTests.java    From spring-cloud-release-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void should_not_update_the_contents_of_wiki_repo_when_release_train_smaller()
		throws GitAPIException, IOException {
	this.properties.getMetaRelease().setEnabled(true);
	this.properties.getGit().setUpdateReleaseTrainWiki(true);
	this.properties.getGit()
			.setReleaseTrainWikiUrl(this.wikiRepo.getAbsolutePath() + "/");

	File file = this.updater.updateReleaseTrainWiki(oldReleaseTrain());

	BDDAssertions.then(file).isNotNull();
	BDDAssertions.then(edgwareWikiEntryContent(file)).doesNotContain("# Edgware.SR7")
			.doesNotContain(
					"Spring Cloud Consul `2.0.1.RELEASE` ([issues](http://www.foo.com/))");
	BDDAssertions
			.then(GitTestUtils.openGitProject(file).log().call().iterator().next()
					.getShortMessage())
			.doesNotContain("Updating project page to release train");
}
 
Example #13
Source File: CompositeStubDownloaderBuilderTests.java    From spring-cloud-contract with Apache License 2.0 6 votes vote down vote up
@Test
public void should_delegate_work_to_other_stub_downloaders() {
	EmptyStubDownloaderBuilder emptyStubDownloaderBuilder = new EmptyStubDownloaderBuilder();
	ImpossibleToBuildStubDownloaderBuilder impossible = new ImpossibleToBuildStubDownloaderBuilder();
	List<StubDownloaderBuilder> builders = Arrays.asList(emptyStubDownloaderBuilder,
			impossible, new SomeStubDownloaderBuilder());
	CompositeStubDownloaderBuilder builder = new CompositeStubDownloaderBuilder(
			builders);
	StubDownloader downloader = builder.build(new StubRunnerOptionsBuilder().build());

	Map.Entry<StubConfiguration, File> entry = downloader
			.downloadAndUnpackStubJar(new StubConfiguration("a:b:v"));

	BDDAssertions.then(entry).isNotNull();
	BDDAssertions.then(emptyStubDownloaderBuilder.downloaderCalled()).isTrue();
	BDDAssertions.then(impossible.called).isTrue();
}
 
Example #14
Source File: PostReleaseActionsTests.java    From spring-cloud-release-tools with Apache License 2.0 6 votes vote down vote up
@Ignore("flakey on circle")
@Test
public void should_update_project_and_run_tests_and_release_train_docs_generation_is_called() {
	this.properties.getMetaRelease().setEnabled(true);
	this.properties.getGit().setReleaseTrainDocsUrl(
			tmpFile("spring-cloud-core-tests/").getAbsolutePath() + "/");
	this.properties.getMaven().setGenerateReleaseTrainDocsCommand("./test.sh");
	PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
			this.updater, this.gradleUpdater, this.commandExecutor, this.properties,
			versionsFetcher, releaserPropertiesUpdater);

	actions.generateReleaseTrainDocumentation(currentGa());

	Model rootPom = PomReader.readPom(new File(this.cloned, "pom.xml"));
	BDDAssertions.then(rootPom.getVersion()).isEqualTo("Finchley.SR1");
	BDDAssertions.then(rootPom.getParent().getVersion()).isEqualTo("2.0.4.RELEASE");
	BDDAssertions.then(sleuthParentPomVersion()).isEqualTo("2.0.4.RELEASE");
	BDDAssertions.then(new File(this.cloned, "generate.log")).exists();
	thenGradleUpdaterWasCalled();
}
 
Example #15
Source File: TraceRequestHttpHeadersFilterTests.java    From spring-cloud-sleuth with Apache License 2.0 6 votes vote down vote up
@Test
public void should_reuse_headers_only_from_input_since_exchange_may_contain_already_ignored_headers() {
	HttpHeadersFilter filter = TraceRequestHttpHeadersFilter.create(this.httpTracing);
	HttpHeaders httpHeaders = new HttpHeaders();
	httpHeaders.set("X-Hello", "World");
	MockServerHttpRequest request = MockServerHttpRequest.post("foo/bar")
			.headers(httpHeaders).build();
	MockServerWebExchange exchange = MockServerWebExchange.builder(request).build();

	HttpHeaders filteredHeaders = filter.filter(requestHeaders(), exchange);

	BDDAssertions.then(filteredHeaders.get("X-B3-TraceId")).isNotEmpty();
	BDDAssertions.then(filteredHeaders.get("X-B3-SpanId")).isNotEmpty();
	BDDAssertions.then(filteredHeaders.get("X-Hello")).isNullOrEmpty();
	BDDAssertions
			.then((Object) exchange
					.getAttribute(TraceRequestHttpHeadersFilter.SPAN_ATTRIBUTE))
			.isNotNull();
}
 
Example #16
Source File: DefaultAdminServiceIT.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@Test
public void testHappyPathSaveConfigurationWithScheduler() {
    // Set Up happy Path
    final JobSchedulerConfiguration jobSchedulerConfiguration =
            DomainTestHelper.createJobSchedulerConfiguration(null, 10L, 10L,
                    JobSchedulerType.PERIOD);
    final JobConfiguration jobConfiguration = DomainTestHelper.createJobConfiguration(jobSchedulerConfiguration);
    jobConfiguration.setJobName(JOB_NAME);
    this.adminService.saveJobConfiguration(jobConfiguration);

    Collection<JobConfiguration> jobConfigurationsByJobName = this.adminService.getJobConfigurationsByJobName(JOB_NAME);
    BDDAssertions.assertThat(jobConfigurationsByJobName).hasSize(1);
    Optional<JobConfiguration> optional = jobConfigurationsByJobName.stream().findFirst();
    BDDAssertions.assertThat(optional).isPresent();
    JobConfiguration jobConfigurationActual = optional.get();
    BDDAssertions.assertThat(jobConfigurationActual.getJobConfigurationId()).isNotNull().isPositive();
    JobSchedulerConfiguration jobSchedulerActual = jobConfigurationActual.getJobSchedulerConfiguration();
    BDDAssertions.assertThat(jobSchedulerActual).isNotNull();

    BDDAssertions.assertThat(jobSchedulerActual.getBeanName())
            .as("Tests if Bean Name got generated Successfully. Ignore the UUID at the end.")
            .isNotNull().startsWith(jobConfiguration.getJobName() + "-" + jobSchedulerConfiguration.getJobSchedulerType() + "-");
}
 
Example #17
Source File: TraceAsyncListenableTaskExecutorTest.java    From spring-cloud-sleuth with Apache License 2.0 6 votes vote down vote up
@Test
public void should_submit_trace_runnable() throws Exception {
	AtomicBoolean executed = new AtomicBoolean();
	Span span = this.tracer.nextSpan().name("foo");

	try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
		this.traceAsyncListenableTaskExecutor
				.submit(aRunnable(this.tracing, executed)).get();
	}
	finally {
		span.finish();
	}

	Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted(() -> {
		BDDAssertions.then(executed.get()).isTrue();
	});
}
 
Example #18
Source File: TraceWebClientBeanPostProcessorTest.java    From spring-cloud-sleuth with Apache License 2.0 6 votes vote down vote up
@Test
void should_add_filter_only_once_to_web_client_via_builder() {
	TraceWebClientBeanPostProcessor processor = new TraceWebClientBeanPostProcessor(
			this.springContext);
	WebClient.Builder builder = WebClient.builder();

	builder = (WebClient.Builder) processor.postProcessAfterInitialization(builder,
			"foo");
	builder = (WebClient.Builder) processor.postProcessAfterInitialization(builder,
			"foo");

	builder.build().mutate().filters(filters -> {
		BDDAssertions.then(filters).hasSize(1);
		BDDAssertions.then(filters.get(0))
				.isInstanceOf(TraceExchangeFilterFunction.class);
	});
}
 
Example #19
Source File: VersionsFromBomFetcherTests.java    From spring-cloud-release-tools with Apache License 2.0 6 votes vote down vote up
@Test
void should_return_false_when_current_version_is_not_present_in_the_bom()
		throws URISyntaxException {
	ProjectVersion projectVersion = new ProjectVersion("spring-cloud-non-existant",
			"1.0.0.RELEASE");
	URI initilizrUri = VersionsFromBomFetcherTests.class
			.getResource("/raw/initializr.yml").toURI();
	ReleaserProperties properties = new ReleaserProperties();
	properties.getGit().setUpdateSpringGuides(true);
	properties.getVersions().setAllVersionsFileUrl(initilizrUri.toString());
	properties.getGit().setReleaseTrainBomUrl(
			file("/projects/spring-cloud-release/").toURI().toString());
	ProjectPomUpdater updater = new ProjectPomUpdater(properties, new ArrayList<>());
	VersionsFetcher versionsFetcher = new VersionsFetcher(properties, updater);

	boolean latestGa = versionsFetcher.isLatestGa(projectVersion);

	BDDAssertions.then(latestGa).isFalse();
}
 
Example #20
Source File: TracingFeignClientTests.java    From spring-cloud-sleuth with Apache License 2.0 6 votes vote down vote up
@Test
public void should_log_error_when_exception_thrown() throws IOException {
	RuntimeException error = new RuntimeException("exception has occurred");
	Span span = this.tracer.nextSpan().name("foo");
	BDDMockito.given(this.client.execute(BDDMockito.any(), BDDMockito.any()))
			.willThrow(error);

	try (Tracer.SpanInScope ws = this.tracer.withSpanInScope(span.start())) {
		this.traceFeignClient.execute(this.request, this.options);
		BDDAssertions.fail("Exception should have been thrown");
	}
	catch (Exception e) {
	}
	finally {
		span.finish();
	}

	then(this.spans.get(0).kind()).isEqualTo(Span.Kind.CLIENT);
	then(this.spans.get(0).error()).isSameAs(error);
}
 
Example #21
Source File: JobExecutionEventRepositoryTest.java    From spring-batch-lightmin with Apache License 2.0 6 votes vote down vote up
@Test
public void testFindAll() {
    final int count = 10;
    for (int i = 0; i < count; i++) {
        final JobExecutionEventInfo jobExecutionEventInfo =
                ServerDomainHelper.createJobExecutionEventInfo();
        getJobExecutionEventRepository().save(jobExecutionEventInfo);
    }
    final int totalCount = this.getJobExecutionEventRepository().getTotalCount();
    final int fetchCount = 5;
    final List<JobExecutionEventInfo> all0to5 = this.getJobExecutionEventRepository().findAll(0, fetchCount);
    final List<JobExecutionEventInfo> all5to10 = this.getJobExecutionEventRepository().findAll(fetchCount, fetchCount);
    BDDAssertions.then(totalCount).isEqualTo(count);
    BDDAssertions.then(all0to5).hasSize(fetchCount);
    BDDAssertions.then(all5to10).hasSize(fetchCount);
    BDDAssertions.then(all5to10).doesNotContain(all0to5.toArray(new JobExecutionEventInfo[5]));
}
 
Example #22
Source File: GrumpyBartenderControllerTest.java    From spring-cloud-contract-samples with Apache License 2.0 5 votes vote down vote up
@Before
public void setupPort() {
	// either one or the other option
	//tag::portfinder[]
	int portFromStubFinder = this.stubFinder.findStubUrl("beer-api-producer-advanced").getPort();
	//end::portfinder[]
	int port2 = this.producerPort;
	BDDAssertions.then(portFromStubFinder).isEqualTo(port2);
	this.controller.port = portFromStubFinder;
}
 
Example #23
Source File: SampleFeignApplicationTests.java    From spring-cloud-sleuth with Apache License 2.0 5 votes vote down vote up
@Test
public void should_not_pass_dash_as_default_service_name(
		CapturedOutput outputCapture) {
	log.info("HELLO");

	BDDAssertions.then(outputCapture.toString()).doesNotContain("INFO [-,,,]");
}
 
Example #24
Source File: PostReleaseActionsTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void should_do_nothing_when_is_not_meta_release_and_update_test_is_called() {
	this.properties.getMetaRelease().setEnabled(false);
	PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
			this.updater, this.gradleUpdater, this.commandExecutor, this.properties,
			versionsFetcher, releaserPropertiesUpdater);

	actions.runUpdatedTests(currentGa());

	BDDAssertions.then(this.cloned).isNull();
	BDDMockito.then(this.gradleUpdater).shouldHaveZeroInteractions();
}
 
Example #25
Source File: PomUpdaterTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@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.versionsFromBom)).isFalse();
}
 
Example #26
Source File: PomUpdaterTests.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
@Test
public void should_not_override_a_pom_when_there_was_no_change_in_the_model()
		throws Exception {
	File beforeProcessing = pom("/projects/project/");
	File afterProcessing = tmpFile("/project/pom.xml");
	ModelWrapper model = this.pomUpdater.updateModel(model("foo"), afterProcessing,
			this.versionsFromBom);

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

	BDDAssertions.then(asString(processedPom)).isEqualTo(asString(beforeProcessing));
}
 
Example #27
Source File: RentACarTests.java    From sc-contract-car-rental with Apache License 2.0 5 votes vote down vote up
@Test
public void should_retrieve_list_of_frauds_from_stub() {
	// 4 - passing test
	ResponseEntity<String> entity = new RestTemplate().exchange(RequestEntity
	.get(URI.create("http://localhost:6545/frauds")).build(), String.class);

	BDDAssertions.then(entity.getStatusCode().value()).isEqualTo(201);
	BDDAssertions.then(entity.getBody()).isEqualTo("[\"marcin\",\"josh\"]");
}
 
Example #28
Source File: SchedulerConfigurationRepositoryTest.java    From spring-batch-lightmin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeleteById() {
    final SchedulerConfiguration schedulerConfiguration = this.createSchedulerConfiguration("deleteIdApp");
    final SchedulerConfiguration schedulerConfiguration2 = this.createSchedulerConfiguration("deleteIdApp");

    final List<SchedulerConfiguration> all = this.getSchedulerConfigurationRepository().findAll();
    BDDAssertions.then(all).hasSize(2);

    this.getSchedulerConfigurationRepository().delete(schedulerConfiguration.getId());

    final List<SchedulerConfiguration> allAfterDeletion = this.getSchedulerConfigurationRepository().findAll();
    BDDAssertions.then(allAfterDeletion).hasSize(1);
    BDDAssertions.then(allAfterDeletion).contains(schedulerConfiguration2);

}
 
Example #29
Source File: MediaTypesTests.java    From spring-cloud-contract with Apache License 2.0 5 votes vote down vote up
@Test
public void APPLICATION_OCTET_STREAM() {
	BDDAssertions.then(MediaTypes.APPLICATION_OCTET_STREAM)
			.isEqualTo("application/octet-stream");
	BDDAssertions.then(new MediaTypes().applicationOctetStream())
			.isEqualTo(MediaTypes.APPLICATION_OCTET_STREAM);
}
 
Example #30
Source File: MessagingHeadersTests.java    From spring-cloud-contract with Apache License 2.0 5 votes vote down vote up
@Test
public void MESSAGING_CONTENT_TYPE() {
	BDDAssertions.then(MessagingHeaders.MESSAGING_CONTENT_TYPE)
			.isEqualTo("contentType");
	BDDAssertions.then(new MessagingHeaders().messagingContentType())
			.isEqualTo(MessagingHeaders.MESSAGING_CONTENT_TYPE);
}