Skip to content

Commit dca481f

Browse files
committed
Sort members in AB order.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1458639 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8f0d0e0 commit dca481f

1 file changed

Lines changed: 78 additions & 78 deletions

File tree

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

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -45,123 +45,120 @@ public void setUp() throws Exception {
4545
}
4646

4747
@Test
48-
public void testDelimiter() {
49-
assertEquals('?', builder.withDelimiter('?').build().getDelimiter());
48+
public void testCommentStart() {
49+
assertEquals('?', builder.withCommentStart('?').build().getCommentStart().charValue());
5050
}
5151

52-
@Test(expected = IllegalArgumentException.class)
53-
public void testNewFormatLFThrowsException() {
54-
CSVFormat.newBuilder(LF);
52+
@Test
53+
public void testCopiedFormatIsEqualToOriginal() {
54+
final CSVFormat copyOfRCF4180 = CSVFormat.newBuilder(RFC4180).build();
55+
assertEquals(RFC4180, copyOfRCF4180);
5556
}
5657

57-
@Test(expected = IllegalArgumentException.class)
58-
public void testNewFormatCRThrowsException() {
59-
CSVFormat.newBuilder(CR);
58+
@Test
59+
public void testCopiedFormatWithChanges() {
60+
final CSVFormat newFormat = CSVFormat.newBuilder(RFC4180).withDelimiter('!').build();
61+
assertTrue(newFormat.getDelimiter() != RFC4180.getDelimiter());
6062
}
6163

62-
@Test(expected = IllegalArgumentException.class)
63-
public void testWithDelimiterLFThrowsException() {
64-
builder.withDelimiter(LF).build();
64+
@Test
65+
public void testDelimiter() {
66+
assertEquals('?', builder.withDelimiter('?').build().getDelimiter());
6567
}
6668

6769
@Test(expected = IllegalStateException.class)
68-
public void testDelimiterSameAsEscapeThrowsException() {
69-
builder.withDelimiter('!').withEscape('!').build();
70+
public void testDelimiterSameAsCommentStartThrowsException() {
71+
builder.withDelimiter('!').withCommentStart('!').build();
7072
}
7173

7274
@Test(expected = IllegalStateException.class)
73-
public void testDelimiterSameAsCommentStartThrowsException() {
74-
builder.withDelimiter('!').withCommentStart('!').build();
75+
public void testDelimiterSameAsEscapeThrowsException() {
76+
builder.withDelimiter('!').withEscape('!').build();
7577
}
7678

7779
@Test
78-
public void testQuoteChar() {
79-
assertEquals('?', builder.withQuoteChar('?').build().getQuoteChar().charValue());
80+
public void testEscape() {
81+
assertEquals('?', builder.withEscape('?').build().getEscape().charValue());
8082
}
8183

8284
@Test(expected = IllegalStateException.class)
83-
public void testQuoteCharSameAsCommentStartThrowsException() {
84-
builder.withQuoteChar('!').withCommentStart('!').build();
85+
public void testEscapeSameAsCommentStartThrowsException() {
86+
builder.withEscape('!').withCommentStart('!').build();
8587
}
8688

8789
@Test(expected = IllegalStateException.class)
88-
public void testQuoteCharSameAsCommentStartThrowsExceptionForWrapperType() {
90+
public void testEscapeSameAsCommentStartThrowsExceptionForWrapperType() {
8991
// Cannot assume that callers won't use different Character objects
90-
builder.withQuoteChar(new Character('!')).withCommentStart('!').build();
91-
}
92-
93-
@Test(expected = IllegalStateException.class)
94-
public void testQuoteCharSameAsDelimiterThrowsException() {
95-
builder.withQuoteChar('!').withDelimiter('!').build();
92+
builder.withEscape(new Character('!')).withCommentStart(new Character('!')).build();
9693
}
9794

98-
@Test(expected = IllegalArgumentException.class)
99-
public void testWithQuoteLFThrowsException() {
100-
builder.withQuoteChar(LF).build();
95+
@Test
96+
public void testHeaderReferenceCannotEscape() {
97+
final String[] header = new String[]{"one", "tow", "three"};
98+
builder.withHeader(header);
99+
100+
final CSVFormat firstFormat = builder.build();
101+
final CSVFormat secondFormat = builder.build();
102+
assertNotSame(header, firstFormat.getHeader());
103+
assertNotSame(firstFormat, secondFormat.getHeader());
101104
}
102105

103106
@Test
104-
public void testQuotePolicy() {
105-
assertEquals(Quote.ALL, builder.withQuotePolicy(Quote.ALL).build().getQuotePolicy());
106-
}
107-
108-
@Test(expected = IllegalStateException.class)
109-
public void testQuotePolicyNoneWithoutEscapeThrowsException() {
110-
CSVFormat.newBuilder('!').withQuotePolicy(Quote.NONE).build();
107+
public void testIgnoreEmptyLines() {
108+
assertFalse(builder.withIgnoreEmptyLines(false).build().getIgnoreEmptyLines());
111109
}
112110

113111
@Test
114-
public void testCommentStart() {
115-
assertEquals('?', builder.withCommentStart('?').build().getCommentStart().charValue());
112+
public void testIgnoreSurroundingSpaces() {
113+
assertFalse(builder.withIgnoreSurroundingSpaces(false).build().getIgnoreSurroundingSpaces());
116114
}
117115

118116
@Test(expected = IllegalArgumentException.class)
119-
public void testWithCommentStartCRThrowsException() {
120-
builder.withCommentStart(CR).build();
117+
public void testNewFormatCRThrowsException() {
118+
CSVFormat.newBuilder(CR);
121119
}
122120

123-
@Test
124-
public void testRecoardSeparator() {
125-
assertEquals("?", builder.withRecordSeparator("?").build().getRecordSeparator());
121+
@Test(expected = IllegalArgumentException.class)
122+
public void testNewFormatLFThrowsException() {
123+
CSVFormat.newBuilder(LF);
126124
}
127125

128126
@Test
129-
public void testEscape() {
130-
assertEquals('?', builder.withEscape('?').build().getEscape().charValue());
127+
public void testQuoteChar() {
128+
assertEquals('?', builder.withQuoteChar('?').build().getQuoteChar().charValue());
131129
}
132130

133-
@Test(expected = IllegalArgumentException.class)
134-
public void testWithEscapeCRThrowsExceptions() {
135-
builder.withEscape(CR).build();
131+
@Test(expected = IllegalStateException.class)
132+
public void testQuoteCharSameAsCommentStartThrowsException() {
133+
builder.withQuoteChar('!').withCommentStart('!').build();
136134
}
137-
135+
138136
@Test(expected = IllegalStateException.class)
139-
public void testEscapeSameAsCommentStartThrowsException() {
140-
builder.withEscape('!').withCommentStart('!').build();
137+
public void testQuoteCharSameAsCommentStartThrowsExceptionForWrapperType() {
138+
// Cannot assume that callers won't use different Character objects
139+
builder.withQuoteChar(new Character('!')).withCommentStart('!').build();
141140
}
142141

143142
@Test(expected = IllegalStateException.class)
144-
public void testEscapeSameAsCommentStartThrowsExceptionForWrapperType() {
145-
// Cannot assume that callers won't use different Character objects
146-
builder.withEscape(new Character('!')).withCommentStart(new Character('!')).build();
143+
public void testQuoteCharSameAsDelimiterThrowsException() {
144+
builder.withQuoteChar('!').withDelimiter('!').build();
147145
}
148146

149147
@Test
150-
public void testIgnoreSurroundingSpaces() {
151-
assertFalse(builder.withIgnoreSurroundingSpaces(false).build().getIgnoreSurroundingSpaces());
148+
public void testQuotePolicy() {
149+
assertEquals(Quote.ALL, builder.withQuotePolicy(Quote.ALL).build().getQuotePolicy());
152150
}
153-
154-
@Test
155-
public void testIgnoreEmptyLines() {
156-
assertFalse(builder.withIgnoreEmptyLines(false).build().getIgnoreEmptyLines());
151+
152+
@Test(expected = IllegalStateException.class)
153+
public void testQuotePolicyNoneWithoutEscapeThrowsException() {
154+
CSVFormat.newBuilder('!').withQuotePolicy(Quote.NONE).build();
157155
}
158-
156+
159157
@Test
160-
public void testCopiedFormatIsEqualToOriginal() {
161-
final CSVFormat copyOfRCF4180 = CSVFormat.newBuilder(RFC4180).build();
162-
assertEquals(RFC4180, copyOfRCF4180);
158+
public void testRecoardSeparator() {
159+
assertEquals("?", builder.withRecordSeparator("?").build().getRecordSeparator());
163160
}
164-
161+
165162
@Test
166163
public void testRFC4180() {
167164
assertEquals(null, RFC4180.getCommentStart());
@@ -172,21 +169,24 @@ public void testRFC4180() {
172169
assertEquals(null, RFC4180.getQuotePolicy());
173170
assertEquals("\r\n", RFC4180.getRecordSeparator());
174171
}
172+
173+
@Test(expected = IllegalArgumentException.class)
174+
public void testWithCommentStartCRThrowsException() {
175+
builder.withCommentStart(CR).build();
176+
}
175177

176-
@Test
177-
public void testCopiedFormatWithChanges() {
178-
final CSVFormat newFormat = CSVFormat.newBuilder(RFC4180).withDelimiter('!').build();
179-
assertTrue(newFormat.getDelimiter() != RFC4180.getDelimiter());
178+
@Test(expected = IllegalArgumentException.class)
179+
public void testWithDelimiterLFThrowsException() {
180+
builder.withDelimiter(LF).build();
181+
}
182+
183+
@Test(expected = IllegalArgumentException.class)
184+
public void testWithEscapeCRThrowsExceptions() {
185+
builder.withEscape(CR).build();
180186
}
181187

182-
@Test
183-
public void testHeaderReferenceCannotEscape() {
184-
final String[] header = new String[]{"one", "tow", "three"};
185-
builder.withHeader(header);
186-
187-
final CSVFormat firstFormat = builder.build();
188-
final CSVFormat secondFormat = builder.build();
189-
assertNotSame(header, firstFormat.getHeader());
190-
assertNotSame(firstFormat, secondFormat.getHeader());
188+
@Test(expected = IllegalArgumentException.class)
189+
public void testWithQuoteLFThrowsException() {
190+
builder.withQuoteChar(LF).build();
191191
}
192192
}

0 commit comments

Comments
 (0)