### Question:
ExcelReader { public int getRowIndex(String sheetName, String key) { logger.entering(new Object[] { sheetName, key }); int index = -1; Sheet sheet = fetchSheet(sheetName); int rowCount = sheet.getPhysicalNumberOfRows(); for (int i = 0; i < rowCount; i++) { Row row = sheet.getRow(i); if (row == null) { continue; } String cellValue = row.getCell(0).toString(); if ((key.compareTo(cellValue) == 0) && (!cellValue.contains("#"))) { index = i; break; } } logger.exiting(index); return index; } ExcelReader(DataResource resource); List<Row> getAllExcelRows(String sheetName, boolean heading); boolean sheetExists(String sheetName); List<String> getRowContents(String sheetName, int rowIndex, int size); List<String> getHeaderRowContents(String sheetName, int size); List<String> getRowContents(Row row, int size); int getRowIndex(String sheetName, String key); Row getAbsoluteSingeExcelRow(String sheetName, int rowNumber);  }### Answer:
@Test(groups = "unit") public void testGetRowIndex() { int index = excelReader.getRowIndex(USER.class.getSimpleName(), "tom"); assertEquals(index, 1); }
@Test(groups = "unit") public void testGetRowIndexInvalidKey() { int index = excelReader.getRowIndex(USER.class.getSimpleName(), "harry"); assertEquals(index, -1); }
@Test(groups = "unit") public void testGetRowIndexKeyExistsButRowIsMarkedToBeExcluded() { int index = excelReader.getRowIndex("Sheet1", "#1"); assertEquals(index, -1); }