@Test public void newColumn() throws Exception { whenNew(RealtimeIntColumn.class).withAnyArguments().thenReturn(mock(RealtimeIntColumn.class), mock(RealtimeIntColumn.class)); whenNew(RealtimeLongColumn.class).withAnyArguments().thenReturn(mock(RealtimeLongColumn.class), mock(RealtimeLongColumn.class)); whenNew(RealtimeStringColumn.class).withAnyArguments().thenReturn(mock(RealtimeStringColumn.class), mock(RealtimeStringColumn.class)); whenNew(RealtimeDateColumn.class).withAnyArguments().thenReturn(mock(RealtimeDateColumn.class), mock(RealtimeDateColumn.class)); IResourceLocation location = mock(IResourceLocation.class); RealtimeSegmentImpl seg = spy(new RealtimeSegmentImpl(location, mock(SwiftMetaData.class))); assertTrue(seg.newColumn(location, ClassType.INTEGER) instanceof RealtimeIntColumn); assertTrue(seg.newColumn(location, ClassType.LONG) instanceof RealtimeLongColumn); assertTrue(seg.newColumn(location, ClassType.DOUBLE) instanceof RealtimeDoubleColumn); assertTrue(seg.newColumn(location, ClassType.STRING) instanceof RealtimeStringColumn); assertTrue(seg.newColumn(location, ClassType.DATE) instanceof RealtimeDateColumn); }
@Override protected Column<?> newColumn(IResourceLocation location, ClassType classType) { switch (classType) { case INTEGER: return new RealtimeIntColumn(location); case LONG: return new RealtimeLongColumn(location); case DOUBLE: return new RealtimeDoubleColumn(location); case DATE: return new RealtimeDateColumn(location); case STRING: return new RealtimeStringColumn(location); default: return Crasher.crash(String.format("cannot new correct column by class type: %s", classType)); } }
RealtimeSegmentImpl extends BaseSegment implements RealtimeSegment { @Override protected Column<?> newColumn(IResourceLocation location, ClassType classType) { switch (classType) { case INTEGER: return new RealtimeIntColumn(location); case LONG: return new RealtimeLongColumn(location); case DOUBLE: return new RealtimeDoubleColumn(location); case DATE: return new RealtimeDateColumn(location); case STRING: return new RealtimeStringColumn(location); default: return Crasher.crash(String.format("cannot new correct column by class type: %s", classType)); } } }
RealtimeSegmentImpl extends BaseSegment implements RealtimeSegment { @Override protected Column<?> newColumn(IResourceLocation location, ClassType classType) { switch (classType) { case INTEGER: return new RealtimeIntColumn(location); case LONG: return new RealtimeLongColumn(location); case DOUBLE: return new RealtimeDoubleColumn(location); case DATE: return new RealtimeDateColumn(location); case STRING: return new RealtimeStringColumn(location); default: return Crasher.crash(String.format("cannot new correct column by class type: %s", classType)); } } RealtimeSegmentImpl(IResourceLocation parent, SwiftMetaData meta); }
RealtimeSegmentImpl extends BaseSegment implements RealtimeSegment { @Override protected Column<?> newColumn(IResourceLocation location, ClassType classType) { switch (classType) { case INTEGER: return new RealtimeIntColumn(location); case LONG: return new RealtimeLongColumn(location); case DOUBLE: return new RealtimeDoubleColumn(location); case DATE: return new RealtimeDateColumn(location); case STRING: return new RealtimeStringColumn(location); default: return Crasher.crash(String.format("cannot new correct column by class type: %s", classType)); } } RealtimeSegmentImpl(IResourceLocation parent, SwiftMetaData meta); @Override Column<T> getColumn(ColumnKey key); }
RealtimeSegmentImpl extends BaseSegment implements RealtimeSegment { @Override protected Column<?> newColumn(IResourceLocation location, ClassType classType) { switch (classType) { case INTEGER: return new RealtimeIntColumn(location); case LONG: return new RealtimeLongColumn(location); case DOUBLE: return new RealtimeDoubleColumn(location); case DATE: return new RealtimeDateColumn(location); case STRING: return new RealtimeStringColumn(location); default: return Crasher.crash(String.format("cannot new correct column by class type: %s", classType)); } } RealtimeSegmentImpl(IResourceLocation parent, SwiftMetaData meta); @Override Column<T> getColumn(ColumnKey key);  }