1 package com.atlassian.vcache.marshallers;
2
3 import com.atlassian.vcache.Marshaller;
4 import com.atlassian.vcache.MarshallerException;
5
6 import org.junit.Test;
7
8 import static org.hamcrest.CoreMatchers.is;
9 import static org.junit.Assert.assertThat;
10
11 public class JavaSerializationMarshallerTest
12 {
13 @Test(expected = MarshallerException.class)
14 public void testClassCast() throws MarshallerException
15 {
16 Marshaller<String> stringie = MarshallerFactory.serializableMarshaller(String.class);
17 Marshaller<Long> longie = MarshallerFactory.serializableMarshaller(Long.TYPE);
18
19 byte[] strData = stringie.marshall("Art Vs Science");
20 String revived = stringie.unmarshall(strData);
21
22 assertThat(revived, is("Art Vs Science"));
23
24 longie.unmarshall(strData);
25 }
26 }