From 83863777a14dc746372fbc7a060fc248008a0cbe Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Fri, 1 Nov 2024 09:17:42 -0700 Subject: [PATCH] Jira Service Test coverage Signed-off-by: Maxwell Brown --- .../dataprepper/plugins/source/jira/JiraServiceTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data-prepper-plugins/saas-source-plugins/jira-source/src/test/java/org/opensearch/dataprepper/plugins/source/jira/JiraServiceTest.java b/data-prepper-plugins/saas-source-plugins/jira-source/src/test/java/org/opensearch/dataprepper/plugins/source/jira/JiraServiceTest.java index c4cc6cab31..4ecb6cb054 100644 --- a/data-prepper-plugins/saas-source-plugins/jira-source/src/test/java/org/opensearch/dataprepper/plugins/source/jira/JiraServiceTest.java +++ b/data-prepper-plugins/saas-source-plugins/jira-source/src/test/java/org/opensearch/dataprepper/plugins/source/jira/JiraServiceTest.java @@ -101,7 +101,8 @@ private static Stream provideHttpStatusCodesWithExceptionClass() { return Stream.of( Arguments.of(HttpStatus.valueOf(AUTHORIZATION_ERROR_CODE), UnAuthorizedException.class), Arguments.of(HttpStatus.valueOf(TOKEN_EXPIRED), RuntimeException.class), - Arguments.of(HttpStatus.TOO_MANY_REQUESTS, RuntimeException.class) + Arguments.of(HttpStatus.TOO_MANY_REQUESTS, RuntimeException.class), + Arguments.of(HttpStatus.INSUFFICIENT_STORAGE, RuntimeException.class) ); } @@ -264,7 +265,7 @@ void testInvokeRestApiTokenExpiredInterruptException() throws JsonProcessingExce JiraSourceConfig jiraSourceConfig = createJiraConfiguration(BASIC, issueType, issueStatus, projectKey); JiraService jiraService = new JiraService(restTemplate, jiraSourceConfig, authConfig); when(authConfig.getUrl()).thenReturn("https://example.com/rest/api/2/issue/key"); - doReturn(new ResponseEntity<>("", HttpStatus.UNAUTHORIZED)).when(restTemplate).getForEntity(any(URI.class), any(Class.class)); + when(restTemplate.getForEntity(any(URI.class), any(Class.class))).thenThrow(new HttpClientErrorException(HttpStatus.TOO_MANY_REQUESTS)); jiraService.setSleepTimeMultiplier(100000); Thread testThread = new Thread(() -> {