Skip to content

Commit 31a3522

Browse files
committed
We could make the constructor private but there does not seem to be a point to jumping through extra code hoops to restrict instantiation right now.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@798339 13f79535-47bb-0310-9956-ffa450edef68
1 parent 20a88d9 commit 31a3522

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/java/org/apache/commons/codec/binary/StringUtils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,4 @@ public static String newStringUtf8(byte[] bytes) {
270270
return StringUtils.newString(bytes, CharEncoding.UTF_8);
271271
}
272272

273-
private StringUtils() {
274-
// noop, cannot instantiate. Can always relax later.
275-
}
276273
}

src/test/org/apache/commons/codec/binary/StringUtilsTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class StringUtilsTest extends TestCase {
3232
private static byte[] BYTES_FIXTURE;
3333

3434
private static final String STRING_FIXTURE = "ABC";
35+
3536
{
3637
try {
3738
BYTES_FIXTURE = "abc".getBytes("US-ASCII");
@@ -40,6 +41,14 @@ public class StringUtilsTest extends TestCase {
4041
}
4142
}
4243

44+
/**
45+
* We could make the constructor private but there does not seem to be a point to jumping through extra code hoops
46+
* to restrict instantiation right now.
47+
*/
48+
public void testConstructor() {
49+
new StringUtils();
50+
}
51+
4352
public void testGetBytesIso8859_1() throws UnsupportedEncodingException {
4453
String charsetName = "ISO-8859-1";
4554
testGetSupportedBytes(charsetName);
@@ -165,5 +174,4 @@ public void testNewStringUtf8() throws UnsupportedEncodingException {
165174
String actual = StringUtils.newStringUtf8(BYTES_FIXTURE);
166175
Assert.assertEquals(expected, actual);
167176
}
168-
169177
}

0 commit comments

Comments
 (0)