@@ -207,23 +207,29 @@ void testDnsValidator_prepare_InvalidDnsPreparation(String domain, DnsType dnsTy
207207
208208 @ Test
209209 void testDnsValidator_validate_dnssec_dnskey_missing () {
210- MpicDetails getMpicDetails = new MpicDetails (true ,
210+ DnssecDetails expectedDnssecDetails = new DnssecDetails (DnssecStatus .INSECURE , DnssecError .DNSKEY_MISSING , null , "no SEP matching the DS found" );
211+ MpicDetails mpicDetails = new MpicDetails (true ,
211212 "primary-agent" ,
212213 3 ,
213214 3 ,
214- new DnssecDetails ( DnssecStatus . INSECURE , DnssecError . DNSKEY_MISSING , null , "no SEP matching the DS found" ) ,
215+ expectedDnssecDetails ,
215216 Map .of ("secondary-agent-id" , true ), null );
216- DnsValidationResponse dnsValidationResponse = new DnsValidationResponse (false , getMpicDetails , domain , domain ,
217+ DnsValidationResponse dnsValidationResponse = new DnsValidationResponse (false , mpicDetails , domain , domain ,
217218 dnsType , randomValue , null , Set .of (DcvError .DNS_LOOKUP_DNSSEC_FAILURE ));
218219
219220 when (dnsValidationHandler .validate (any (DnsValidationRequest .class ))).thenReturn (dnsValidationResponse );
220221
221222 ValidationException exception = assertThrows (ValidationException .class , () -> dnsValidator .validate (dnsValidationRequest ));
222223
223- assertEquals (1 , exception .getErrors ().size (), "Expected exactly one error " );
224+ assertEquals (1 , exception .getErrors ().size (), "Expected exactly one error" );
224225 assertTrue (exception .getErrors ().contains (DcvError .DNS_LOOKUP_DNSSEC_FAILURE ), "expected: " + DcvError .DNS_LOOKUP_DNSSEC_FAILURE + " but got: " + exception .getErrors ());
226+ assertNotNull (exception .getDnssecDetails (), "DNSSEC details should be present in the exception" );
227+ assertEquals (expectedDnssecDetails , exception .getDnssecDetails (), "DNSSEC details should match the response" );
228+ assertEquals (DnssecStatus .INSECURE , exception .getDnssecDetails ().dnssecStatus ());
229+ assertEquals (DnssecError .DNSKEY_MISSING , exception .getDnssecDetails ().dnssecError ());
225230 }
226231
232+
227233 private static MpicDetails getMpicDetails () {
228234 return new MpicDetails (true ,
229235 "primary-agent" ,
0 commit comments