use new junit api to test exception

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
olivier lamy 2020-05-13 20:15:17 +10:00 committed by Olivier Lamy
parent 90527065c0
commit ebbe2c5843
3 changed files with 6 additions and 30 deletions

View File

@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* InfinispanSessionDataStoreTest
@ -106,15 +106,7 @@ public class InfinispanSessionDataStoreTest extends AbstractSessionDataStoreTest
((InfinispanSessionDataStore)store).setCache(null);
//test that loading it fails
try
{
store.load("222");
fail("Session should be unreadable");
}
catch (UnreadableSessionDataException e)
{
//expected exception
}
assertThrows(UnreadableSessionDataException.class, () -> store.load("222"));
}
/**

View File

@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* SerializedInfinispanSessionDataStoreTest
@ -107,15 +107,7 @@ public class SerializedInfinispanSessionDataStoreTest extends AbstractSessionDat
((InfinispanSessionDataStore)store).setCache(null);
//test that loading it fails
try
{
store.load("222");
fail("Session should be unreadable");
}
catch (UnreadableSessionDataException e)
{
//expected exception
}
assertThrows(UnreadableSessionDataException.class,() -> store.load("222"));
}
/**

View File

@ -38,7 +38,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* RemoteInfinispanSessionDataStoreTest
@ -130,15 +130,7 @@ public class RemoteInfinispanSessionDataStoreTest extends AbstractSessionDataSto
((InfinispanSessionDataStore)store).setCache(null);
//test that loading it fails
try
{
store.load("222");
fail("Session should be unreadable");
}
catch (UnreadableSessionDataException e)
{
//expected exception
}
assertThrows(UnreadableSessionDataException.class, () -> store.load("222"));
}
@Test