Refine contribution #3962

- Fix failing tests
- Update year in license headers

Related to #3838
This commit is contained in:
Mahmoud Ben Hassine
2021-08-10 17:50:41 +02:00
parent 24422b5163
commit 7bbbd4f667
14 changed files with 44 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2020 the original author or authors.
* Copyright 2013-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2008-2019 the original author or authors.
* Copyright 2008-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2019 the original author or authors.
* Copyright 2006-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2020 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020 the original author or authors.
* Copyright 2020-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020 the original author or authors.
* Copyright 2020-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -85,12 +85,9 @@ public class RemoteChunkingManagerStepBuilderTest {
@Test
public void inputChannelMustNotBeNull() {
// given
final RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
.inputChannel(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step").inputChannel(null).build());
// then
assertThat(expectedException).hasMessage("inputChannel must not be null");
@@ -98,12 +95,9 @@ public class RemoteChunkingManagerStepBuilderTest {
@Test
public void outputChannelMustNotBeNull() {
// given
final RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
.outputChannel(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step").outputChannel(null).build());
// then
assertThat(expectedException).hasMessage("outputChannel must not be null");
@@ -111,12 +105,9 @@ public class RemoteChunkingManagerStepBuilderTest {
@Test
public void messagingTemplateMustNotBeNull() {
// given
final RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
.messagingTemplate(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step").messagingTemplate(null).build());
// then
assertThat(expectedException).hasMessage("messagingTemplate must not be null");
@@ -124,12 +115,9 @@ public class RemoteChunkingManagerStepBuilderTest {
@Test
public void maxWaitTimeoutsMustBeGreaterThanZero() {
// given
final RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
.maxWaitTimeouts(-1);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step").maxWaitTimeouts(-1).build());
// then
assertThat(expectedException).hasMessage("maxWaitTimeouts must be greater than zero");
@@ -137,12 +125,9 @@ public class RemoteChunkingManagerStepBuilderTest {
@Test
public void throttleLimitMustNotBeGreaterThanZero() {
// given
final RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
.throttleLimit(-1L);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step").throttleLimit(-1L).build());
// then
assertThat(expectedException).hasMessage("throttleLimit must be greater than zero");
@@ -177,17 +162,16 @@ public class RemoteChunkingManagerStepBuilderTest {
@Test
public void testUnsupportedOperationExceptionWhenSpecifyingAnItemWriter() {
// given
final RemoteChunkingManagerStepBuilder<String, String> builder = new RemoteChunkingManagerStepBuilder<String, String>("step")
.reader(this.itemReader)
.writer(items -> { })
.repository(this.jobRepository)
.transactionManager(this.transactionManager)
.inputChannel(this.inputChannel)
.outputChannel(this.outputChannel);
// when
final Exception expectedException = Assert.assertThrows(UnsupportedOperationException.class, builder::build);
final Exception expectedException = Assert.assertThrows(UnsupportedOperationException.class,
() -> new RemoteChunkingManagerStepBuilder<String, String>("step")
.reader(this.itemReader)
.writer(items -> { })
.repository(this.jobRepository)
.transactionManager(this.transactionManager)
.inputChannel(this.inputChannel)
.outputChannel(this.outputChannel)
.build());
// then
assertThat(expectedException).hasMessage("When configuring a manager " +

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,12 +36,9 @@ public class RemoteChunkingWorkerBuilderTest {
@Test
public void itemProcessorMustNotBeNull() {
// given
final RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemProcessor(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingWorkerBuilder<String, String>().itemProcessor(null).build());
// then
assertThat(expectedException).hasMessage("itemProcessor must not be null");
@@ -49,12 +46,9 @@ public class RemoteChunkingWorkerBuilderTest {
@Test
public void itemWriterMustNotBeNull() {
// given
final RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.itemWriter(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingWorkerBuilder<String, String>().itemWriter(null).build());
// then
assertThat(expectedException).hasMessage("itemWriter must not be null");
@@ -62,12 +56,9 @@ public class RemoteChunkingWorkerBuilderTest {
@Test
public void inputChannelMustNotBeNull() {
// given
final RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.inputChannel(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingWorkerBuilder<String, String>().inputChannel(null).build());
// then
assertThat(expectedException).hasMessage("inputChannel must not be null");
@@ -75,12 +66,9 @@ public class RemoteChunkingWorkerBuilderTest {
@Test
public void outputChannelMustNotBeNull() {
// given
final RemoteChunkingWorkerBuilder<String, String> builder = new RemoteChunkingWorkerBuilder<String, String>()
.outputChannel(null);
// when
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class, builder::build);
final Exception expectedException = Assert.assertThrows(IllegalArgumentException.class,
() -> new RemoteChunkingWorkerBuilder<String, String>().outputChannel(null).build());
// then
assertThat(expectedException).hasMessage("outputChannel must not be null");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,8 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.test.context.MergedContextConfiguration;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* @author Mahmoud Ben Hassine
@@ -57,6 +58,6 @@ public class BatchTestContextCustomizerTest {
() -> this.contextCustomizer.customizeContext(context, mergedConfig));
// then
assertEquals("The bean factory must be an instance of BeanDefinitionRegistry", expectedException.getMessage());
assertThat(expectedException.getMessage(), containsString("The bean factory must be an instance of BeanDefinitionRegistry"));
}
}