NotAuthorizedException extends GemFireSecurityException { public synchronized Principal getPrincipal() { return this.principal; } NotAuthorizedException(final String message);  NotAuthorizedException(final String message, final Throwable cause);  NotAuthorizedException(final String message, final Principal principal);  NotAuthorizedException(final String message, final Throwable cause,
      final Principal principal); synchronized Principal getPrincipal();  }
@Test public void serializesWithNonSerializablePrincipal() { NotAuthorizedException instance = new NotAuthorizedException(message, nonSerializablePrincipal); assertThat(instance.getPrincipal()).isNotNull(); NotAuthorizedException cloned = (NotAuthorizedException) SerializationUtils.clone(instance); assertThat(cloned).hasMessage(message); assertThat(cloned.getPrincipal()).isNull(); }
@Test public void serializesWithSerializablePrincipal() { NotAuthorizedException instance = new NotAuthorizedException(message, serializablePrincipal); NotAuthorizedException cloned = (NotAuthorizedException) SerializationUtils.clone(instance); assertThat(cloned).hasMessage(message); assertThat(cloned.getPrincipal()).isNotNull().isEqualTo(serializablePrincipal); }