PairService { public void remove(String symbol, String providerCode) { var pe = pairRepo.findBySymbolAndProviderCode(symbol, providerCode); if(pe == null) { throw PairException.notFound(symbol, providerCode); } pairRepo.delete(pe); }  Pair getForCodeAndProvider(String code, String provider); Pair create(String code, String name, String source, String target, String exchange, String provider); void remove(String symbol, String providerCode); List<UpdatedPair> getAllWithSymbolOrNameContaining(String symbolOrName); List<Pair> getAllFromProvider(String providerCode); List<UpdatedPair> getAll();  }
@Test public void testRemove() { String code = "UBI.PA"; pairService.remove(code, YAHOO); assertThat(pairService.getForCodeAndProvider(code, YAHOO)).isNull(); }
@Test public void testRemove_notFound() { var symbol = "RR.L"; var providerCode = "GOOGLE"; assertThatThrownBy(() -> pairService.remove(symbol, providerCode)) .isInstanceOf(PairException.class) .hasMessage("pair.error.not-found: [RR.L, GOOGLE]"); }