@Test void should_save_stock_when_save_given_valid_input() { given(insert.bind(stock1.getSymbol(), stock1.getDate(), stock1.getValue())).willReturn(bound); var stockRepository = new SyncStockRepository(session, insert, delete, findById, findBySymbol, rowMapper); var saved = stockRepository.save(stock1); assertThat(saved).isNotNull().isEqualTo(stock1); verify(session).execute(bound); }
@NonNull public Stock save(@NonNull Stock stock) { BoundStatement bound = insert.bind(stock.getSymbol(), stock.getDate(), stock.getValue()); session.execute(bound); return stock; }
SyncStockRepository { @NonNull public Stock save(@NonNull Stock stock) { BoundStatement bound = insert.bind(stock.getSymbol(), stock.getDate(), stock.getValue()); session.execute(bound); return stock; } }
SyncStockRepository { @NonNull public Stock save(@NonNull Stock stock) { BoundStatement bound = insert.bind(stock.getSymbol(), stock.getDate(), stock.getValue()); session.execute(bound); return stock; } SyncStockRepository(
      CqlSession session,
      @Qualifier("stocks.prepared.insert") PreparedStatement insert,
      @Qualifier("stocks.prepared.deleteById") PreparedStatement deleteById,
      @Qualifier("stocks.prepared.findById") PreparedStatement findById,
      @Qualifier("stocks.prepared.findBySymbol") PreparedStatement findBySymbol,
      Function<Row, Stock> rowMapper); }
SyncStockRepository { @NonNull public Stock save(@NonNull Stock stock) { BoundStatement bound = insert.bind(stock.getSymbol(), stock.getDate(), stock.getValue()); session.execute(bound); return stock; } SyncStockRepository(
      CqlSession session,
      @Qualifier("stocks.prepared.insert") PreparedStatement insert,
      @Qualifier("stocks.prepared.deleteById") PreparedStatement deleteById,
      @Qualifier("stocks.prepared.findById") PreparedStatement findById,
      @Qualifier("stocks.prepared.findBySymbol") PreparedStatement findBySymbol,
      Function<Row, Stock> rowMapper); @NonNull Stock save(@NonNull Stock stock); void deleteById(@NonNull String symbol, @NonNull Instant date); @NonNull Optional<Stock> findById(@NonNull String symbol, @NonNull Instant date); @NonNull Stream<Stock> findAllBySymbol(
      @NonNull String symbol,
      @NonNull Instant start,
      @NonNull Instant end,
      long offset,
      long limit); }
SyncStockRepository { @NonNull public Stock save(@NonNull Stock stock) { BoundStatement bound = insert.bind(stock.getSymbol(), stock.getDate(), stock.getValue()); session.execute(bound); return stock; } SyncStockRepository(
      CqlSession session,
      @Qualifier("stocks.prepared.insert") PreparedStatement insert,
      @Qualifier("stocks.prepared.deleteById") PreparedStatement deleteById,
      @Qualifier("stocks.prepared.findById") PreparedStatement findById,
      @Qualifier("stocks.prepared.findBySymbol") PreparedStatement findBySymbol,
      Function<Row, Stock> rowMapper); @NonNull Stock save(@NonNull Stock stock); void deleteById(@NonNull String symbol, @NonNull Instant date); @NonNull Optional<Stock> findById(@NonNull String symbol, @NonNull Instant date); @NonNull Stream<Stock> findAllBySymbol(
      @NonNull String symbol,
      @NonNull Instant start,
      @NonNull Instant end,
      long offset,
      long limit);  }