Skip to content

Commit

Permalink
JUnit5 assertThrows SerializationProxyTest
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojpatrick committed Oct 19, 2022
1 parent a09dab7 commit d7c5d7a
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.Serializable;

Expand All @@ -31,6 +32,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.function.Executable;

public class SerializationProxyTest extends AbstractProxyFactoryAgnosticTest
{
Expand Down Expand Up @@ -91,14 +93,21 @@ public void clearProxyFactory()
PROXY_FACTORY.remove();
}

@Test(expected = SerializationException.class)
@Test
public void testNaive()
{
final Provider proxy = proxyFactory.createInterceptorProxy(null, implementProvider("foo"), Provider.class,
Serializable.class);
assertEquals("foo", proxy.getObject().getValue());
assertTrue(Serializable.class.isInstance(proxy));
SerializationUtils.roundtrip((Serializable) proxy);
// FIXME Simplification once upgraded to Java 1.8
final Executable testMethod = new Executable() {
@Override
public void execute() throws Throwable {
SerializationUtils.roundtrip((Serializable) proxy);
}
};
assertThrows(SerializationException.class, testMethod);
}

@Test
Expand Down

0 comments on commit d7c5d7a

Please sign in to comment.