### Question:
StatelessSSOToken implements SSOToken { @Override public String getProperty(String name) throws SSOException { try { return session.getProperty(name); } catch (SessionException e) { throw new SSOException(e); } } StatelessSSOToken(StatelessSession session); boolean isValid(boolean reset); @Override Principal getPrincipal(); @Override String getAuthType(); @Override int getAuthLevel(); @Override InetAddress getIPAddress(); @Override String getHostName(); @Override long getTimeLeft(); @Override long getMaxSessionTime(); @Override long getIdleTime(); @Override long getMaxIdleTime(); @Override SSOTokenID getTokenID(); @Override void setProperty(String name, String value); @Override String getProperty(String name); @Override String getProperty(String name, boolean ignoreState); @Override void addSSOTokenListener(SSOTokenListener listener); @Override String encodeURL(String url); @Override boolean isTokenRestricted(); @Override String dereferenceRestrictedTokenID(SSOToken requester, String restrictedId); @Override String toString();  }### Answer:
@Test public void shouldReadPropertiesFromSession() throws Exception { String propertyName = "testProperty"; String propertyValue = "testValue"; given(mockSession.getProperty(propertyName)).willReturn(propertyValue); String result = statelessSSOToken.getProperty(propertyName); assertThat(result).isEqualTo(propertyValue); }
@Test public void shouldReadPropertiesNormallyIfPresentAndStateIgnored() throws Exception { String propertyName = "testProperty"; String propertyValue = "testValue"; given(mockSession.getProperty(propertyName)).willReturn(propertyValue); String result = statelessSSOToken.getProperty(propertyName, true); assertThat(result).isEqualTo(propertyValue); }
@Test public void shouldReadPropertiesNormallyIfPresentAndStateNotIgnored() throws Exception { String propertyName = "testProperty"; String propertyValue = "testValue"; given(mockSession.getProperty(propertyName)).willReturn(propertyValue); String result = statelessSSOToken.getProperty(propertyName, false); assertThat(result).isEqualTo(propertyValue); }
@Test public void shouldFallBackOnUnvalidatedPropertiesIfStateIgnored() throws Exception { String propertyName = "testProperty"; given(mockSession.getProperty(propertyName)).willThrow(new SessionException("test")); String unvalidatedPropertyValue = "unvalidatedValue"; given(mockSession.getPropertyWithoutValidation(propertyName)).willReturn(unvalidatedPropertyValue); String result = statelessSSOToken.getProperty(propertyName, true); assertThat(result).isEqualTo(unvalidatedPropertyValue); }
@Test(expectedExceptions = SSOException.class) public void shouldPropagateExceptionIfStateNotIgnoredAndPropertyError() throws Exception { String propertyName = "testProperty"; given(mockSession.getProperty(propertyName)).willThrow(new SessionException("test")); statelessSSOToken.getProperty(propertyName, false); }