### Question:
SphereClientConfig extends Base implements SphereAuthConfig, SphereApiConfig { public static SphereClientConfig ofEnvironmentVariables(final String prefix) { return SphereClientConfigUtils.ofEnvironmentVariables(prefix, System::getenv); } SphereClientConfig(final String projectKey, final String clientId, final String clientSecret, final String authUrl, final String apiUrl, final List<String> scopes, final CorrelationIdGenerator correlationIdGenerator); static SphereClientConfig of(final String projectKey, final String clientId, final String clientSecret); static SphereClientConfig of(final String projectKey, final String clientId, final String clientSecret, final String authUrl, final String apiUrl); @Override String getApiUrl(); @Override String getAuthUrl(); @Override String getClientId(); @Override String getClientSecret(); @Override String getProjectKey(); @Override List<String> getScopes(); @Override List<String> getRawScopes(); SphereClientConfig withApiUrl(final String apiUrl); SphereClientConfig withAuthUrl(final String authUrl); static SphereClientConfig ofEnvironmentVariables(final String prefix); static SphereClientConfig ofProperties(final Properties properties, final String prefix); static final String ENVIRONMENT_VARIABLE_API_URL_SUFFIX; static final String ENVIRONMENT_VARIABLE_AUTH_URL_SUFFIX; static final String ENVIRONMENT_VARIABLE_PROJECT_KEY_SUFFIX; static final String ENVIRONMENT_VARIABLE_CLIENT_ID_SUFFIX; static final String ENVIRONMENT_VARIABLE_CLIENT_SECRET_SUFFIX; static final String ENVIRONMENT_VARIABLE_SCOPES_SUFFIX; static final String PROPERTIES_KEY_API_URL_SUFFIX; static final String PROPERTIES_KEY_AUTH_URL_SUFFIX; static final String PROPERTIES_KEY_PROJECT_KEY_SUFFIX; static final String PROPERTIES_KEY_CLIENT_ID_SUFFIX; static final String PROPERTIES_KEY_CLIENT_SECRET_SUFFIX; static final String PROPERTIES_KEY_SCOPES_SUFFIX; }### Answer:
@Test public void credentialsFromRaiseExceptionIfOneIsMissing() throws Exception { final String expectedMessage = "Missing environment variable 'foo_PROJECT_KEY'.\n" + "Usage:\n" + "export foo_PROJECT_KEY=\"YOUR project key\"\n" + "export foo_CLIENT_ID=\"YOUR client id\"\n" + "export foo_CLIENT_SECRET=\"YOUR client secret\"\n" + "#optional:\n" + "export foo_API_URL=\"https: "export foo_AUTH_URL=\"https: "export foo_SCOPES=\"manage_project\""; assertThatThrownBy(() -> SphereClientConfigUtils.ofEnvironmentVariables("foo", key -> null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(expectedMessage); }