### Question:
SlidingCategoryDataset extends AbstractDataset implements CategoryDataset { @Override public int getColumnIndex(Comparable key) { int index = this.underlying.getColumnIndex(key); if (index >= this.firstCategoryIndex && index <= lastCategoryIndex()) { return index - this.firstCategoryIndex; } return -1; } SlidingCategoryDataset(CategoryDataset underlying, int firstColumn,
            int maxColumns); CategoryDataset getUnderlyingDataset(); int getFirstCategoryIndex(); void setFirstCategoryIndex(int first); int getMaximumCategoryCount(); void setMaximumCategoryCount(int max); @Override int getColumnIndex(Comparable key); @Override Comparable getColumnKey(int column); @Override List<Comparable> getColumnKeys(); @Override int getRowIndex(Comparable key); @Override Comparable getRowKey(int row); @Override List<Comparable> getRowKeys(); @Override Number getValue(Comparable rowKey, Comparable columnKey); @Override int getColumnCount(); @Override int getRowCount(); @Override Number getValue(int row, int column); @Override boolean equals(Object obj); @Override Object clone();  }### Answer:
@Test public void testGetColumnIndex() { DefaultCategoryDataset underlying = new DefaultCategoryDataset(); underlying.addValue(1.0, "R1", "C1"); underlying.addValue(2.0, "R1", "C2"); underlying.addValue(3.0, "R1", "C3"); underlying.addValue(4.0, "R1", "C4"); SlidingCategoryDataset dataset = new SlidingCategoryDataset(underlying, 1, 2); assertEquals(-1, dataset.getColumnIndex("C1")); assertEquals(0, dataset.getColumnIndex("C2")); assertEquals(1, dataset.getColumnIndex("C3")); assertEquals(-1, dataset.getColumnIndex("C4")); }