### Question:
BlockDifficulty implements Comparable<BlockDifficulty>, Serializable { public BlockDifficulty add(BlockDifficulty other) { return new BlockDifficulty(value.add(other.value)); } BlockDifficulty(BigInteger value); byte[] getBytes(); BigInteger asBigInteger(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); BlockDifficulty add(BlockDifficulty other); @Override int compareTo(@Nonnull BlockDifficulty other); static final BlockDifficulty ZERO; }### Answer:
@Test public void addOneToZero() { BlockDifficulty d1 = new BlockDifficulty(BigInteger.ZERO); BlockDifficulty d2 = new BlockDifficulty(BigInteger.ONE); assertThat(d1.add(d2), is(d2)); }
@Test public void addOneToOne() { BlockDifficulty d1 = new BlockDifficulty(BigInteger.ONE); BlockDifficulty d2 = new BlockDifficulty(BigInteger.ONE); assertThat(d1.add(d2), is(new BlockDifficulty(BigInteger.valueOf(2)))); }
@Test public void addLargeValues() { BlockDifficulty d1 = new BlockDifficulty(BigInteger.valueOf(Long.MAX_VALUE)); BlockDifficulty d2 = new BlockDifficulty(BigInteger.valueOf(Integer.MAX_VALUE)); assertThat(d1.add(d2), is(new BlockDifficulty(new BigInteger("9223372039002259454")))); }