NamedQueryManager { public String getQuery(String name) { if (!queryMap.containsKey(name)) { throw new IllegalArgumentException("Query with name " + name + " was not found in this persistence unit."); } return queryMap.get(name); }  void addNamedQuery(String name, String query); String getQuery(String name);  }
@Test public void retrievingUnknownQueryThrowsIllegalArgument() { final String name = "selectAll"; thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Query with name " + name + " was not found in this persistence unit."); queryManager.getQuery(name); }