@Test public void given_copy_on_read_and_write_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); }
public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } }
CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } }
CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); }
CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); }
CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element);  }