Skip to content

Commit 6ad999f

Browse files
add test cases for StringTools
1 parent e17f2e4 commit 6ad999f

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2020 Philipp Salvisberg <philipp.salvisberg@trivadis.com>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.utplsql.sqldev.test;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
21+
import org.junit.Assert;
22+
import org.junit.Test;
23+
import org.utplsql.sqldev.model.StringTools;
24+
25+
public class StringToolsTest {
26+
27+
@Test
28+
public void one_entry_as_CSV() {
29+
final List<String> list = new ArrayList<>();
30+
list.add("hello");
31+
Assert.assertEquals(" 'hello'\n", StringTools.getCSV(list, 5));
32+
}
33+
34+
@Test
35+
public void two_entries_as_CSV() {
36+
final List<String> list = new ArrayList<>();
37+
list.add("hello");
38+
list.add("world");
39+
Assert.assertEquals(" 'hello',\n 'world'\n", StringTools.getCSV(list, 5));
40+
}
41+
42+
@Test
43+
public void one_entry_as_simpleCSV() {
44+
final List<String> list = new ArrayList<>();
45+
list.add("hello");
46+
Assert.assertEquals("hello", StringTools.getSimpleCSV(list));
47+
}
48+
49+
@Test
50+
public void two_entries_as_simpleCSV() {
51+
final List<String> list = new ArrayList<>();
52+
list.add("hello");
53+
list.add("world");
54+
Assert.assertEquals("hello, world", StringTools.getSimpleCSV(list));
55+
}
56+
57+
}

0 commit comments

Comments
 (0)