/** * heavy restore. * @throws Exception if failed */ @Test public void stress_restore_large() throws Exception { int count = 10000000; DecimalOption value = new DecimalOption(new BigDecimal(Long.MAX_VALUE).multiply(BigDecimal.TEN)); byte[] bytes = toBytes(value); DecimalOption buf = new DecimalOption(); for (int i = 0; i < count; i++) { buf.restore(bytes, 0, bytes.length); if (i == 0) { assertThat(buf, is(value)); } } }
/** * heavy restore. * @throws Exception if failed */ @Test public void stress_restore() throws Exception { int count = 10000000; DecimalOption value = new DecimalOption(new BigDecimal("3.14")); byte[] bytes = toBytes(value); DecimalOption buf = new DecimalOption(); for (int i = 0; i < count; i++) { buf.restore(bytes, 0, bytes.length); if (i == 0) { assertThat(buf, is(value)); } } }