@@ -58,7 +58,7 @@ void shouldSimulatePoliciesBlocked() {
5858 .willReturn (aResponse ()
5959 .withStatus (200 )
6060 .withHeader ("Content-Type" , "application/json" )
61- .withBody ("{\" success\" :true,\" data\" :{\" allowed\" :false,\" applied_policies\" :[\" block-pii\" ,\" block-financial\" ],\" risk_score\" :0.85,\" required_actions\" :[\" redact_pii\" ],\" processing_time_ms\" :12,\" total_policies\" :5,\" dry_run\" :true,\" simulated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" evaluation\" ,\" daily_usage\" :{\" used\" :3,\" limit\" :100, \" resets_at \" : \" 2026-03-25T00:00:00Z \" }}}" )));
61+ .withBody ("{\" success\" :true,\" data\" :{\" allowed\" :false,\" applied_policies\" :[\" block-pii\" ,\" block-financial\" ],\" risk_score\" :0.85,\" required_actions\" :[\" redact_pii\" ],\" processing_time_ms\" :12,\" total_policies\" :5,\" dry_run\" :true,\" simulated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" evaluation\" ,\" daily_usage\" :{\" used\" :3,\" limit\" :100}}}" )));
6262
6363 SimulatePoliciesResponse result = axonflow .simulatePolicies (
6464 SimulatePoliciesRequest .builder ()
@@ -79,7 +79,6 @@ void shouldSimulatePoliciesBlocked() {
7979 assertThat (result .getDailyUsage ()).isNotNull ();
8080 assertThat (result .getDailyUsage ().getUsed ()).isEqualTo (3 );
8181 assertThat (result .getDailyUsage ().getLimit ()).isEqualTo (100 );
82- assertThat (result .getDailyUsage ().getResetsAt ()).isEqualTo ("2026-03-25T00:00:00Z" );
8382
8483 verify (postRequestedFor (urlEqualTo ("/api/v1/policies/simulate" ))
8584 .withRequestBody (matchingJsonPath ("$.query" , equalTo ("My SSN is 123-45-6789" )))
@@ -93,7 +92,7 @@ void shouldSimulatePoliciesAllowed() {
9392 .willReturn (aResponse ()
9493 .withStatus (200 )
9594 .withHeader ("Content-Type" , "application/json" )
96- .withBody ("{\" success\" :true,\" data\" :{\" allowed\" :true,\" applied_policies\" :[],\" risk_score\" :0.1,\" required_actions\" :[],\" processing_time_ms\" :5,\" total_policies\" :5,\" dry_run\" :true,\" simulated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" evaluation\" ,\" daily_usage\" :{\" used\" :1,\" limit\" :100, \" resets_at \" : \" 2026-03-25T00:00:00Z \" }}}" )));
95+ .withBody ("{\" success\" :true,\" data\" :{\" allowed\" :true,\" applied_policies\" :[],\" risk_score\" :0.1,\" required_actions\" :[],\" processing_time_ms\" :5,\" total_policies\" :5,\" dry_run\" :true,\" simulated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" evaluation\" ,\" daily_usage\" :{\" used\" :1,\" limit\" :100}}}" )));
9796
9897 SimulatePoliciesResponse result = axonflow .simulatePolicies (
9998 SimulatePoliciesRequest .builder ()
@@ -213,7 +212,7 @@ void shouldGetPolicyImpactReport() {
213212 .willReturn (aResponse ()
214213 .withStatus (200 )
215214 .withHeader ("Content-Type" , "application/json" )
216- .withBody ("{\" success\" :true,\" data\" :{\" policy_id\" :\" policy_block_pii\" ,\" total_inputs\" :3,\" matched\" :2,\" blocked\" :2,\" match_rate\" :0.667,\" block_rate\" :0.667,\" results\" :[{\" query \" :\" My SSN is 123-45-6789 \" ,\" matched\" :true,\" blocked\" :true,\" action \" :\" block\" },{\" query \" :\" What is the weather? \" ,\" matched\" :false,\" blocked\" :false,\" action \" :\" allow\" },{\" query \" :\" My email is test@example.com \" ,\" matched\" :true,\" blocked\" :true,\" action \" :\" block\" }],\" processing_time_ms\" :25,\" generated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" evaluation\" }}" )));
215+ .withBody ("{\" success\" :true,\" data\" :{\" policy_id\" :\" policy_block_pii\" ,\" policy_name \" : \" block-pii \" , \" total_inputs\" :3,\" matched\" :2,\" blocked\" :2,\" match_rate\" :0.667,\" block_rate\" :0.667,\" results\" :[{\" input_index \" :0 ,\" matched\" :true,\" blocked\" :true,\" actions \" :[ \" block\" ] },{\" input_index \" :1 ,\" matched\" :false,\" blocked\" :false,\" actions \" :[ \" allow\" ] },{\" input_index \" :2 ,\" matched\" :true,\" blocked\" :true,\" actions \" :[ \" block\" ] }],\" processing_time_ms\" :25,\" generated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" evaluation\" }}" )));
217216
218217 ImpactReportResponse report = axonflow .getPolicyImpactReport (
219218 ImpactReportRequest .builder ()
@@ -231,13 +230,15 @@ void shouldGetPolicyImpactReport() {
231230 assertThat (report .getBlocked ()).isEqualTo (2 );
232231 assertThat (report .getMatchRate ()).isEqualTo (0.667 );
233232 assertThat (report .getBlockRate ()).isEqualTo (0.667 );
233+ assertThat (report .getPolicyName ()).isEqualTo ("block-pii" );
234234 assertThat (report .getResults ()).hasSize (3 );
235- assertThat (report .getResults ().get (0 ).getQuery ()).isEqualTo ("My SSN is 123-45-6789" );
235+ assertThat (report .getResults ().get (0 ).getInputIndex ()).isEqualTo (0 );
236236 assertThat (report .getResults ().get (0 ).isMatched ()).isTrue ();
237237 assertThat (report .getResults ().get (0 ).isBlocked ()).isTrue ();
238- assertThat (report .getResults ().get (0 ).getAction ()).isEqualTo ("block" );
238+ assertThat (report .getResults ().get (0 ).getActions ()).containsExactly ("block" );
239+ assertThat (report .getResults ().get (1 ).getInputIndex ()).isEqualTo (1 );
239240 assertThat (report .getResults ().get (1 ).isMatched ()).isFalse ();
240- assertThat (report .getResults ().get (1 ).getAction ()).isEqualTo ("allow" );
241+ assertThat (report .getResults ().get (1 ).getActions ()).containsExactly ("allow" );
241242 assertThat (report .getProcessingTimeMs ()).isEqualTo (25 );
242243 assertThat (report .getGeneratedAt ()).isEqualTo ("2026-03-24T10:00:00Z" );
243244 assertThat (report .getTier ()).isEqualTo ("evaluation" );
@@ -253,7 +254,7 @@ void shouldGetImpactReportNoMatches() {
253254 .willReturn (aResponse ()
254255 .withStatus (200 )
255256 .withHeader ("Content-Type" , "application/json" )
256- .withBody ("{\" success\" :true,\" data\" :{\" policy_id\" :\" policy_strict\" ,\" total_inputs\" :1,\" matched\" :0,\" blocked\" :0,\" match_rate\" :0.0,\" block_rate\" :0.0,\" results\" :[{\" query \" :\" Hello world \" ,\" matched\" :false,\" blocked\" :false,\" action \" :\" allow\" }],\" processing_time_ms\" :3,\" generated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" enterprise\" }}" )));
257+ .withBody ("{\" success\" :true,\" data\" :{\" policy_id\" :\" policy_strict\" ,\" total_inputs\" :1,\" matched\" :0,\" blocked\" :0,\" match_rate\" :0.0,\" block_rate\" :0.0,\" results\" :[{\" input_index \" :0 ,\" matched\" :false,\" blocked\" :false,\" actions \" :[ \" allow\" ] }],\" processing_time_ms\" :3,\" generated_at\" :\" 2026-03-24T10:00:00Z\" ,\" tier\" :\" enterprise\" }}" )));
257258
258259 ImpactReportResponse report = axonflow .getPolicyImpactReport (
259260 ImpactReportRequest .builder ()
0 commit comments