Commit Graph

196 Commits

Author SHA1 Message Date
Allon Murienik e2f0a4d8a8 CSV-252: Migration to JUnit Jupiter (#49)
* CSV-252 Stop using junit.framework.TestCase

junit.framework.TestCase is a class from JUnit 3, and while it is not
officially deprecated, it's discouraged to use it.

This patch removes the single use of
junit.framework.TestCase#assertNull, and replaces it with the
standard, recommended, org.junit.Assert#assertNull.

* CSV-252 Standardize org.junit.Assert imports

Code in the project uses org.junit.Assert's methods in two ways:
1. By statically importing them
2. By importing the class and using its methods

Option 1 seems to be the de-facto standard, with just a handful of
cases using Option 2.
This patch standardizes these cases to also use static imports thus
making the code look more uniform, and easier to maintain.

* CSV-252 Upgrade Mockito to 3.1.0

Upgrade the Mockito dependency to the latest available version, 3.1.0,
in order to facilitate an upgrade to JUnit Jupiter.

* CSV-252 JUnit Jupiter upgrade

This patch upgrades the project's testing framework from JUnit 4.12
to the modern JUnit Jupiter 5.5.4.

Since JUnit 5 Jupiter is not backwards compatible to JUnit 4.x (or
even JUnit Vintage), this patch is a bit large, even though a lot of
the changes are merely cosmetic (such as changing the argument order,
see details below). In order to make the reviewer's task as easy as
possible, this PR does not presume to use JUnit Jupiter's best
practices and all its new functionality, but only to migrate the
existing tests with as little change as possible. Following patches
may want to improve the tests by using some of JUnit Jupiter's new
features.

This patch includes the following changes:

1. Maven dependency changes:
 a. junit:junit was replaced with org.junit.jupiter:junit-jupiter.
 b. org.hamcrest:hamcrest was introduced as an explicit dependency,
    since the project uses Hamcrest, and JUnit Jupiter does not
    bundle Hamcrest, unlike JUnit 4.x.

2. Annotations:
 a. org.junit.jupiter.api.Test was used as a drop in replacement for
    org.juit.Test without arguments. See 3.ii. for handling of @Test
    annotations with an "expected" argument.
 b. org.junit.jupiter.api.BeforeEach was used as an drop in
    replacement for org.junit.Before.
 c. org.junit.jupiter.api.BeforeAll was used as an drop in
    replacement for org.junit.BeforeClass.
 d. org.junit.jupiter.api.Disabled was used as a drop in replacement
    for org.junit.Ignore.

3. Assertions:
 a. org.junit.jupiter.api.Assertions' methods were used as drop in
    replacements for org.junit.Assert's methods with the same name in
    the simple case of an assertion without a message. In the case of
    an assertion with a message, org.junit.jupiter.api.Assertions'
    methods were used, but the argument order was changed - Assert's
    methods take the message as the first argument, while Assertions'
    methods take the message as the last argument.
 b. org.junit.jupiter.api.Assertions#assertThrows was used to assert
    that a specific exception was throws instead of an org.junit.Test
    annotation with an expected argument. This technique has a couple
    of side bonuses. First, it makes the tests slightly stricter, as
    now they can assert the exception was thrown from a specific line
    and prevent false positives where the test's "set-up" code
    accidentally threw that exception. Second, it clarifies that some
    of the test code is unreachable (as a previous line already
    throws an exception), and can safely be removed in order to clean
    up the test. The throws clauses of these methods were cleaned up
    from exceptions that can no longer be thrown in order to avoid
    compilation warnings.
 c. org.hamcrest.MatcherAssert#assertThat was used as a drop in
    replacement for org.junit.Assert#assertThat.

4. Specific Changes:
 a. CSVFileParserTest was rewritten with JUnit Jupiter's
    org.junit.jupiter.api.ParameterizedTest. Unlike JUnit 4's
    org.junit.runners.Parameterized, it cannot be used to inject
    arguments to a test's construct, and so the test can't be
    stateful. Instead, it was rewritten so every test receives the
    file as a parameter, and opens a reader on it itself. As a side
    bonus, this design makes it easier to close the reader and avoid
    leaving open file descriptors like the original test did.
2019-10-05 14:59:58 -04:00
Gary Gregory 2f1ac70815 Update properties for the next release. 2019-09-09 20:41:53 -04:00
Gary Gregory 09f4bed945 Revert change to commons.componentid. 2019-09-09 20:41:07 -04:00
Gary Gregory d4ceb0a125 Point to the Java 8 Javadocs. 2019-09-09 15:26:04 -04:00
Gary Gregory 1141e9b2be Set component ID to commons-csv. 2019-09-09 15:20:36 -04:00
Sebb d9745feba3 git-wip-us => gitbox 2019-08-16 18:34:19 +01:00
sullis 363dd18906 use [test] scope for supercsv (#48) 2019-08-14 11:38:10 -07:00
Gary Gregory d06d048063 Use HTTPS to access Apache resources. 2019-07-06 20:41:48 -04:00
Gary Gregory 7e669566df Use HTTPS links to Apache. 2019-07-04 10:00:21 -04:00
Alex Herbert 03550ab565 Post release fixes (#44)
* Fix checkstyle: remove tabs
* Fix checkstyle: Split long line
* Fix checkstyle: exclude pom.properties
* Update findbugs to allow deliberate fall-through
* Fix pmd: Remove ternary operator returning false
* Fix pmd: Remove implicit final
* Fix pmd: Ignore TooManyStaticImports.

This requires adding the default ruleset and then modifying with
suppressions.

* Add tests to cover use of the IOUtils class.

Requires the CSVFormat to have no quote or escape character, and the
formatted value to be a java.io.Reader.

* Clean-up findbugs exclude filter.
* Removed unused import
* Updated test comments for print tests targeting IOUtils.
* Fix checkstyle: Suppress line length warning in CSVParser.
2019-06-15 13:52:44 -04:00
Gary Gregory 7d100bf05b Bump to next development version 2019-06-05 08:29:56 -04:00
Gary Gregory a227a1e2fb Update POM version numbers for Apache Commons CSV release 1.7 2019-06-01 20:09:24 -04:00
Gary Gregory 33bfaeef8a Prepare for release 1.7.
- There is no longer site archives. We forgot to do it for 1.6 but the
sites are still in svn.
- The Javadoc archives now point to the same place GitHub uses:
javadoc.io
- Checkstyle fixes.
2019-06-01 17:20:20 -04:00
Gary Gregory d346048552 Fix warning reported by 'mvn versions:display-plugin-updates' 2019-05-20 08:27:36 -04:00
Gary Gregory 5722332c9a Fix warning reported by 'mvn versions:display-plugin-updates' 2019-05-20 08:25:08 -04:00
Gary Gregory 3fa020303b javancss-maven-plugin blows up, drop it. 2019-05-20 08:21:43 -04:00
Gary Gregory 734e7a910f Update maven-pmd-plugin from 3.11.0 to 3.12.0. 2019-04-23 16:02:26 -04:00
Gary Gregory 01e7e384ac Update tests from Apache Commmons Lang 3.8.1 to 3.9. 2019-04-14 20:26:30 -04:00
Gary Gregory 7c1a3fab64 Update Apache Commons Parent from 47 to 48. 2019-03-25 12:00:31 -04:00
Gary Gregory 4e438b9f81 Update tests from H2 1.4.198 to 1.4.199. 2019-03-13 12:08:41 -04:00
Gary Gregory 1305ef1029 [CSV-237] Update to Java 8. 2019-02-24 10:04:45 -05:00
Gary Gregory f69a78972f Inherit plugin version from commons-parent. 2019-02-23 09:39:33 -05:00
Gary Gregory 293fa4dec3 Update Maven PMD Plugin from 3.8 to 3.11.0. 2019-02-23 09:38:00 -05:00
Gary Gregory 17be5351cb Update Maven Checktyle Plugin from 2.7 to 3.0.0. 2019-02-23 09:33:17 -05:00
Gary Gregory 887eb97d1e Next release is 1.7. 2019-02-23 09:24:36 -05:00
Gary Gregory 2d919276bf Oops, I did not mean to update to Java 7 yet. 2019-02-23 09:24:01 -05:00
Gary Gregory 4fd494d590 Update tests from H2 1.4.197 to 1.4.198. 2019-02-23 09:21:19 -05:00
Gary Gregory bf2c2f7ad6 Update tests from H2 1.4.196 to 1.4.197. 2019-02-23 08:20:12 -05:00
Gary Gregory c7a9b1707f Fix Travis-CI: Make this build like Commons Text. The plugin
checksum-maven-plugin blows up the Travis-CI build and we have our own
build and release plugins that do the same thing.
2018-10-20 10:19:37 -06:00
Gary Gregory 13c539a50d Update tests from Apache Commons Lang from 3.8 to 3.8.1. 2018-09-27 09:53:33 -06:00
Benedikt Ritter 70187c3171
Bump to next development version 2018-09-25 15:11:34 +02:00
Benedikt Ritter 2596fdeebc
Update version numbers for commons-csv release 1.6 2018-09-19 13:45:44 +02:00
Benedikt Ritter 11b557ee48
Update NOTICE.txt 2018-09-19 11:54:57 +02:00
Benedikt Ritter 79adf78d23
Adopt commons-jcs way of generating SHA-512 checksums 2018-09-19 10:51:35 +02:00
Benedikt Ritter af261c8fbf
Add temporary fix for COMMONSSITE-125 2018-09-19 10:38:30 +02:00
Benedikt Ritter 62515c52ec
Update to latest commons-parent 2018-09-19 10:32:55 +02:00
Gary Gregory 47dbc8fd1e Update tests from Apache Commons Lang 3.7 to 3.8. 2018-08-21 09:07:58 -06:00
pascalschumacher f3f48be1d0 Update to commons-parent version 43 2018-01-07 11:42:26 +01:00
ggregory e76c4d809c Update tests from Apache Commons Lang 3.6 to 3.7. 2017-12-10 16:27:09 -07:00
Gary Gregory 1521cc285d Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/commons-csv.git 2017-10-20 17:27:45 -06:00
Gary Gregory 0e39fe3bed Update tests from Apache Commons IO 2.5 to 2.6. 2017-10-20 10:04:51 -06:00
Pascal Schumacher d20e5abaa3 travis: add java 9 to build (closes #23)
pom.xml: add java 9 profile and override jacoco version to make build pass
2017-10-12 22:41:08 +02:00
Gary Gregory 27cdc55728 findbugs-maven-plugin 3.0.4 -> 3.0.5. 2017-10-09 13:56:34 -06:00
Gary Gregory b4a084ed48 [CSV-217] Add autoFlush option for CsvPrinter. Use current version of
Mockito.
2017-10-09 13:26:57 -06:00
Gary Gregory 5ca0f91ff6 Next version will be 1.6 due to new auto-flush feature just added. 2017-10-09 13:25:13 -06:00
Gary Gregory 9c20341469 Next version will be 1.6 due to new auto-flush feature just added. 2017-10-09 13:23:46 -06:00
Korolyov Alexei 7e47152791 [CSV-217] Add autoFlush option for CsvPrinter. Applying modified patch
This closes #24.
2017-10-09 13:22:53 -06:00
Bruno P. Kinoshita 3e3c236562 Bump to next development version 2017-09-03 17:26:46 +12:00
Bruno P. Kinoshita dfcd0793c0 Update version for Commons Csv release 1.5 2017-08-27 10:51:00 +12:00
Bruno P. Kinoshita 9d2b6d75c8 Add missing CSV test files to RAT report exclusions list 2017-08-27 10:31:03 +12:00