@Test public void basicSessionSerializationWorks() throws Exception { InternalSession is = new InternalSession(); String serialised = SERIALISATION.serialise(is); assertThat(serialised).isNotNull().isEqualTo(getJSON("/json/basic-session.json")); assertThat(is).isNotNull(); }
public <T> String serialise(T object) { try { String value = mapper.writeValueAsString(object); return value; } catch (IOException e) { throw new IllegalStateException( MessageFormat.format( "Failed to serialise {0}:{1}", object.getClass().getSimpleName(), object), e); } }
JSONSerialisation { public <T> String serialise(T object) { try { String value = mapper.writeValueAsString(object); return value; } catch (IOException e) { throw new IllegalStateException( MessageFormat.format( "Failed to serialise {0}:{1}", object.getClass().getSimpleName(), object), e); } } }
JSONSerialisation { public <T> String serialise(T object) { try { String value = mapper.writeValueAsString(object); return value; } catch (IOException e) { throw new IllegalStateException( MessageFormat.format( "Failed to serialise {0}:{1}", object.getClass().getSimpleName(), object), e); } } JSONSerialisation(); }
JSONSerialisation { public <T> String serialise(T object) { try { String value = mapper.writeValueAsString(object); return value; } catch (IOException e) { throw new IllegalStateException( MessageFormat.format( "Failed to serialise {0}:{1}", object.getClass().getSimpleName(), object), e); } } JSONSerialisation(); String serialise(T object); T deserialise(String text, Class<T> clazz); static String jsonAttributeName(String name); }
JSONSerialisation { public <T> String serialise(T object) { try { String value = mapper.writeValueAsString(object); return value; } catch (IOException e) { throw new IllegalStateException( MessageFormat.format( "Failed to serialise {0}:{1}", object.getClass().getSimpleName(), object), e); } } JSONSerialisation(); String serialise(T object); T deserialise(String text, Class<T> clazz); static String jsonAttributeName(String name);  }