@Test public void testHandleAmazonExceptionWithBadRequestException() { try { AmazonServiceException amazonServiceException = new AmazonServiceException(ERROR_MESSAGE); amazonServiceException.setStatusCode(HttpStatus.SC_BAD_REQUEST); awsServiceHelper.handleAmazonException(amazonServiceException, MESSAGE_TEXT); fail(); } catch (IllegalArgumentException illegalArgumentException) { assertThat("Error message not correct.", illegalArgumentException.getMessage().contains(MESSAGE_TEXT), is(true)); } }
@Test public void testHandleAmazonException() { try { AmazonServiceException amazonServiceException = new AmazonServiceException(ERROR_MESSAGE); awsServiceHelper.handleAmazonException(amazonServiceException, MESSAGE_TEXT); fail(); } catch (AmazonServiceException amazonServiceException) { assertThat("Error message not correct.", amazonServiceException.getMessage().contains(ERROR_MESSAGE), is(true)); } }
@Test public void testHandleAmazonExceptionWithNotFoundException() { try { AmazonServiceException amazonServiceException = new AmazonServiceException(ERROR_MESSAGE); amazonServiceException.setStatusCode(HttpStatus.SC_NOT_FOUND); awsServiceHelper.handleAmazonException(amazonServiceException, MESSAGE_TEXT); fail(); } catch (ObjectNotFoundException objectNotFoundException) { assertThat("Error message not correct.", objectNotFoundException.getMessage().contains(MESSAGE_TEXT), is(true)); } } }
verify(emrDao).createEmrCluster(EMR_CLUSTER_NAME, emrClusterDefinition, awsParamsDto); verify(awsServiceHelper) .handleAmazonException(amazonServiceException, "An Amazon exception occurred while creating EMR cluster with name \"" + EMR_CLUSTER_NAME + "\"."); verifyNoMoreInteractionsHelper();
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while getting EMR cluster details with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while getting EMR cluster details with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while creating EMR cluster with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while creating EMR cluster with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while adding EMR step \"" + stepHelper.getRequestStepName(request) + "\" to cluster with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while adding EMR step \"" + stepHelper.getRequestStepName(request) + "\" to cluster with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while terminating EMR cluster with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while terminating EMR cluster with name \"" + clusterName + "\".");
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while adding EMR security groups: " + herdStringHelper.buildStringWithDefaultDelimiter(request.getSecurityGroupIds()) + " to cluster: " + clusterName);
awsServiceHelper.handleAmazonException(ex, "An Amazon exception occurred while adding EMR security groups: " + herdStringHelper.buildStringWithDefaultDelimiter(request.getSecurityGroupIds()) + " to cluster: " + clusterName);