Permalink
Browse files

fix invalid behaviors based on tests from jsr107tck

  • Loading branch information...
ocafebabe committed Feb 28, 2016
1 parent acf3e77 commit 2018f7db23d40580574971d884652c4035b47a4f
@@ -513,6 +513,11 @@ public boolean isClosed()
@Override
public <T> T unwrap(Class<T> clazz)
{
if (!clazz.isAssignableFrom(getClass()))
{
throw new IllegalArgumentException();
}
return clazz.cast(this);
}
@@ -59,6 +59,11 @@ public V getValue()
@Override
public <T> T unwrap(Class<T> clazz)
{
if (!clazz.isAssignableFrom(getClass()))
{
throw new IllegalArgumentException();
}
return clazz.cast(this);
}
}
@@ -212,6 +212,11 @@ public boolean isClosed()
@Override
public <T> T unwrap(Class<T> clazz)
{
if (!clazz.isAssignableFrom(getClass()))
{
throw new IllegalArgumentException();
}
return clazz.cast(this);
}
@@ -72,6 +72,11 @@ public V getValue()
@Override
public <T> T unwrap(Class<T> clazz)
{
if (!clazz.isAssignableFrom(getClass()))
{
throw new IllegalArgumentException();
}
return clazz.cast(this);
}
@@ -416,4 +416,14 @@ public void getCachesAndMutateCacheManager()
assertTrue(collection2.contains(element));
}
}
@Test(expected = IllegalArgumentException.class) // org.jsr107.tck.CacheManagerTest.unwrapThrowsInvalidArgument
public void unwrapThrowsInvalidArgument()
{
final Class ALWAYS_INVALID_UNWRAP_CLASS = Exception.class;
cachingProvider.getCacheManager().unwrap(Exception.class);
fail();
}
}

0 comments on commit 2018f7d

Please sign in to comment.