Skip to content

Commit 75ca861

Browse files
committed
fix: sonarcloud code smell public test method
1 parent 2fd681c commit 75ca861

21 files changed

Lines changed: 76 additions & 76 deletions

src/test/java/org/apache/commons/csv/TokenMatchersTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,49 +27,49 @@
2727
import org.junit.jupiter.api.BeforeEach;
2828
import org.junit.jupiter.api.Test;
2929

30-
public class TokenMatchersTest {
30+
class TokenMatchersTest {
3131

3232
private Token token;
3333

3434
@BeforeEach
35-
public void setUp() {
35+
void setUp() {
3636
token = new Token();
3737
token.type = Token.Type.TOKEN;
3838
token.isReady = true;
3939
token.content.append("content");
4040
}
4141

4242
@Test
43-
public void testHasContent() {
43+
void testHasContent() {
4444
assertFalse(hasContent("This is not the token's content").matches(token));
4545
assertTrue(hasContent("content").matches(token));
4646
}
4747

4848
@Test
49-
public void testHasType() {
49+
void testHasType() {
5050
assertFalse(hasType(Token.Type.COMMENT).matches(token));
5151
assertFalse(hasType(Token.Type.EOF).matches(token));
5252
assertFalse(hasType(Token.Type.EORECORD).matches(token));
5353
assertTrue(hasType(Token.Type.TOKEN).matches(token));
5454
}
5555

5656
@Test
57-
public void testIsReady() {
57+
void testIsReady() {
5858
assertTrue(isReady().matches(token));
5959
token.isReady = false;
6060
assertFalse(isReady().matches(token));
6161
}
6262

6363
@Test
64-
public void testMatches() {
64+
void testMatches() {
6565
assertTrue(matches(Token.Type.TOKEN, "content").matches(token));
6666
assertFalse(matches(Token.Type.EOF, "content").matches(token));
6767
assertFalse(matches(Token.Type.TOKEN, "not the content").matches(token));
6868
assertFalse(matches(Token.Type.EORECORD, "not the content").matches(token));
6969
}
7070

7171
@Test
72-
public void testToString() {
72+
void testToString() {
7373
assertTrue(matches(Token.Type.TOKEN, "content").matches(token));
7474
assertEquals("TOKEN", token.type.name());
7575
assertEquals("TOKEN [content]", token.toString());

src/test/java/org/apache/commons/csv/issues/JiraCsv148Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import org.apache.commons.csv.QuoteMode;
2323
import org.junit.jupiter.api.Test;
2424

25-
public class JiraCsv148Test {
25+
class JiraCsv148Test {
2626

2727
@Test
28-
public void testWithIgnoreSurroundingSpacesEmpty() {
28+
void testWithIgnoreSurroundingSpacesEmpty() {
2929
// @formatter:off
3030
final CSVFormat format = CSVFormat.DEFAULT.builder()
3131
.setQuoteMode(QuoteMode.ALL)
@@ -47,7 +47,7 @@ public void testWithIgnoreSurroundingSpacesEmpty() {
4747
* you can remove the leading and trailing spaces, tabs and other symbols.
4848
*/
4949
@Test
50-
public void testWithTrimEmpty() {
50+
void testWithTrimEmpty() {
5151
// @formatter:off
5252
final CSVFormat format = CSVFormat.DEFAULT.builder()
5353
.setQuoteMode(QuoteMode.ALL)

src/test/java/org/apache/commons/csv/issues/JiraCsv149Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
import org.apache.commons.csv.CSVRecord;
2828
import org.junit.jupiter.api.Test;
2929

30-
public class JiraCsv149Test {
30+
class JiraCsv149Test {
3131

3232
private static final String CR_LF = "\r\n";
3333

3434
@Test
35-
public void testJiraCsv149EndWithEOL() throws IOException {
35+
void testJiraCsv149EndWithEOL() throws IOException {
3636
testJiraCsv149EndWithEolAtEof(true);
3737
}
3838

@@ -59,7 +59,7 @@ private void testJiraCsv149EndWithEolAtEof(final boolean eolAtEof) throws IOExce
5959
}
6060

6161
@Test
62-
public void testJiraCsv149EndWithoutEOL() throws IOException {
62+
void testJiraCsv149EndWithoutEOL() throws IOException {
6363
testJiraCsv149EndWithEolAtEof(false);
6464
}
6565
}

src/test/java/org/apache/commons/csv/issues/JiraCsv154Test.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
import org.apache.commons.csv.CSVPrinter;
2525
import org.junit.jupiter.api.Test;
2626

27-
public class JiraCsv154Test {
27+
class JiraCsv154Test {
2828

2929
@Test
30-
public void testJiraCsv154_withCommentMarker() throws IOException {
30+
void testJiraCsv154_withCommentMarker() throws IOException {
3131
final String comment = "This is a header comment";
3232
// @formatter:off
3333
final CSVFormat format = CSVFormat.EXCEL.builder()
@@ -46,7 +46,7 @@ public void testJiraCsv154_withCommentMarker() throws IOException {
4646
}
4747

4848
@Test
49-
public void testJiraCsv154_withHeaderComments() throws IOException {
49+
void testJiraCsv154_withHeaderComments() throws IOException {
5050
final String comment = "This is a header comment";
5151
// @formatter:off
5252
final CSVFormat format = CSVFormat.EXCEL.builder()

src/test/java/org/apache/commons/csv/issues/JiraCsv167Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
import org.apache.commons.csv.QuoteMode;
3030
import org.junit.jupiter.api.Test;
3131

32-
public class JiraCsv167Test {
32+
class JiraCsv167Test {
3333

3434
private Reader getTestReader() {
3535
return new InputStreamReader(
3636
ClassLoader.getSystemClassLoader().getResourceAsStream("org/apache/commons/csv/csv-167/sample1.csv"));
3737
}
3838

3939
@Test
40-
public void testParse() throws IOException {
40+
void testParse() throws IOException {
4141
int totcomment = 0;
4242
int totrecs = 0;
4343
try (final Reader reader = getTestReader(); final BufferedReader br = new BufferedReader(reader)) {

src/test/java/org/apache/commons/csv/issues/JiraCsv198Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.apache.commons.csv.CSVParser;
2929
import org.junit.jupiter.api.Test;
3030

31-
public class JiraCsv198Test {
31+
class JiraCsv198Test {
3232

3333
// @formatter:off
3434
private static final CSVFormat CSV_FORMAT = CSVFormat.EXCEL.builder()
@@ -39,7 +39,7 @@ public class JiraCsv198Test {
3939
// @formatter:on
4040

4141
@Test
42-
public void test() throws UnsupportedEncodingException, IOException {
42+
void test() throws UnsupportedEncodingException, IOException {
4343
final InputStream pointsOfReference = getClass().getResourceAsStream("/org/apache/commons/csv/CSV-198/optd_por_public.csv");
4444
assertNotNull(pointsOfReference);
4545
try (@SuppressWarnings("resource")

src/test/java/org/apache/commons/csv/issues/JiraCsv203Test.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
* JIRA: <a href="https://issues.apache.org/jira/browse/CSV-203">withNullString value is printed without quotes when
2828
* QuoteMode.ALL is specified</a>
2929
*/
30-
public class JiraCsv203Test {
30+
class JiraCsv203Test {
3131

3232
@Test
33-
public void testQuoteModeAll() throws Exception {
33+
void testQuoteModeAll() throws Exception {
3434
// @formatter:off
3535
final CSVFormat format = CSVFormat.EXCEL.builder()
3636
.setNullString("N/A")
@@ -46,7 +46,7 @@ public void testQuoteModeAll() throws Exception {
4646
}
4747

4848
@Test
49-
public void testQuoteModeAllNonNull() throws Exception {
49+
void testQuoteModeAllNonNull() throws Exception {
5050
// @formatter:off
5151
final CSVFormat format = CSVFormat.EXCEL.builder()
5252
.setNullString("N/A")
@@ -62,7 +62,7 @@ public void testQuoteModeAllNonNull() throws Exception {
6262
}
6363

6464
@Test
65-
public void testQuoteModeMinimal() throws Exception {
65+
void testQuoteModeMinimal() throws Exception {
6666
// @formatter:off
6767
final CSVFormat format = CSVFormat.EXCEL.builder()
6868
.setNullString("N/A")
@@ -78,7 +78,7 @@ public void testQuoteModeMinimal() throws Exception {
7878
}
7979

8080
@Test
81-
public void testQuoteModeNonNumeric() throws Exception {
81+
void testQuoteModeNonNumeric() throws Exception {
8282
// @formatter:off
8383
final CSVFormat format = CSVFormat.EXCEL.builder()
8484
.setNullString("N/A")
@@ -94,7 +94,7 @@ public void testQuoteModeNonNumeric() throws Exception {
9494
}
9595

9696
@Test
97-
public void testWithEmptyValues() throws Exception {
97+
void testWithEmptyValues() throws Exception {
9898
// @formatter:off
9999
final CSVFormat format = CSVFormat.EXCEL.builder()
100100
.setNullString("N/A")
@@ -111,7 +111,7 @@ public void testWithEmptyValues() throws Exception {
111111
}
112112

113113
@Test
114-
public void testWithoutNullString() throws Exception {
114+
void testWithoutNullString() throws Exception {
115115
// @formatter:off
116116
final CSVFormat format = CSVFormat.EXCEL.builder()
117117
//.setNullString("N/A")
@@ -127,7 +127,7 @@ public void testWithoutNullString() throws Exception {
127127
}
128128

129129
@Test
130-
public void testWithoutQuoteMode() throws Exception {
130+
void testWithoutQuoteMode() throws Exception {
131131
// @formatter:off
132132
final CSVFormat format = CSVFormat.EXCEL.builder()
133133
.setNullString("N/A")

src/test/java/org/apache/commons/csv/issues/JiraCsv206Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import org.apache.commons.csv.CSVRecord;
2929
import org.junit.jupiter.api.Test;
3030

31-
public class JiraCsv206Test {
31+
class JiraCsv206Test {
3232

3333
@Test
34-
public void testJiraCsv206MultipleCharacterDelimiter() throws IOException {
34+
void testJiraCsv206MultipleCharacterDelimiter() throws IOException {
3535
// Read with multiple character delimiter
3636
final String source = "FirstName[|]LastName[|]Address\r\nJohn[|]Smith[|]123 Main St.";
3737
final StringReader reader = new StringReader(source);

src/test/java/org/apache/commons/csv/issues/JiraCsv211Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import org.apache.commons.csv.CSVParser;
2626
import org.junit.jupiter.api.Test;
2727

28-
public class JiraCsv211Test {
28+
class JiraCsv211Test {
2929

3030
@Test
31-
public void testJiraCsv211Format() throws IOException {
31+
void testJiraCsv211Format() throws IOException {
3232
// @formatter:off
3333
final CSVFormat printFormat = CSVFormat.DEFAULT.builder()
3434
.setDelimiter('\t')

src/test/java/org/apache/commons/csv/issues/JiraCsv213Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* you want, you need to open a new CSVParser.
3737
* </p>
3838
*/
39-
public class JiraCsv213Test {
39+
class JiraCsv213Test {
4040

4141
private void createEndChannel(final File csvFile) {
4242
// @formatter:off
@@ -62,7 +62,7 @@ private void createEndChannel(final File csvFile) {
6262
}
6363

6464
@Test
65-
public void test() {
65+
void test() {
6666
createEndChannel(new File("src/test/resources/org/apache/commons/csv/CSV-213/999751170.patch.csv"));
6767
}
6868
}

0 commit comments

Comments
 (0)