Skip to content

Commit 5ce931b

Browse files
committed
Use localised SuppressWarning annotations
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1842322 13f79535-47bb-0310-9956-ffa450edef68
1 parent 36fccb4 commit 5ce931b

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/test/java/org/apache/commons/codec/digest/HmacUtilsTest.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@
3434
*
3535
* @version $Id$
3636
*/
37-
@SuppressWarnings("deprecation") // temporarily ignore that HmacUtils is deprecated
3837
public class HmacUtilsTest {
3938

39+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
4040
@Test(expected = IllegalArgumentException.class)
4141
public void testEmptyKey() {
4242
HmacUtils.getHmacMd5(new byte[] {});
4343
}
4444

45+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
4546
@Test
4647
public void testGetHMac() {
4748
Assert.assertArrayEquals(HmacAlgorithmsTest.STANDARD_MD5_RESULT_BYTES,
@@ -56,6 +57,7 @@ public void testGetHMac() {
5657
HmacUtils.getHmacSha512(HmacAlgorithmsTest.STANDARD_KEY_BYTES).doFinal(HmacAlgorithmsTest.STANDARD_PHRASE_BYTES));
5758
}
5859

60+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
5961
@Test
6062
public void testHmacMd5Hex() throws IOException {
6163
assertEquals(HmacAlgorithmsTest.STANDARD_MD5_RESULT_STRING,
@@ -67,6 +69,7 @@ public void testHmacMd5Hex() throws IOException {
6769
new ByteArrayInputStream("what do ya want for nothing?".getBytes())));
6870
}
6971

72+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
7073
@Test
7174
public void testHmacSha1Hex() throws IOException {
7275
assertEquals(HmacAlgorithmsTest.STANDARD_SHA1_RESULT_STRING, HmacUtils.hmacSha1Hex(HmacAlgorithmsTest.STANDARD_KEY_STRING, HmacAlgorithmsTest.STANDARD_PHRASE_STRING));
@@ -79,6 +82,7 @@ public void testHmacSha1Hex() throws IOException {
7982
new ByteArrayInputStream("what do ya want for nothing?".getBytes())));
8083
}
8184

85+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
8286
@Test
8387
public void testHmacSha1UpdateWithByteArray() {
8488
final Mac mac = HmacUtils.getHmacSha1(HmacAlgorithmsTest.STANDARD_KEY_BYTES);
@@ -88,6 +92,7 @@ public void testHmacSha1UpdateWithByteArray() {
8892
assertEquals("f42bb0eeb018ebbd4597ae7213711ec60760843f", Hex.encodeHexString(mac.doFinal()));
8993
}
9094

95+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
9196
@Test
9297
public void testHmacSha1UpdateWithInpustream() throws IOException {
9398
final Mac mac = HmacUtils.getHmacSha1(HmacAlgorithmsTest.STANDARD_KEY_BYTES);
@@ -97,6 +102,7 @@ public void testHmacSha1UpdateWithInpustream() throws IOException {
97102
assertEquals("f42bb0eeb018ebbd4597ae7213711ec60760843f", Hex.encodeHexString(mac.doFinal()));
98103
}
99104

105+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
100106
@Test
101107
public void testHmacSha1UpdateWithString() {
102108
final Mac mac = HmacUtils.getHmacSha1(HmacAlgorithmsTest.STANDARD_KEY_BYTES);
@@ -131,6 +137,7 @@ public void testInternalNoSuchAlgorithmException() {
131137
HmacUtils.getInitializedMac("Bogus Bogus", StringUtils.getBytesUtf8("akey"));
132138
}
133139

140+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
134141
@Test
135142
public void testMd5HMac() throws IOException {
136143
Assert.assertArrayEquals(HmacAlgorithmsTest.STANDARD_MD5_RESULT_BYTES,
@@ -146,11 +153,13 @@ public void testMd5HMac() throws IOException {
146153
HmacUtils.hmacMd5Hex(HmacAlgorithmsTest.STANDARD_KEY_STRING, HmacAlgorithmsTest.STANDARD_PHRASE_STRING));
147154
}
148155

156+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
149157
@Test(expected = IllegalArgumentException.class)
150158
public void testMd5HMacFail() {
151159
HmacUtils.hmacMd5((byte[]) null, HmacAlgorithmsTest.STANDARD_PHRASE_BYTES);
152160
}
153161

162+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
154163
@Test(expected = IllegalArgumentException.class)
155164
public void testNullKey() {
156165
HmacUtils.getHmacMd5(null);
@@ -161,6 +170,7 @@ public void testSecretKeySpecAllowsEmtyKeys() {
161170
new SecretKeySpec(new byte[] {}, "HmacMD5");
162171
}
163172

173+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
164174
@Test
165175
public void testSha1HMac() throws IOException {
166176
Assert.assertArrayEquals(HmacAlgorithmsTest.STANDARD_SHA1_RESULT_BYTES,
@@ -177,11 +187,13 @@ public void testSha1HMac() throws IOException {
177187
HmacUtils.hmacSha1Hex(HmacAlgorithmsTest.STANDARD_KEY_STRING, HmacAlgorithmsTest.STANDARD_PHRASE_STRING));
178188
}
179189

190+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
180191
@Test(expected = IllegalArgumentException.class)
181192
public void testSha1HMacFail() {
182193
HmacUtils.hmacSha1((byte[]) null, HmacAlgorithmsTest.STANDARD_PHRASE_BYTES);
183194
}
184195

196+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
185197
@Test
186198
public void testSha256HMac() throws IOException {
187199
Assert.assertArrayEquals(HmacAlgorithmsTest.STANDARD_SHA256_RESULT_BYTES,
@@ -198,11 +210,13 @@ public void testSha256HMac() throws IOException {
198210
HmacUtils.hmacSha256Hex(HmacAlgorithmsTest.STANDARD_KEY_STRING, HmacAlgorithmsTest.STANDARD_PHRASE_STRING));
199211
}
200212

213+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
201214
@Test(expected = IllegalArgumentException.class)
202215
public void testSha256HMacFail() {
203216
HmacUtils.hmacSha256((byte[]) null, HmacAlgorithmsTest.STANDARD_PHRASE_BYTES);
204217
}
205218

219+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
206220
@Test
207221
public void testSha384HMac() throws IOException {
208222
Assert.assertArrayEquals(HmacAlgorithmsTest.STANDARD_SHA384_RESULT_BYTES,
@@ -219,11 +233,13 @@ public void testSha384HMac() throws IOException {
219233
HmacUtils.hmacSha384Hex(HmacAlgorithmsTest.STANDARD_KEY_STRING, HmacAlgorithmsTest.STANDARD_PHRASE_STRING));
220234
}
221235

236+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
222237
@Test(expected = IllegalArgumentException.class)
223238
public void testSha384HMacFail() {
224239
HmacUtils.hmacSha384((byte[]) null, HmacAlgorithmsTest.STANDARD_PHRASE_BYTES);
225240
}
226241

242+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
227243
@Test
228244
public void testSha512HMac() throws IOException {
229245
Assert.assertArrayEquals(HmacAlgorithmsTest.STANDARD_SHA512_RESULT_BYTES,
@@ -240,6 +256,7 @@ public void testSha512HMac() throws IOException {
240256
HmacUtils.hmacSha512Hex(HmacAlgorithmsTest.STANDARD_KEY_STRING, HmacAlgorithmsTest.STANDARD_PHRASE_STRING));
241257
}
242258

259+
@SuppressWarnings("deprecation") // most of the static methods are deprecated
243260
@Test(expected = IllegalArgumentException.class)
244261
public void testSha512HMacFail() {
245262
HmacUtils.hmacSha512((byte[]) null, HmacAlgorithmsTest.STANDARD_PHRASE_BYTES);

0 commit comments

Comments
 (0)