### Question:
PatientSearchCriteria { String[] getQueryParts(String query) { if (query == null) { throw new IllegalArgumentException("query must not be null"); } query = query.replace(",", " "); String[] queryPartArray = query.split(" "); List<String> queryPartList = new ArrayList<>(); for (String queryPart : queryPartArray) { if (queryPart.trim().length() > 0) { queryPartList.add(queryPart); } } return queryPartList.toArray(new String[0]); } PatientSearchCriteria(SessionFactory sessionFactory, Criteria criteria); Criteria prepareCriteria(String name, String identifier, List<PatientIdentifierType> identifierTypes,
	        boolean matchIdentifierExactly, boolean orderByNames, boolean searchOnNamesOrIdentifiers);  }### Answer:
@Test public void getQueryParts_shouldProcessSimpleSpaceAsSeparator() { String[] actual = patientSearchCriteria.getQueryParts("Anton Bert Charles"); String[] expected = { "Anton", "Bert", "Charles" }; Assert.assertArrayEquals(expected, actual); }
@Test public void getQueryParts_shouldProcessCommaAsSeparator() { String[] actual = patientSearchCriteria.getQueryParts("Anton,Bert,Charles"); String[] expected = { "Anton", "Bert", "Charles" }; Assert.assertArrayEquals(expected, actual); }
@Test public void getQueryParts_shouldProcessMixedSeparators() { String[] actual = patientSearchCriteria.getQueryParts("Anton,Bert, Charles Dorian Ernie"); String[] expected = { "Anton", "Bert", "Charles", "Dorian", "Ernie" }; Assert.assertArrayEquals(expected, actual); }
@Test public void getQueryParts_shouldNotReturnEmptyNameParts() { String[] actual = patientSearchCriteria.getQueryParts(" Anton Bert Charles "); String[] expected = { "Anton", "Bert", "Charles" }; Assert.assertArrayEquals(expected, actual); }
@Test(expected = IllegalArgumentException.class) public void getQueryParts_shouldRejectNullAsName() { patientSearchCriteria.getQueryParts(null); }