### Question:
CompatibleHistorySegment extends CacheColumnSegment implements HistorySegment { @Override protected Column<?> newColumn(IResourceLocation location, ClassType classType) { if (!isReadable()) { return super.newColumn(location, classType); } return newNullableColumn(location, classType); } CompatibleHistorySegment(IResourceLocation parent, SwiftMetaData meta); @Override ImmutableBitMap getAllShowIndex(); @Override void release();  }### Answer:
@Test public void newIntColumn() throws Exception { IResourceLocation location = mock(IResourceLocation.class); CompatibleHistorySegment seg = spy(new CompatibleHistorySegment(location, mock(SwiftMetaData.class))); doReturn(false).when(seg).isReadable(); assertTrue(seg.newColumn(location, ClassType.INTEGER) instanceof IntColumn); doReturn(true).when(seg).isReadable(); IntColumn intColumn = mock(IntColumn.class); whenNew(IntColumn.class).withAnyArguments().thenReturn(intColumn); DetailColumn detailColumn = mock(DetailColumn.class); when(intColumn.getDetailColumn()).thenReturn(detailColumn); when(detailColumn.isReadable()).thenReturn(false); assertTrue(seg.newColumn(location, ClassType.INTEGER) instanceof ReadonlyNullColumn<?>); }
@Test public void newLongColumn() throws Exception { IResourceLocation location = mock(IResourceLocation.class); CompatibleHistorySegment seg = spy(new CompatibleHistorySegment(location, mock(SwiftMetaData.class))); doReturn(false).when(seg).isReadable(); assertTrue(seg.newColumn(location, ClassType.LONG) instanceof LongColumn); doReturn(true).when(seg).isReadable(); LongColumn longColumn = mock(LongColumn.class); whenNew(LongColumn.class).withAnyArguments().thenReturn(longColumn); DetailColumn detailColumn = mock(DetailColumn.class); when(longColumn.getDetailColumn()).thenReturn(detailColumn); when(detailColumn.isReadable()).thenReturn(false); assertTrue(seg.newColumn(location, ClassType.LONG) instanceof ReadonlyNullColumn<?>); }