Skip to content

Commit 1bc12ae

Browse files
fix test
1 parent ba8a52c commit 1bc12ae

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/test/java/com/mindee/workflow/WorkflowTest.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void givenAWorkflowMockFileShouldReturnAValidWorkflowObject()
5959
.thenReturn(workflowResponse);
6060

6161
WorkflowResponse<GeneratedV1> execution = client.executeWorkflow(
62+
GeneratedV1.class,
6263
"",
6364
new LocalInputSource(file)
6465
);
@@ -74,14 +75,17 @@ void sendingADocumentToAnExecutionShouldDeserializeResponseCorrectly() throws IO
7475
WorkflowResponse.Default mockResponse =
7576
objectMapper.readValue(jsonFile, WorkflowResponse.Default.class);
7677

77-
when(mockedClient.executeWorkflow(Mockito.anyString(), Mockito.any(LocalInputSource.class)))
78+
when(mockedClient.executeWorkflow(GeneratedV1.class, Mockito.anyString(),
79+
Mockito.any(LocalInputSource.class)
80+
))
7881
.thenReturn(mockResponse);
7982

8083
String workflowId = "07ebf237-ff27-4eee-b6a2-425df4a5cca6";
8184
String filePath = "src/test/resources/products/financial_document/default_sample.jpg";
8285
LocalInputSource inputSource = new LocalInputSource(filePath);
8386

84-
WorkflowResponse<GeneratedV1> response = mockedClient.executeWorkflow(workflowId, inputSource);
87+
WorkflowResponse<GeneratedV1> response =
88+
mockedClient.executeWorkflow(GeneratedV1.class, workflowId, inputSource);
8589

8690
Assertions.assertNotNull(response);
8791
Assertions.assertNotNull(response.getApiRequest());
@@ -102,30 +106,35 @@ void sendingADocumentToAnExecutionShouldDeserializeResponseCorrectly() throws IO
102106
Assertions.assertEquals(
103107
workflowId, response.getExecution().getWorkflowId());
104108

105-
Mockito.verify(mockedClient).executeWorkflow(workflowId, inputSource);
109+
Mockito.verify(mockedClient).executeWorkflow(GeneratedV1.class, workflowId, inputSource);
106110
}
107111

108112

109113
@Test
110-
void sendingADocumentToAnExecutionWithPriorityAndAliasShouldDeserializeResponseCorrectly() throws IOException {
114+
void sendingADocumentToAnExecutionWithPriorityAndAliasShouldDeserializeResponseCorrectly()
115+
throws IOException {
111116
File jsonFile = new File("src/test/resources/workflows/success_low_priority.json");
112117
WorkflowResponse.Default mockResponse =
113118
objectMapper.readValue(jsonFile, WorkflowResponse.Default.class);
114119

115-
when(mockedClient.executeWorkflow(Mockito.anyString(), Mockito.any(LocalInputSource.class)))
120+
when(mockedClient.executeWorkflow(GeneratedV1.class, Mockito.anyString(),
121+
Mockito.any(LocalInputSource.class)
122+
))
116123
.thenReturn(mockResponse);
117124

118125
String workflowId = "07ebf237-ff27-4eee-b6a2-425df4a5cca6";
119126
String filePath = "src/test/resources/products/financial_document/default_sample.jpg";
120127
LocalInputSource inputSource = new LocalInputSource(filePath);
121128

122-
WorkflowResponse<GeneratedV1> response = mockedClient.executeWorkflow(workflowId, inputSource);
129+
WorkflowResponse<GeneratedV1> response =
130+
mockedClient.executeWorkflow(GeneratedV1.class, workflowId, inputSource);
123131

124132
Assertions.assertNotNull(response);
125133
Assertions.assertNotNull(response.getApiRequest());
126134
Assertions.assertNull(response.getExecution().getBatchName());
127135
Assertions.assertNull(response.getExecution().getCreatedAt());
128-
Assertions.assertEquals("low-priority-sample-test", response.getExecution().getFile().getAlias());
136+
Assertions.assertEquals(
137+
"low-priority-sample-test", response.getExecution().getFile().getAlias());
129138
Assertions.assertEquals("default_sample.jpg", response.getExecution().getFile().getName());
130139
Assertions.assertEquals(
131140
"b743e123-e18c-4b62-8a07-811a4f72afd3", response.getExecution().getId());
@@ -140,7 +149,7 @@ void sendingADocumentToAnExecutionWithPriorityAndAliasShouldDeserializeResponseC
140149
Assertions.assertEquals(
141150
workflowId, response.getExecution().getWorkflowId());
142151

143-
Mockito.verify(mockedClient).executeWorkflow(workflowId, inputSource);
152+
Mockito.verify(mockedClient).executeWorkflow(GeneratedV1.class, workflowId, inputSource);
144153
}
145154

146155
}

0 commit comments

Comments
 (0)