Commit Graph

1671 Commits

Author SHA1 Message Date
Gary Gregory b0c544e911 Update tests from Hamcrest 2.1 to 2.2. 2019-12-12 11:02:35 -05:00
Gary Gregory 33bb4f0e01 Update tests from H2 1.4.199 to 1.4.200. 2019-12-12 10:59:50 -05:00
Gary Gregory 18644c88d4 Javadoc: Replace <code></code> HTML tags with Javadoc {@code} notation. 2019-12-10 00:21:22 -05:00
Gary Gregory 53be2154bf [CSV-247] A single empty header is allowed when not allowing empty
column headers. #47.</action>
2019-10-07 13:09:03 -04:00
Alex Herbert 059649167c CSV-247: CSVParser to check an empty header before checking duplicates. (#47)
This updates the issues test for CSV-247 and adds tests to the
CSVParserTest.
2019-10-07 13:06:11 -04:00
aherbert dcc44cdcd1 Rename typo in issues file names from cvs to csv. 2019-10-07 13:01:51 +01:00
Gary Gregory 4829ec961e [CSV-247] A single empty header is allowed when not allowing empty
column headers.

Add test case.
2019-10-06 17:36:26 -04:00
Gary Gregory c18595d1c4 No need for all the whitespace. 2019-10-06 17:24:24 -04:00
Gary Gregory af28635557 Clean ups. 2019-10-06 14:40:24 -04:00
Gary Gregory 722960af68 [CSV-252] Upgrade test framework to JUnit 5 Jupiter #49, #50. 2019-10-06 08:17:12 -04:00
Allon Murienik 485929e626 CSV-252: Clean up exception handling (#50)
* CSV-252: Clean up assertions using assertThrows

As a followup to commit e2f0a4d8a8 that
introduced JUnit Jupiter to the project, this patch leverages the new
Assertions#assertThrows method to clean up tests for expected
exceptions.

Instead of the somewhat clunky structure common in JUnit 4 tests:

```
try {
    someMethod();
    fail("SomeException should be thrown");
} catch (SomeException e) {
    // Expected...

    // Possibly some assertion on e
}
```

JUnit Jupiter allows the following elegant syntax:

```
SomeException e = assertThrows(SomeException.class, () -> someMethod());
// Possibly some assertions on e
```

* CSV-252: Remove redundant throws clauses from tests
2019-10-06 08:16:08 -04:00
Gary Gregory 0300569b81 [CSV-252] JUnit 5 Jupiter #49. 2019-10-05 15:04:39 -04:00
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 6aa1756750 [CSV-249] ArrayIndexOutOfBoundsException when trying to read record
written by CSVPrinter using CSVParser with same format.

Add passing test.
2019-09-28 13:09:11 -04:00
Gary Gregory a23b784c1c [CSV-249] ArrayIndexOutOfBoundsException when trying to read record
written by CSVPrinter using CSVParser with same format.

Add passing test.
2019-09-28 13:08:56 -04:00
Gary Gregory dfd58d8a94 More lambdas, less boilerplate. 2019-09-12 20:58:07 -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
Gary Gregory 1a7c614082 Sort members. 2019-09-04 10:32:51 -04:00
Gary Gregory f62fd132d0 [CSV-236] Allow duplicate headers in CSV File.
Add test.
2019-09-04 09:54:49 -04:00
Gary Gregory c203896177 Sort members. 2019-09-04 09:54:03 -04:00
Sebb d9745feba3 git-wip-us => gitbox 2019-08-16 18:34:19 +01:00
Gary Gregory 6f174399b6 Use test scope for supercsv #48. 2019-08-14 11:39:22 -07:00
sullis 363dd18906 use [test] scope for supercsv (#48) 2019-08-14 11:38:10 -07:00
Gary Gregory f740643e53 Drop Oracle JDK 8 since it is not supported anymore. 2019-08-14 11:37:52 -07:00
Gary Gregory 876c4fc865 Fix the site's source repository link. 2019-07-21 16:50:43 -04:00
Gary Gregory 909161ce72 Replace SVN with GitBox URL. 2019-07-07 10:31:08 -04:00
Gary Gregory 31fb58d37b Use HTTPS to access Apache resources. 2019-07-06 20:59:49 -04: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
Sebb 7754cd4c84 CSV-135 - Char escape doesn't work properly with quoting 2019-06-16 21:24:26 +01:00
Sebb f7c2ca2166 CSV-135 - Char escape doesn't work
Ensure escape chars are escaped when using quote mode
2019-06-16 21:16:17 +01:00
Sebb 53fa8ad356 Show quote mode if not null 2019-06-16 17:07:02 +01:00
Sebb c025d73d31 CSV235 - WRONG Implementation for RFC4180
Show that implementation is actually correct
2019-06-16 13:44:04 +01:00
Sebb bc64fb569c CSV-243 CSVFormat withTrim() and withIgnoreSurroundingSpaces()
need better docs
2019-06-16 12:51:00 +01:00
Gary Gregory 8b6cfb21bb [CSV-245] Post 1.7 release fixes. 2019-06-15 13:55:50 -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
Sebb 42b9fdb099 CSV-244 Test case failures following CSVFormat#equals() update 2019-06-15 14:29:30 +01:00
Gary Gregory 0279beaba0 Javadoc. 2019-06-14 20:24:59 -04:00
Gary Gregory 2a6bcc1f73 Fix odd local variable names. 2019-06-14 20:24:15 -04:00
Gary Gregory 50d727fc64 End descriptions with a period. 2019-06-14 20:19:22 -04:00
Sebb dd5de38072 CSV-243 CSVFormat withTrim() and withIgnoreSurroundingSpaces()
need better docs
2019-06-14 22:56:30 +01:00
Sebb ed8602db29 Typo 2019-06-14 22:52:41 +01:00
Sebb 7ddc71c20a Wrong method name 2019-06-14 17:22:32 +01:00
Sebb c683594f59 CSV-242 CSVFormat equals() and hashCode() don't use all fields
Fix hashCode()
2019-06-14 17:21:33 +01:00
Sebb 46c84341e6 Document change to test behaviour 2019-06-14 17:14:54 +01:00
Sebb 605bc0154f CSV-242 CSVFormat equals() and hash() don't use all fields
Fix equals()
TODO fix hash()
2019-06-14 16:32:45 +01:00
Gary Gregory 3718ec3a8e Name "Apache Commons" in page title. 2019-06-06 10:02:39 -04:00