Skip to content

Commit 85315cd

Browse files
committed
Exceptions not thrown
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1309092 13f79535-47bb-0310-9956-ffa450edef68
1 parent c683f14 commit 85315cd

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static org.junit.Assert.assertTrue;
2424
import static org.junit.Assert.fail;
2525

26-
import java.io.UnsupportedEncodingException;
2726
import java.math.BigInteger;
2827
import java.util.Arrays;
2928
import java.util.Random;
@@ -123,7 +122,7 @@ public void testCodec68() {
123122
}
124123

125124
@Test
126-
public void testCodeInteger1() throws UnsupportedEncodingException {
125+
public void testCodeInteger1() {
127126
String encodedInt1 = "li7dzDacuo67Jg7mtqEm2TRuOMU=";
128127
BigInteger bigInt1 = new BigInteger("85739377120809420210425962799" + "0318636601332086981");
129128

@@ -132,7 +131,7 @@ public void testCodeInteger1() throws UnsupportedEncodingException {
132131
}
133132

134133
@Test
135-
public void testCodeInteger2() throws UnsupportedEncodingException {
134+
public void testCodeInteger2() {
136135
String encodedInt2 = "9B5ypLY9pMOmtxCeTDHgwdNFeGs=";
137136
BigInteger bigInt2 = new BigInteger("13936727572861167254666467268" + "91466679477132949611");
138137

@@ -141,7 +140,7 @@ public void testCodeInteger2() throws UnsupportedEncodingException {
141140
}
142141

143142
@Test
144-
public void testCodeInteger3() throws UnsupportedEncodingException {
143+
public void testCodeInteger3() {
145144
String encodedInt3 = "FKIhdgaG5LGKiEtF1vHy4f3y700zaD6QwDS3IrNVGzNp2" + "rY+1LFWTK6D44AyiC1n8uWz1itkYMZF0/aKDK0Yjg==";
146145
BigInteger bigInt3 = new BigInteger("10806548154093873461951748545"
147146
+ "1196989136416448805819079363524309897749044958112417136240557"
@@ -152,7 +151,7 @@ public void testCodeInteger3() throws UnsupportedEncodingException {
152151
}
153152

154153
@Test
155-
public void testCodeInteger4() throws UnsupportedEncodingException {
154+
public void testCodeInteger4() {
156155
String encodedInt4 = "ctA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI"
157156
+ "4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3o"
158157
+ "DzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYv"
@@ -249,21 +248,21 @@ public void testConstructor_Int_ByteArray_Boolean_UrlSafe() {
249248
* Tests conditional true branch for "marker0" test.
250249
*/
251250
@Test
252-
public void testDecodePadMarkerIndex2() throws UnsupportedEncodingException {
251+
public void testDecodePadMarkerIndex2() {
253252
assertEquals("A", new String(Base64.decodeBase64("QQ==".getBytes(Charsets.UTF_8))));
254253
}
255254

256255
/**
257256
* Tests conditional branches for "marker1" test.
258257
*/
259258
@Test
260-
public void testDecodePadMarkerIndex3() throws UnsupportedEncodingException {
259+
public void testDecodePadMarkerIndex3() {
261260
assertEquals("AA", new String(Base64.decodeBase64("QUE=".getBytes(Charsets.UTF_8))));
262261
assertEquals("AAA", new String(Base64.decodeBase64("QUFB".getBytes(Charsets.UTF_8))));
263262
}
264263

265264
@Test
266-
public void testDecodePadOnly() throws UnsupportedEncodingException {
265+
public void testDecodePadOnly() {
267266
assertEquals(0, Base64.decodeBase64("====".getBytes(Charsets.UTF_8)).length);
268267
assertEquals("", new String(Base64.decodeBase64("====".getBytes(Charsets.UTF_8))));
269268
// Test truncated padding
@@ -274,7 +273,7 @@ public void testDecodePadOnly() throws UnsupportedEncodingException {
274273
}
275274

276275
@Test
277-
public void testDecodePadOnlyChunked() throws UnsupportedEncodingException {
276+
public void testDecodePadOnlyChunked() {
278277
assertEquals(0, Base64.decodeBase64("====\n".getBytes(Charsets.UTF_8)).length);
279278
assertEquals("", new String(Base64.decodeBase64("====\n".getBytes(Charsets.UTF_8))));
280279
// Test truncated padding
@@ -408,7 +407,7 @@ public void testIsUrlSafe() {
408407
}
409408

410409
@Test
411-
public void testKnownDecodings() throws UnsupportedEncodingException {
410+
public void testKnownDecodings() {
412411
assertEquals("The quick brown fox jumped over the lazy dogs.", new String(Base64
413412
.decodeBase64("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==".getBytes(Charsets.UTF_8))));
414413
assertEquals("It was the best of times, it was the worst of times.", new String(Base64
@@ -423,7 +422,7 @@ public void testKnownDecodings() throws UnsupportedEncodingException {
423422
}
424423

425424
@Test
426-
public void testKnownEncodings() throws UnsupportedEncodingException {
425+
public void testKnownEncodings() {
427426
assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new String(Base64
428427
.encodeBase64("The quick brown fox jumped over the lazy dogs.".getBytes(Charsets.UTF_8))));
429428
assertEquals(

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import static org.junit.Assert.assertEquals;
2121
import static org.junit.Assert.fail;
2222

23-
import java.io.UnsupportedEncodingException;
24-
2523
import org.apache.commons.codec.Charsets;
2624
import org.apache.commons.codec.DecoderException;
2725
import org.apache.commons.codec.EncoderException;
@@ -176,7 +174,7 @@ public void testDecodeObject() throws Exception {
176174
* @param encodeMe
177175
* data to encode and compare
178176
*/
179-
void assertDecodeObject(byte[] bits, String encodeMe) throws DecoderException, UnsupportedEncodingException {
177+
void assertDecodeObject(byte[] bits, String encodeMe) throws DecoderException {
180178
byte[] decoded;
181179
decoded = (byte[]) instance.decode(encodeMe);
182180
assertEquals(new String(bits), new String(decoded));
@@ -198,7 +196,7 @@ void assertDecodeObject(byte[] bits, String encodeMe) throws DecoderException, U
198196
* Tests for byte[] decode(byte[])
199197
*/
200198
@Test
201-
public void testDecodeByteArray() throws UnsupportedEncodingException {
199+
public void testDecodeByteArray() {
202200
// With a single raw binary
203201
byte[] bits = new byte[1];
204202
byte[] decoded = instance.decode("00000000".getBytes(Charsets.UTF_8));
@@ -481,7 +479,7 @@ public void testFromAsciiCharArray() {
481479
* Tests for byte[] fromAscii(byte[])
482480
*/
483481
@Test
484-
public void testFromAsciiByteArray() throws UnsupportedEncodingException {
482+
public void testFromAsciiByteArray() {
485483
assertEquals(0, BinaryCodec.fromAscii((byte[]) null).length);
486484
assertEquals(0, BinaryCodec.fromAscii(new byte[0]).length);
487485
// With a single raw binary

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private void testCustomCharset(String name, String parent) throws UnsupportedEnc
170170
}
171171

172172
@Test(expected=UnsupportedCharsetException.class)
173-
public void testCustomCharsetBadName() throws UnsupportedEncodingException {
173+
public void testCustomCharsetBadName() {
174174
new Hex(BAD_ENCODING_NAME);
175175
}
176176

0 commit comments

Comments
 (0)