### Question:
FHIRExtractors { public static String getPatientMBI(Patient patient) { String identifier = findMatchingIdentifier(patient.getIdentifier(), DPCIdentifierSystem.MBI).getValue(); Pattern mbiPattern = Pattern.compile(PatientEntity.MBI_FORMAT); if (mbiPattern.matcher(identifier).matches()) { return identifier; } logger.error("Invalid MBI"); throw new IllegalArgumentException("Patient Identifier for system " + DPCIdentifierSystem.MBI.getSystem() + " must match MBI format"); } private  FHIRExtractors(); static String getProviderNPI(Practitioner provider); static String getPatientMBI(Patient patient); static String getPatientBeneId(Patient patient); static UUID getEntityUUID(String idString); static Provenance.ProvenanceAgentComponent getProvenancePerformer(Provenance provenance); static Identifier parseIDFromQueryParam(String queryParam); static Pair<String, String> parseTag(String tag); static Identifier findMatchingIdentifier(List<Identifier> identifiers, DPCIdentifierSystem system); static String getOrganizationID(IBaseResource resource); static String getAttributedNPI(Group group);  }### Answer:
@Test void testPatientMultipleIDs() { final Patient patient = new Patient(); patient.addIdentifier().setSystem(DPCIdentifierSystem.fromString(DPCIdentifierSystem.DPC.getSystem()).getSystem()).setValue("test-dpc-one"); patient.addIdentifier().setSystem(DPCIdentifierSystem.MBI.getSystem()).setValue("0A00A00AA01"); assertEquals("0A00A00AA01", getPatientMBI(patient), "Should have MBI"); }
@Test void testPatientNoID() { final Patient patient = new Patient(); final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> getPatientMBI(patient), "Should not have patient MBI"); assertEquals(String.format(MISSING_ID_FMT, DPCIdentifierSystem.MBI.getSystem()), exception.getMessage(), "Should have correct exception message"); }