@Test public void shouldNotReturnNullWhileFindByName() throws Exception { final String name = "myName"; try { fireflyExtensionRepository.findByName(name); fail(); } catch (FireflyExtensionRepository.FireflyExtensionNotFoundException e) { assertEquals(name, e.getName()); } }
public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyExtensionModel.PK + "} " + "FROM {" + FireflyExtensionModel._TYPECODE + "} " + "WHERE {" + FireflyExtensionModel.NAME + "} = ?name"); query.addQueryParameter("name", name); try { return searchService.searchUnique(query); } catch (FlexibleSearchException e) { throw new FireflyNotInstalledException(e); } catch (ModelNotFoundException e) { throw new FireflyExtensionNotFoundException(name); } }
FireflyExtensionRepository { public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyExtensionModel.PK + "} " + "FROM {" + FireflyExtensionModel._TYPECODE + "} " + "WHERE {" + FireflyExtensionModel.NAME + "} = ?name"); query.addQueryParameter("name", name); try { return searchService.searchUnique(query); } catch (FlexibleSearchException e) { throw new FireflyNotInstalledException(e); } catch (ModelNotFoundException e) { throw new FireflyExtensionNotFoundException(name); } } }
FireflyExtensionRepository { public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyExtensionModel.PK + "} " + "FROM {" + FireflyExtensionModel._TYPECODE + "} " + "WHERE {" + FireflyExtensionModel.NAME + "} = ?name"); query.addQueryParameter("name", name); try { return searchService.searchUnique(query); } catch (FlexibleSearchException e) { throw new FireflyNotInstalledException(e); } catch (ModelNotFoundException e) { throw new FireflyExtensionNotFoundException(name); } }  }
FireflyExtensionRepository { public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyExtensionModel.PK + "} " + "FROM {" + FireflyExtensionModel._TYPECODE + "} " + "WHERE {" + FireflyExtensionModel.NAME + "} = ?name"); query.addQueryParameter("name", name); try { return searchService.searchUnique(query); } catch (FlexibleSearchException e) { throw new FireflyNotInstalledException(e); } catch (ModelNotFoundException e) { throw new FireflyExtensionNotFoundException(name); } }  FireflyExtensionModel findByName(String name); FireflyExtensionModel create(String name); void save(FireflyExtensionModel model); }
FireflyExtensionRepository { public FireflyExtensionModel findByName(String name) throws FireflyExtensionNotFoundException, FireflyNotInstalledException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyExtensionModel.PK + "} " + "FROM {" + FireflyExtensionModel._TYPECODE + "} " + "WHERE {" + FireflyExtensionModel.NAME + "} = ?name"); query.addQueryParameter("name", name); try { return searchService.searchUnique(query); } catch (FlexibleSearchException e) { throw new FireflyNotInstalledException(e); } catch (ModelNotFoundException e) { throw new FireflyExtensionNotFoundException(name); } }  FireflyExtensionModel findByName(String name); FireflyExtensionModel create(String name); void save(FireflyExtensionModel model);  }