SymbolService { public Optional<Symbol> getForCode(String code) { return symbolRepo.findById(code).map(symbolMapper::mapToSymbol); }  Symbol addSymbol(String code, String name, String countryFlag, String currencyCode); Optional<Symbol> getForCode(String code); Optional<Symbol> getForCodeWithNoCurrency(String code); void addFavoriteSymbol(String fromSymbolCode, String toSymbolCode, String username); void deleteFavoriteSymbol(String fromSymbolCode, String toSymbolCode, String username);  }
@Sql("/sql/insert_data.sql") @Test public void testGetForCode() { assertThat(symbolService.getForCode(USD)) .hasValueSatisfying((result) -> { assertThat(result).isEqualTo(new Symbol(USD, "US Dollar", "us", null)); assertThat(result).isEqualToIgnoringGivenFields(symbolRepo.findById(USD).get(), "currencyCode"); }); }
@Test public void testGetForCode_NotExist() { assertThat(symbolService.getForCode(USD)).isNotPresent(); }