### Question:
BatchWriterConfig implements Writable { private static <T> T merge(T o1, T o2) { if (o1 != null) return o1; return o2; }  BatchWriterConfig setMaxMemory(long maxMemory); BatchWriterConfig setMaxLatency(long maxLatency, TimeUnit timeUnit); BatchWriterConfig setTimeout(long timeout, TimeUnit timeUnit); BatchWriterConfig setMaxWriteThreads(int maxWriteThreads); long getMaxMemory(); long getMaxLatency(TimeUnit timeUnit); long getTimeout(TimeUnit timeUnit); int getMaxWriteThreads(); Durability getDurability(); BatchWriterConfig setDurability(Durability durability); @Override void write(DataOutput out); @Override void readFields(DataInput in); @Override boolean equals(Object o); BatchWriterConfig merge(BatchWriterConfig other); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testMerge() { BatchWriterConfig cfg1 = new BatchWriterConfig(), cfg2 = new BatchWriterConfig(); cfg1.setMaxMemory(1234); cfg2.setMaxMemory(5858); cfg2.setDurability(Durability.LOG); cfg2.setMaxLatency(456, TimeUnit.MILLISECONDS); assertEquals(Durability.DEFAULT, cfg1.getDurability()); BatchWriterConfig merged = cfg1.merge(cfg2); assertEquals(1234, merged.getMaxMemory()); assertEquals(Durability.LOG, merged.getDurability()); assertEquals(456, merged.getMaxLatency(TimeUnit.MILLISECONDS)); assertEquals(3, merged.getMaxWriteThreads()); }