@Test(expected = ChangeRepository.ChangeNotFoundException.class) public void shouldNotFindChange() throws Exception { changeRepository.findChange("firefly-junit-file", "firefly-junit", "4711"); }
public FireflyChangeModel findChange(String file, String author, String id) throws ChangeNotFoundException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyChangeModel.PK + "} " + "FROM {" + FireflyChangeModel._TYPECODE + "} " + "WHERE {" + FireflyChangeModel.FILENAME + "} = ?file" + " AND {" + FireflyChangeModel.AUTHOR + "} = ?author" + " AND {" + FireflyChangeModel.ID + "} = ?id"); query.addQueryParameter("file", file); query.addQueryParameter("author", author); query.addQueryParameter("id", id); try { return searchService.searchUnique(query); } catch (ModelNotFoundException e) { throw new ChangeNotFoundException(file, author, id); } }
ChangeRepository { public FireflyChangeModel findChange(String file, String author, String id) throws ChangeNotFoundException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyChangeModel.PK + "} " + "FROM {" + FireflyChangeModel._TYPECODE + "} " + "WHERE {" + FireflyChangeModel.FILENAME + "} = ?file" + " AND {" + FireflyChangeModel.AUTHOR + "} = ?author" + " AND {" + FireflyChangeModel.ID + "} = ?id"); query.addQueryParameter("file", file); query.addQueryParameter("author", author); query.addQueryParameter("id", id); try { return searchService.searchUnique(query); } catch (ModelNotFoundException e) { throw new ChangeNotFoundException(file, author, id); } } }
ChangeRepository { public FireflyChangeModel findChange(String file, String author, String id) throws ChangeNotFoundException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyChangeModel.PK + "} " + "FROM {" + FireflyChangeModel._TYPECODE + "} " + "WHERE {" + FireflyChangeModel.FILENAME + "} = ?file" + " AND {" + FireflyChangeModel.AUTHOR + "} = ?author" + " AND {" + FireflyChangeModel.ID + "} = ?id"); query.addQueryParameter("file", file); query.addQueryParameter("author", author); query.addQueryParameter("id", id); try { return searchService.searchUnique(query); } catch (ModelNotFoundException e) { throw new ChangeNotFoundException(file, author, id); } }  }
ChangeRepository { public FireflyChangeModel findChange(String file, String author, String id) throws ChangeNotFoundException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyChangeModel.PK + "} " + "FROM {" + FireflyChangeModel._TYPECODE + "} " + "WHERE {" + FireflyChangeModel.FILENAME + "} = ?file" + " AND {" + FireflyChangeModel.AUTHOR + "} = ?author" + " AND {" + FireflyChangeModel.ID + "} = ?id"); query.addQueryParameter("file", file); query.addQueryParameter("author", author); query.addQueryParameter("id", id); try { return searchService.searchUnique(query); } catch (ModelNotFoundException e) { throw new ChangeNotFoundException(file, author, id); } }  FireflyChangeModel findChange(String file, String author, String id); FireflyChangeModel create(FireflyMigrationModel migration, FireflyExtensionModel extension, String file, String author, String id); void save(FireflyChangeModel changeModel); }
ChangeRepository { public FireflyChangeModel findChange(String file, String author, String id) throws ChangeNotFoundException { final FlexibleSearchQuery query = new FlexibleSearchQuery( "SELECT {" + FireflyChangeModel.PK + "} " + "FROM {" + FireflyChangeModel._TYPECODE + "} " + "WHERE {" + FireflyChangeModel.FILENAME + "} = ?file" + " AND {" + FireflyChangeModel.AUTHOR + "} = ?author" + " AND {" + FireflyChangeModel.ID + "} = ?id"); query.addQueryParameter("file", file); query.addQueryParameter("author", author); query.addQueryParameter("id", id); try { return searchService.searchUnique(query); } catch (ModelNotFoundException e) { throw new ChangeNotFoundException(file, author, id); } }  FireflyChangeModel findChange(String file, String author, String id); FireflyChangeModel create(FireflyMigrationModel migration, FireflyExtensionModel extension, String file, String author, String id); void save(FireflyChangeModel changeModel);  }