viewing paste Unknown #52366 | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
@Test
  //setField(null) не то же самое что не делать set
  public void binaryNullField() {
    final IgniteCache<BinaryObject, BinaryObject> binaryView = ignite.createCache(
      new CacheConfiguration<BinaryObject, BinaryObject>("binaryTest") 
        .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
        .setAtomicityMode(CacheAtomicityMode.ATOMIC)
    ).withKeepBinary();
 
    final IgniteCache<NumbersPojo, NumbersPojo> typedView = ignite.cache("binaryTest");
 
    binaryView.put(
      ignite.binary().builder(NumbersPojo.class.getName())/*                                           */.setField("aDouble", 1d).setField("integer", 1).build(),
      ignite.binary().builder(NumbersPojo.class.getName()).build());
 
    binaryView.put(
      ignite.binary().builder(NumbersPojo.class.getName()).setField("bigDecimal", null, BigDecimal.class).setField("aDouble", 1d).setField("integer", 1).build(),
      ignite.binary().builder(NumbersPojo.class.getName()).build());
 
    binaryView.put(
      ignite.binary().builder(NumbersPojo.class.getName()).setField("bigDecimal", null).build(),
      ignite.binary().builder(NumbersPojo.class.getName()).build());
 
    typedView.put(new NumbersPojo(), new NumbersPojo());
 
    Assertions.assertThat(binaryView.size()).isEqualTo(4);
 
 
    binaryView.put(
      ignite.binary().builder(NumbersPojo.class.getName()).setField("bigDecimal", null).setField("aDouble", null).setField("integer", null).build(),
      ignite.binary().builder(NumbersPojo.class.getName()).build());
    Assertions.assertThat(binaryView.size()).isEqualTo(4);
  }
Viewed 142 times, submitted by Guest.