@Test public void getIconSetNamesWhenException() throws Exception { QueryException exception = new QueryException("exception in the query", null, null); when(queryManager.createQuery(any(), eq(Query.XWQL))).thenThrow(exception); IconException caughtException = null; try { mocker.getComponentUnderTest().getIconSetNames(); } catch (IconException e) { caughtException = e; } assertNotNull(caughtException); assertEquals("Failed to get the name of all icon sets.", caughtException.getMessage()); assertEquals(exception, caughtException.getCause()); }
@Override public List<String> getIconSetNames() throws IconException { try { String xwql = "SELECT obj.name FROM Document doc, doc.object(IconThemesCode.IconThemeClass) obj " + "ORDER BY obj.name"; Query query = queryManager.createQuery(xwql, Query.XWQL); return query.execute(); } catch (QueryException e) { throw new IconException("Failed to get the name of all icon sets.", e); } }
DefaultIconSetManager implements IconSetManager { @Override public List<String> getIconSetNames() throws IconException { try { String xwql = "SELECT obj.name FROM Document doc, doc.object(IconThemesCode.IconThemeClass) obj " + "ORDER BY obj.name"; Query query = queryManager.createQuery(xwql, Query.XWQL); return query.execute(); } catch (QueryException e) { throw new IconException("Failed to get the name of all icon sets.", e); } } }
DefaultIconSetManager implements IconSetManager { @Override public List<String> getIconSetNames() throws IconException { try { String xwql = "SELECT obj.name FROM Document doc, doc.object(IconThemesCode.IconThemeClass) obj " + "ORDER BY obj.name"; Query query = queryManager.createQuery(xwql, Query.XWQL); return query.execute(); } catch (QueryException e) { throw new IconException("Failed to get the name of all icon sets.", e); } }  }
DefaultIconSetManager implements IconSetManager { @Override public List<String> getIconSetNames() throws IconException { try { String xwql = "SELECT obj.name FROM Document doc, doc.object(IconThemesCode.IconThemeClass) obj " + "ORDER BY obj.name"; Query query = queryManager.createQuery(xwql, Query.XWQL); return query.execute(); } catch (QueryException e) { throw new IconException("Failed to get the name of all icon sets.", e); } }  @Override IconSet getCurrentIconSet(); @Override IconSet getDefaultIconSet(); @Override IconSet getIconSet(String name); @Override List<String> getIconSetNames(); }
DefaultIconSetManager implements IconSetManager { @Override public List<String> getIconSetNames() throws IconException { try { String xwql = "SELECT obj.name FROM Document doc, doc.object(IconThemesCode.IconThemeClass) obj " + "ORDER BY obj.name"; Query query = queryManager.createQuery(xwql, Query.XWQL); return query.execute(); } catch (QueryException e) { throw new IconException("Failed to get the name of all icon sets.", e); } }  @Override IconSet getCurrentIconSet(); @Override IconSet getDefaultIconSet(); @Override IconSet getIconSet(String name); @Override List<String> getIconSetNames();  }