Skip to content

Commit 4c9283e

Browse files
convert PrefixToolsTest to Java, removing Xtend dependencies
1 parent 9e12764 commit 4c9283e

File tree

1 file changed

+51
-37
lines changed

1 file changed

+51
-37
lines changed
Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,59 @@
1+
/*
2+
* Copyright 2019 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+
*/
116
package org.utplsql.sqldev.test;
217

3-
import java.util.Collections;
4-
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
18+
import java.util.Arrays;
19+
520
import org.junit.Assert;
621
import org.junit.Test;
722
import org.utplsql.sqldev.model.PrefixTools;
823

9-
@SuppressWarnings("all")
1024
public class PrefixToolsTest {
11-
@Test
12-
public void two() {
13-
final String actual = PrefixTools.commonPrefix(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("junit.test.a", "junit.test.b")));
14-
final String expected = "junit.test.";
15-
Assert.assertEquals(expected, actual);
16-
}
17-
18-
@Test
19-
public void oneWithDot() {
20-
final String actual = PrefixTools.commonPrefix(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("junit.test.a")));
21-
final String expected = "junit.test.";
22-
Assert.assertEquals(expected, actual);
23-
}
24-
25-
@Test
26-
public void oneWithoutDot() {
27-
final String actual = PrefixTools.commonPrefix(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("junit-test-a")));
28-
final String expected = "";
29-
Assert.assertEquals(expected, actual);
30-
}
31-
32-
@Test
33-
public void twoOverlapLeft() {
34-
final String actual = PrefixTools.commonPrefix(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a.b.c", "a.b.c.d")));
35-
final String expected = "";
36-
Assert.assertEquals(expected, actual);
37-
}
38-
39-
@Test
40-
public void twoOverlapRight() {
41-
final String actual = PrefixTools.commonPrefix(Collections.<String>unmodifiableList(CollectionLiterals.<String>newArrayList("a.b.c.d", "a.b.c")));
42-
final String expected = "";
43-
Assert.assertEquals(expected, actual);
44-
}
25+
@Test
26+
public void two() {
27+
final String actual = PrefixTools.commonPrefix(Arrays.asList("junit.test.a", "junit.test.b"));
28+
final String expected = "junit.test.";
29+
Assert.assertEquals(expected, actual);
30+
}
31+
32+
@Test
33+
public void oneWithDot() {
34+
final String actual = PrefixTools.commonPrefix(Arrays.asList("junit.test.a"));
35+
final String expected = "junit.test.";
36+
Assert.assertEquals(expected, actual);
37+
}
38+
39+
@Test
40+
public void oneWithoutDot() {
41+
final String actual = PrefixTools.commonPrefix(Arrays.asList("junit-test-a"));
42+
final String expected = "";
43+
Assert.assertEquals(expected, actual);
44+
}
45+
46+
@Test
47+
public void twoOverlapLeft() {
48+
final String actual = PrefixTools.commonPrefix(Arrays.asList("a.b.c", "a.b.c.d"));
49+
final String expected = "";
50+
Assert.assertEquals(expected, actual);
51+
}
52+
53+
@Test
54+
public void twoOverlapRight() {
55+
final String actual = PrefixTools.commonPrefix(Arrays.asList("a.b.c.d", "a.b.c"));
56+
final String expected = "";
57+
Assert.assertEquals(expected, actual);
58+
}
4559
}

0 commit comments

Comments
 (0)