Skip to content

Commit 9ee6eff

Browse files
committed
Upgrade to spring-java-format 0.0.42
With this commit we upgrade the java formatting to the new version and also adhere to the standards applied there. Mainly for Junit5 names of the test classes and visibility of methods. Closes: #138
1 parent 0508774 commit 9ee6eff

12 files changed

+41
-41
lines changed

spring-batch-excel/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
<dependency>
168168
<groupId>io.spring.javaformat</groupId>
169169
<artifactId>spring-javaformat-checkstyle</artifactId>
170-
<version>0.0.35</version>
170+
<version>0.0.42</version>
171171
</dependency>
172172
</dependencies>
173173
<executions>
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,12 +32,12 @@
3232
* @author Marten Deinum
3333
* @since 0.1.0
3434
*/
35-
public class BeanPropertyItemReaderTest {
35+
class BeanPropertyItemReaderTests {
3636

3737
private MockExcelItemReader<Player> reader;
3838

3939
@BeforeEach
40-
public void setup() throws Exception {
40+
void setup() {
4141
ExecutionContext executionContext = new ExecutionContext();
4242

4343
List<String[]> rows = new ArrayList<>();
@@ -60,7 +60,7 @@ public void setup() throws Exception {
6060
}
6161

6262
@Test
63-
public void readandMapPlayers() throws Exception {
63+
void readandMapPlayers() throws Exception {
6464
Player p1 = this.reader.read();
6565
Player p2 = this.reader.read();
6666
Player p3 = this.reader.read();
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,12 +34,12 @@
3434
* @author Marten Deinum
3535
* @since 0.1.0
3636
*/
37-
public class BeanPropertyWithStaticHeaderItemReaderTest {
37+
class BeanPropertyWithStaticHeaderItemReaderTests {
3838

3939
private MockExcelItemReader<Player> reader;
4040

4141
@BeforeEach
42-
public void setup() throws Exception {
42+
void setup() {
4343
ExecutionContext executionContext = new ExecutionContext();
4444

4545
List<String[]> rows = new ArrayList<>();
@@ -64,7 +64,7 @@ public void setup() throws Exception {
6464
}
6565

6666
@Test
67-
public void readandMapPlayers() throws Exception {
67+
void readAndMapPlayers() throws Exception {
6868
Player p1 = this.reader.read();
6969
Player p2 = this.reader.read();
7070
Player p3 = this.reader.read();
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,18 +37,18 @@
3737
* @author Marten Deinum
3838
* @since 0.1.0
3939
*/
40-
public class BeanWrapperRowMapperTest {
40+
class BeanWrapperRowMapperTests {
4141

4242
@Test
43-
public void givenNoNameWhenInitCompleteThenIllegalStateShouldOccur() {
43+
void givenNoNameWhenInitCompleteThenIllegalStateShouldOccur() {
4444
Assertions.assertThatThrownBy(() -> {
4545
BeanWrapperRowMapper<Player> mapper = new BeanWrapperRowMapper<>();
4646
mapper.afterPropertiesSet();
4747
}).isInstanceOf(IllegalStateException.class);
4848
}
4949

5050
@Test
51-
public void givenAValidRowWhenMappingThenAValidPlayerShouldBeConstructed() throws Exception {
51+
void givenAValidRowWhenMappingThenAValidPlayerShouldBeConstructed() throws Exception {
5252
BeanWrapperRowMapper<Player> mapper = new BeanWrapperRowMapper<>();
5353
mapper.setTargetType(Player.class);
5454
mapper.afterPropertiesSet();
@@ -78,7 +78,7 @@ public void givenAValidRowWhenMappingThenAValidPlayerShouldBeConstructed() throw
7878
}
7979

8080
@Test
81-
public void givenAValidRowWhenMappingThenAValidPlayerShouldBeConstructedBasedOnPrototype() throws Exception {
81+
void givenAValidRowWhenMappingThenAValidPlayerShouldBeConstructedBasedOnPrototype() throws Exception {
8282

8383
ApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfig.class);
8484
BeanWrapperRowMapper<Player> mapper = ctx.getBean("playerRowMapper", BeanWrapperRowMapper.class);
+3-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
import static org.assertj.core.api.Assertions.assertThat;
2828

2929

30-
public class PoiItemReaderTypesTest {
30+
class PoiItemReaderTypesTests {
3131

3232
@Test
33-
public void shouldBeAbleToReadMultipleTypes() throws Exception {
33+
void shouldBeAbleToReadMultipleTypes() throws Exception {
3434
var reader = new PoiItemReader<String[]>();
3535
reader.setResource(new ClassPathResource("types.xls"));
3636
reader.setRowMapper(new PassThroughRowMapper());
@@ -49,7 +49,7 @@ public void shouldBeAbleToReadMultipleTypes() throws Exception {
4949
}
5050

5151
@Test
52-
public void shouldBeAbleToReadMultipleTypesWithDatesAsIso() throws Exception {
52+
void shouldBeAbleToReadMultipleTypesWithDatesAsIso() throws Exception {
5353
var reader = new PoiItemReader<String[]>();
5454
reader.setResource(new ClassPathResource("types.xls"));
5555
reader.setRowMapper(new PassThroughRowMapper());
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,14 +35,14 @@
3535
* @author Marten Deinum
3636
* @since 0.1.0
3737
*/
38-
public class PoiItemReaderWithBlankRowSheetTest {
38+
class PoiItemReaderWithBlankRowSheetTests {
3939

4040
private final Log logger = LogFactory.getLog(this.getClass());
4141

4242
private PoiItemReader<String[]> itemReader;
4343

4444
@BeforeEach
45-
public void setup() throws Exception {
45+
void setup() {
4646
this.itemReader = new PoiItemReader<>();
4747
this.itemReader.setResource(new ClassPathResource("blankRow.xlsx"));
4848
this.itemReader.setLinesToSkip(1); // First line is column names
@@ -55,7 +55,7 @@ public void setup() throws Exception {
5555
}
5656

5757
@Test
58-
public void readExcelFileWithBlankRow() throws Exception {
58+
void readExcelFileWithBlankRow() throws Exception {
5959
assertThat(this.itemReader.getNumberOfSheets()).isEqualTo(1);
6060
String[] row;
6161
do {
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,14 +35,14 @@
3535
* @author Marten Deinum
3636
* @since 0.1.0
3737
*/
38-
public class PoiItemReaderWithErrorsTest {
38+
class PoiItemReaderWithErrorsTests {
3939

4040
private final Log logger = LogFactory.getLog(this.getClass());
4141

4242
private PoiItemReader<String[]> itemReader;
4343

4444
@BeforeEach
45-
public void setup() throws Exception {
45+
void setup() {
4646
this.itemReader = new PoiItemReader<>();
4747
this.itemReader.setResource(new ClassPathResource("errors.xlsx"));
4848
this.itemReader.setLinesToSkip(1); // First line is column names
@@ -55,7 +55,7 @@ public void setup() throws Exception {
5555
}
5656

5757
@Test
58-
public void readExcelFileWithBlankRow() throws Exception {
58+
void readExcelFileWithBlankRow() throws Exception {
5959
assertThat(this.itemReader.getNumberOfSheets()).isEqualTo(1);
6060
String[] row;
6161
String[] lastRow = null;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424
* @author Marten Deinum
2525
* @since 0.1.0
2626
*/
27-
class StreamingXlsxItemReaderTest extends AbstractExcelItemReaderTests {
27+
class StreamingXlsxItemReaderTests extends AbstractExcelItemReaderTests {
2828

2929
@Override
3030
protected void configureItemReader(AbstractExcelItemReader<String[]> itemReader) {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424
* @author Marten Deinum
2525
* @since 0.1.0
2626
*/
27-
class StreamingXlsxItemReaderWithBlankLinesTest extends AbstractExcelItemReaderTests {
27+
class StreamingXlsxItemReaderWithBlankLinesTests extends AbstractExcelItemReaderTests {
2828

2929
@Override
3030
protected void configureItemReader(AbstractExcelItemReader<String[]> itemReader) {
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626

2727
import static org.assertj.core.api.Assertions.assertThat;
2828

29-
public class StreamingXlsxTypesTest {
29+
class StreamingXlsxTypesTests {
3030

3131
@Test
32-
public void shouldBeAbleToReadMultipleTypes() throws Exception {
32+
void shouldBeAbleToReadMultipleTypes() throws Exception {
3333
var reader = new StreamingXlsxItemReader<String[]>();
3434
reader.setResource(new ClassPathResource("types.xlsx"));
3535
reader.setRowMapper(new PassThroughRowMapper());
@@ -47,7 +47,7 @@ public void shouldBeAbleToReadMultipleTypes() throws Exception {
4747
}
4848

4949
@Test
50-
public void shouldBeAbleToReadMultipleTypesWithDatesAsIso() throws Exception {
50+
void shouldBeAbleToReadMultipleTypesWithDatesAsIso() throws Exception {
5151
var reader = new StreamingXlsxItemReader<String[]>();
5252
reader.setResource(new ClassPathResource("types.xlsx"));
5353
reader.setRowMapper(new PassThroughRowMapper());
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
3434
* @author Marten Deinum
3535
* @since 0.1.0
3636
*/
37-
public class DefaultRowSetMetaDataTest {
37+
class DefaultRowSetMetaDataTests {
3838

3939
private static final String[] COLUMNS = { "col1", "col2", "col3" };
4040

@@ -45,14 +45,14 @@ public class DefaultRowSetMetaDataTest {
4545
private ColumnNameExtractor columnNameExtractor;
4646

4747
@BeforeEach
48-
public void setup() {
48+
void setup() {
4949
this.sheet = Mockito.mock(Sheet.class);
5050
this.columnNameExtractor = Mockito.mock(ColumnNameExtractor.class);
5151
this.rowSetMetaData = new DefaultRowSetMetaData(this.sheet, this.columnNameExtractor);
5252
}
5353

5454
@Test
55-
public void shouldReturnColumnsFromColumnNameExtractor() {
55+
void shouldReturnColumnsFromColumnNameExtractor() {
5656

5757
given(this.columnNameExtractor.getColumnNames(this.sheet)).willReturn(COLUMNS);
5858

@@ -65,7 +65,7 @@ public void shouldReturnColumnsFromColumnNameExtractor() {
6565
}
6666

6767
@Test
68-
public void shouldGetAndReturnNameOfTheSheet() {
68+
void shouldGetAndReturnNameOfTheSheet() {
6969

7070
given(this.sheet.getName()).willReturn("testing123");
7171

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2021 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,12 +24,12 @@
2424
* @author Marten Deinum
2525
* @since 0.1.0
2626
*/
27-
public class StaticColumnNameExtractorTest {
27+
class StaticColumnNameExtractorTests {
2828

2929
private static final String[] COLUMNS = { "col1", "col2", "col3", "foo", "bar" };
3030

3131
@Test
32-
public void shouldReturnSameHeadersAsPassedIn() {
32+
void shouldReturnSameHeadersAsPassedIn() {
3333

3434
StaticColumnNameExtractor columnNameExtractor = new StaticColumnNameExtractor(COLUMNS);
3535
String[] names = columnNameExtractor.getColumnNames(null);
@@ -39,7 +39,7 @@ public void shouldReturnSameHeadersAsPassedIn() {
3939
}
4040

4141
@Test
42-
public void shouldReturnACopyOfTheHeaders() {
42+
void shouldReturnACopyOfTheHeaders() {
4343

4444
StaticColumnNameExtractor columnNameExtractor = new StaticColumnNameExtractor(COLUMNS);
4545
String[] names = columnNameExtractor.getColumnNames(null);

0 commit comments

Comments
 (0)