diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-07-01 09:19:49 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-07-01 09:19:49 (GMT) |
commit | 2da71a8a85486a494343f1662d64fb5ae5a2a44e (patch) | |
tree | 23992f9f2a00bac23b345e5c2cc9c1194efc25be /test/com/isode/stroke/stringcodecs/HMACSHA1Test.java | |
download | stroke-2da71a8a85486a494343f1662d64fb5ae5a2a44e.zip stroke-2da71a8a85486a494343f1662d64fb5ae5a2a44e.tar.bz2 |
Initial import
Diffstat (limited to 'test/com/isode/stroke/stringcodecs/HMACSHA1Test.java')
-rw-r--r-- | test/com/isode/stroke/stringcodecs/HMACSHA1Test.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/com/isode/stroke/stringcodecs/HMACSHA1Test.java b/test/com/isode/stroke/stringcodecs/HMACSHA1Test.java new file mode 100644 index 0000000..dedcd7c --- /dev/null +++ b/test/com/isode/stroke/stringcodecs/HMACSHA1Test.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010, Isode Limited, London, England. + * All rights reserved. + */ +/* + * Copyright (c) 2010, Remko Tron?on. + * All rights reserved. + */ + +package com.isode.stroke.stringcodecs; + +import com.isode.stroke.base.ByteArray; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import static org.junit.Assert.*; + +public class HMACSHA1Test { + + private ByteArray cast(int[] source) { + byte[] result = new byte[source.length]; + for (int i = 0; i < source.length; i++) { + result[i] = (byte)source[i]; + } + return new ByteArray(result); + } + + @Test + public void testGetResult() { + ByteArray result = HMACSHA1.getResult(new ByteArray("foo"), new ByteArray("foobar")); + assertEquals(cast(new int[]{0xa4, 0xee, 0xba, 0x8e, 0x63, 0x3d, 0x77, 0x88, 0x69, 0xf5, 0x68, 0xd0, 0x5a, 0x1b, 0x3d, 0xc7, 0x2b, 0xfd, 0x4, 0xdd}), result); + } +} |