### Question:
FHIRExtractors { public static UUID getEntityUUID(String idString) { logger.trace("Extracting from Entity ID {}", idString); final int delimIndex = idString.indexOf('/'); if (delimIndex < 0) { return UUID.fromString(idString); } final Matcher matcher = idExtractor.matcher(idString); if (!matcher.find() || !(matcher.groupCount() == 1)) { throw new IllegalArgumentException(String.format(ENTITY_ID_ERROR, idString)); } try { final String id = Objects.requireNonNull(matcher.group(1)); return UUID.fromString(id); } catch (Exception e) { logger.error("Cannot extract ID from entity", e); throw new IllegalArgumentException(String.format(ENTITY_ID_ERROR, idString)); } } 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 testEntityIDExtraction() { final UUID uuid1 = UUID.randomUUID(); final IdType id1 = new IdType("Organization", uuid1.toString()); assertEquals(uuid1, getEntityUUID(id1.toString()), "Should have Org ID"); assertEquals(uuid1, getEntityUUID(uuid1.toString()), "Should parse UUID correctly"); assertEquals(uuid1, getEntityUUID(String.format("/%s", uuid1.toString())), "Should ignore leading slash"); assertEquals(uuid1, getEntityUUID(uuid1.toString()), "Should have org id"); final IdType idType = new IdType("Organization/not-a-uuid"); final IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> getEntityUUID(idType.toString()), "Should not parse non-UUID"); assertEquals(String.format(ENTITY_ID_ERROR, idType.toString()), exception.getMessage(), "Should have correct error message"); final IllegalArgumentException exception1 = assertThrows(IllegalArgumentException.class, () -> getEntityUUID("not-a-uuid"), "Should throw with non-uuid"); assertEquals("Invalid UUID string: not-a-uuid", exception1.getMessage(), "Should have correct exception message"); }