@Test(expected = RuntimeException.class) public void returnErrorGettingUser() throws Exception{ JCredStash jCredStash = new JCredStash(); AWSSecurityTokenService awsSecurityTokenService = spy(AWSSecurityTokenService.class); GetCallerIdentityResult callerIdentityResult = new GetCallerIdentityResult(); callerIdentityResult.setArn("arn:aws:sts::123456789876:assumed-role/private_aws_application_dev/L25000"); doReturn(callerIdentityResult).when(awsSecurityTokenService).getCallerIdentity(anyObject()); String user = jCredStash.getUpdatedBy(); assert(user).equals("errorGettingUser"); }
protected String getUpdatedBy() throws Exception { try { return awsSecurityTokenService.getCallerIdentity(new GetCallerIdentityRequest()).getArn(); } catch(Exception e){ throw new RuntimeException("Error getting user"); } }
JCredStash { protected String getUpdatedBy() throws Exception { try { return awsSecurityTokenService.getCallerIdentity(new GetCallerIdentityRequest()).getArn(); } catch(Exception e){ throw new RuntimeException("Error getting user"); } } }
JCredStash { protected String getUpdatedBy() throws Exception { try { return awsSecurityTokenService.getCallerIdentity(new GetCallerIdentityRequest()).getArn(); } catch(Exception e){ throw new RuntimeException("Error getting user"); } } protected  JCredStash(); protected  JCredStash(AWSCredentialsProvider awsCredentialsProvider); protected  JCredStash(AmazonDynamoDB amazonDynamoDBClient, AWSKMS awskmsClient); protected  JCredStash(AmazonDynamoDB amazonDynamoDBClient, AWSKMS awskmsClient, AWSSecurityTokenService awsSecurityTokenService); }
JCredStash { protected String getUpdatedBy() throws Exception { try { return awsSecurityTokenService.getCallerIdentity(new GetCallerIdentityRequest()).getArn(); } catch(Exception e){ throw new RuntimeException("Error getting user"); } } protected  JCredStash(); protected  JCredStash(AWSCredentialsProvider awsCredentialsProvider); protected  JCredStash(AmazonDynamoDB amazonDynamoDBClient, AWSKMS awskmsClient); protected  JCredStash(AmazonDynamoDB amazonDynamoDBClient, AWSKMS awskmsClient, AWSSecurityTokenService awsSecurityTokenService);  }
JCredStash { protected String getUpdatedBy() throws Exception { try { return awsSecurityTokenService.getCallerIdentity(new GetCallerIdentityRequest()).getArn(); } catch(Exception e){ throw new RuntimeException("Error getting user"); } } protected  JCredStash(); protected  JCredStash(AWSCredentialsProvider awsCredentialsProvider); protected  JCredStash(AmazonDynamoDB amazonDynamoDBClient, AWSKMS awskmsClient); protected  JCredStash(AmazonDynamoDB amazonDynamoDBClient, AWSKMS awskmsClient, AWSSecurityTokenService awsSecurityTokenService);   }