EncryptorProviderService { public Encryptor getEncryptor() { return checkNotNull(encryptorReference.get(), "Encryptor is not initialized"); }  boolean isInitialized(); Encryptor getEncryptor(); void setEncryptor(Encryptor encryptor);  }
@Test public void getEncryptorNotInitialized() { thrown.expect(NullPointerException.class); thrown.expectMessage("Encryptor is not initialized"); service.getEncryptor(); }