@Test public void shouldGetSellerCredentials() throws Exception { when(System.getProperty("pagseguro.email")).thenReturn("email"); when(System.getProperty("pagseguro.token")).thenReturn("token"); Credential expectedCredential = Credential.sellerCredential("email", "token"); Credential credential = provider.getCredential(); assertEquals(expectedCredential, credential); }
@Override public Credential getCredential() { LOGGER.info("Lendo credenciais"); final Credential credential; if (System.getProperty("pagseguro.email") != null && System.getProperty("pagseguro.token") != null) { credential = Credential.sellerCredential(System.getProperty("pagseguro.email").trim(), System.getProperty("pagseguro.token").trim()); } else if (System.getProperty("pagseguro.appId") != null && System.getProperty("pagseguro.appKey") != null) { credential = Credential.applicationCredential(System.getProperty("pagseguro.appId").trim(), System.getProperty("pagseguro.appKey").trim()); } else { throw new IllegalArgumentException("Seller credential and Application credential not found"); } LOGGER.info("Credenciais lidas"); return credential; }
JVMEnvVariableCredentialProvider implements CredentialProvider { @Override public Credential getCredential() { LOGGER.info("Lendo credenciais"); final Credential credential; if (System.getProperty("pagseguro.email") != null && System.getProperty("pagseguro.token") != null) { credential = Credential.sellerCredential(System.getProperty("pagseguro.email").trim(), System.getProperty("pagseguro.token").trim()); } else if (System.getProperty("pagseguro.appId") != null && System.getProperty("pagseguro.appKey") != null) { credential = Credential.applicationCredential(System.getProperty("pagseguro.appId").trim(), System.getProperty("pagseguro.appKey").trim()); } else { throw new IllegalArgumentException("Seller credential and Application credential not found"); } LOGGER.info("Credenciais lidas"); return credential; } }
JVMEnvVariableCredentialProvider implements CredentialProvider { @Override public Credential getCredential() { LOGGER.info("Lendo credenciais"); final Credential credential; if (System.getProperty("pagseguro.email") != null && System.getProperty("pagseguro.token") != null) { credential = Credential.sellerCredential(System.getProperty("pagseguro.email").trim(), System.getProperty("pagseguro.token").trim()); } else if (System.getProperty("pagseguro.appId") != null && System.getProperty("pagseguro.appKey") != null) { credential = Credential.applicationCredential(System.getProperty("pagseguro.appId").trim(), System.getProperty("pagseguro.appKey").trim()); } else { throw new IllegalArgumentException("Seller credential and Application credential not found"); } LOGGER.info("Credenciais lidas"); return credential; } JVMEnvVariableCredentialProvider(); }
JVMEnvVariableCredentialProvider implements CredentialProvider { @Override public Credential getCredential() { LOGGER.info("Lendo credenciais"); final Credential credential; if (System.getProperty("pagseguro.email") != null && System.getProperty("pagseguro.token") != null) { credential = Credential.sellerCredential(System.getProperty("pagseguro.email").trim(), System.getProperty("pagseguro.token").trim()); } else if (System.getProperty("pagseguro.appId") != null && System.getProperty("pagseguro.appKey") != null) { credential = Credential.applicationCredential(System.getProperty("pagseguro.appId").trim(), System.getProperty("pagseguro.appKey").trim()); } else { throw new IllegalArgumentException("Seller credential and Application credential not found"); } LOGGER.info("Credenciais lidas"); return credential; } JVMEnvVariableCredentialProvider(); @Override Credential getCredential(); }
JVMEnvVariableCredentialProvider implements CredentialProvider { @Override public Credential getCredential() { LOGGER.info("Lendo credenciais"); final Credential credential; if (System.getProperty("pagseguro.email") != null && System.getProperty("pagseguro.token") != null) { credential = Credential.sellerCredential(System.getProperty("pagseguro.email").trim(), System.getProperty("pagseguro.token").trim()); } else if (System.getProperty("pagseguro.appId") != null && System.getProperty("pagseguro.appKey") != null) { credential = Credential.applicationCredential(System.getProperty("pagseguro.appId").trim(), System.getProperty("pagseguro.appKey").trim()); } else { throw new IllegalArgumentException("Seller credential and Application credential not found"); } LOGGER.info("Credenciais lidas"); return credential; } JVMEnvVariableCredentialProvider(); @Override Credential getCredential();  }