Skip to content

Commit 902435e

Browse files
Add a test to verify some behavior in StringUtil, remove unnecessary geb dependencies
1 parent 529191d commit 902435e

File tree

4 files changed

+66
-21
lines changed

4 files changed

+66
-21
lines changed

common/pom.xml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@
6767
<groupId>org.codehaus.gmavenplus</groupId>
6868
<artifactId>gmavenplus-plugin</artifactId>
6969
</plugin>
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-surefire-plugin</artifactId>
73+
<configuration>
74+
<includes>
75+
<include>**/*Spec*</include>
76+
<include>**/*Test*</include>
77+
</includes>
78+
<argLine>${surefire.argLine}</argLine>
79+
</configuration>
80+
</plugin>
7081
</plugins>
7182
<resources>
7283
<resource>
@@ -377,24 +388,9 @@
377388
<scope>test</scope>
378389
</dependency>
379390
<dependency>
380-
<groupId>org.gebish</groupId>
381-
<artifactId>geb-core</artifactId>
382-
<scope>test</scope>
383-
</dependency>
384-
<dependency>
385-
<groupId>org.seleniumhq.selenium</groupId>
386-
<artifactId>selenium-support</artifactId>
391+
<groupId>org.spockframework</groupId>
392+
<artifactId>spock-core</artifactId>
387393
<scope>test</scope>
388394
</dependency>
389-
<dependency>
390-
<groupId>org.seleniumhq.selenium</groupId>
391-
<artifactId>selenium-firefox-driver</artifactId>
392-
<scope>test</scope>
393-
</dependency>
394-
<dependency>
395-
<groupId>org.seleniumhq.selenium</groupId>
396-
<artifactId>selenium-chrome-driver</artifactId>
397-
<scope>test</scope>
398-
</dependency>
399395
</dependencies>
400396
</project>

common/src/main/java/org/broadleafcommerce/common/util/StringUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
package org.broadleafcommerce.common.util;
2222

23+
import org.apache.commons.lang.StringUtils;
24+
import org.codehaus.jettison.json.JSONObject;
25+
2326
import java.io.ByteArrayInputStream;
2427
import java.io.IOException;
2528
import java.io.UnsupportedEncodingException;
@@ -30,9 +33,6 @@
3033
import java.util.zip.Adler32;
3134
import java.util.zip.CheckedInputStream;
3235

33-
import org.apache.commons.lang.StringUtils;
34-
import org.codehaus.jettison.json.JSONObject;
35-
3636
public class StringUtil {
3737

3838
public static long getChecksum(String test) {
@@ -47,7 +47,7 @@ public static long getChecksum(String test) {
4747
throw new RuntimeException(e);
4848
}
4949
}
50-
50+
5151
/**
5252
* Checks if a string is included in the beginning of another string, but only in dot-separated segment leaps.
5353
* Examples:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* #%L
3+
* BroadleafCommerce Common Libraries
4+
* %%
5+
* Copyright (C) 2009 - 2016 Broadleaf Commerce
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* #L%
19+
*/
20+
/**
21+
*
22+
*/
23+
package org.broadleafcommerce.common.test.util
24+
25+
import org.broadleafcommerce.common.util.StringUtil
26+
27+
import spock.lang.Specification
28+
29+
30+
/**
31+
*
32+
*
33+
* @author Phillip Verheyden (phillipuniverse)
34+
*/
35+
class StringUtilSpec extends Specification {
36+
37+
def "Exact roperty segments"() {
38+
when:
39+
def result = StringUtil.segmentInclusion("fulfillmentLocation.address.phoneFax", "fulfillmentLocation.address.phone")
40+
then:
41+
!result
42+
43+
when:
44+
result = StringUtil.segmentInclusion("fulfillmentLocation.address.phoneFax.phoneNumber", "fulfillmentLocation.address.phoneFax")
45+
then:
46+
result
47+
}
48+
49+
}

common/src/test/groovy/placeholder.git

Whitespace-only changes.

0 commit comments

Comments
 (0)