/**
   * {@link WritableSlot}を経由した{@link Writable}の永続化。
   *
   * @throws Exception テストに失敗した場合
   */
  @SuppressWarnings("deprecation")
  @Test
  public void loadStore() throws Exception {
    WritableSlot slot = new WritableSlot();
    IntOption value = new IntOption(100);
    IntOption copy = new IntOption();

    slot.store(value);
    slot.loadTo(copy);
    assertThat(copy, is(value));

    value.modify(200);
    slot.store(value);
    slot.loadTo(copy);
    assertThat(copy, is(value));
  }
Example #2
0
 @SuppressWarnings("deprecation")
 private void fill0(IntOption option, boolean doRecover) throws CsvFormatException {
   if (lineBuffer.hasRemaining()) {
     try {
       int value = Integer.parseInt(lineBuffer.toString());
       option.modify(value);
     } catch (NumberFormatException e) {
       if (doRecover && trimWhitespaces()) {
         fill0(option, false);
         return;
       }
       throw new CsvFormatException(
           createStatusInLine(Reason.INVALID_CELL_FORMAT, "int value"), e);
     }
   } else {
     option.setNull();
   }
 }