moved Java test into groovy

This commit is contained in:
Brian Matzon 2016-06-06 23:43:52 +02:00
parent 39ee58a511
commit 4be4912cb2
2 changed files with 24 additions and 39 deletions

View File

@ -124,4 +124,28 @@ class JwtMapTest {
def s = ['b', 'd']
assertTrue m.values().containsAll(s) && s.containsAll(m.values())
}
@Test
public void testEquals() throws Exception {
def m1 = new JwtMap();
m1.put("a", "a");
def m2 = new JwtMap();
m2.put("a", "a");
assertEquals(m1, m2);
}
@Test
public void testHashcode() throws Exception {
def m = new JwtMap();
def hashCodeEmpty = m.hashCode();
m.put("a", "b");
def hashCodeNonEmpty = m.hashCode();
assertTrue(hashCodeEmpty != hashCodeNonEmpty);
def identityHash = System.identityHashCode(m);
assertTrue(hashCodeNonEmpty != identityHash);
}
}

View File

@ -1,39 +0,0 @@
package io.jsonwebtoken.impl;
import org.junit.Test;
import static junit.framework.Assert.assertTrue;
import static junit.framework.TestCase.assertEquals;
/**
* Java specific test to ensure we don't hit Groovy's DefaultGroovyMethods
*/
public class JavaJwtMapTest
{
@Test
public void testEquals() throws Exception
{
JwtMap jwtMap1 = new JwtMap();
jwtMap1.put("a", "a");
JwtMap jwtMap2 = new JwtMap();
jwtMap2.put("a", "a");
assertEquals(jwtMap1, jwtMap2);
}
@Test
public void testHashCode() throws Exception
{
JwtMap jwtMap = new JwtMap();
int hashCodeEmpty = jwtMap.hashCode();
jwtMap.put("a", "b");
int hashCodeNonEmpty = jwtMap.hashCode();
assertTrue(hashCodeEmpty != hashCodeNonEmpty);
int identityHash = System.identityHashCode(jwtMap);
assertTrue(hashCodeNonEmpty != identityHash);
}
}