Polish testing

Enabled junit5 testing in Maven (upgrade plugin) and added
additional tests to the Streaming and XLSX reader.
This commit is contained in:
Marten Deinum
2021-12-07 09:48:49 +01:00
parent 3f81bdb75c
commit 6471d899b5
7 changed files with 89 additions and 6 deletions

View File

@@ -49,7 +49,7 @@
<!-- Test Dependencies -->
<assertj.version>3.18.1</assertj.version>
<junit.jupiter.version>5.7.2</junit.jupiter.version>
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<log4j.version>2.13.3</log4j.version>
<mockito.version>3.11.0</mockito.version>
</properties>
@@ -183,6 +183,14 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>

View File

@@ -39,9 +39,8 @@ public interface Sheet extends Iterable<String[]>, AutoCloseable {
String getName();
/**
* Get the row as a {@code String[]}. Returns {@code null} if the row doesn't exist. Can throw an {@code UnsupportedOperationException}
* when the underlying implementation doesn't support indexed access to rows.
*
* Get the row as a {@code String[]}. Returns {@code null} if the row doesn't exist. Can throw an
* {@code UnsupportedOperationException} when the underlying implementation doesn't support indexed access to rows.
* @param rowNumber the row number to read.
* @return a {@code String[]} or {@code null}
*/

View File

@@ -16,8 +16,6 @@
package org.springframework.batch.extensions.excel.streaming;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;

View File

@@ -0,0 +1,39 @@
/*
* Copyright 2002-2014 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.extensions.excel.poi;
import org.springframework.batch.extensions.excel.AbstractExcelItemReader;
import org.springframework.batch.extensions.excel.AbstractExcelItemReaderTests;
import org.springframework.core.io.ClassPathResource;
/**
* @author Marten Deinum
* @since 0.1.0
*/
public class PoiItemReaderXlsxWithBlankLinesTests extends AbstractExcelItemReaderTests {
@Override
protected void configureItemReader(AbstractExcelItemReader<String[]> itemReader) {
itemReader.setResource(new ClassPathResource("player_with_blank_lines.xlsx"));
}
@Override
protected AbstractExcelItemReader<String[]> createExcelItemReader() {
return new PoiItemReader<>();
}
}

View File

@@ -0,0 +1,39 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.extensions.excel.streaming;
import org.springframework.batch.extensions.excel.AbstractExcelItemReader;
import org.springframework.batch.extensions.excel.AbstractExcelItemReaderTests;
import org.springframework.core.io.ClassPathResource;
/**
* @author Marten Deinum
* @since 0.1.0
*/
class StreamingXlsxItemReaderWithBlankLinesTest extends AbstractExcelItemReaderTests {
@Override
protected void configureItemReader(AbstractExcelItemReader<String[]> itemReader) {
itemReader.setResource(new ClassPathResource("player_with_blank_lines.xlsx"));
}
@Override
protected AbstractExcelItemReader<String[]> createExcelItemReader() {
return new StreamingXlsxItemReader<>();
}
}