### Question:
ArchonStorage { public int nextShardId() throws Exception{ PreparedStatement stmt = null; try { stmt = connection.prepareStatement(selectNextShardIdQuery); ResultSet rs = stmt.executeQuery(); rs.next(); Integer id = rs.getInt(1); if (id== null || id == 0){ log.info("No shardID's found in DB, starting with shardID 1."); return 1; } id++; log.info("Returning next unused shardId:"+id); return id; } catch (SQLException e) { log.error("SQL Exception in getNextShardId():" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); static void initialize(String driverName, String driverUrl, String userName, String password); int nextShardId(); void addARC(String arcPath); void addOrUpdateARC(String arcPath); List<String> getShardIDs(); String nextARC(String shardID); List<String> getARCFiles(String shardID); ArcVO getArcByID(String arcID); int getArcCount(); List<ArcVO> getLatest1000Arcs(); List<ArcVO> getAllRunningArcs(); void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState); void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority); void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority); void setARCPriority(String fullPath, int priority); void resetArcWithPriorityStatement(String fullPath, int priority); void removeARC(String arcID); void clearIndexing(String shardID); void resetShardId(String shardID); void commit(); void rollback(); void close(); static void shutdown(); static Date INITDATE; }### Answer:
@Test public void testNextShardID() throws Exception { int nextShardId = storage.nextShardId(); assertEquals(1,nextShardId); storage.addARC(arcFile1); assertEquals(1,nextShardId); storage.setARCProperties(arcFile1, "1", ArchonConnector.ARC_STATE.RUNNING, 9); nextShardId = storage.nextShardId(); assertEquals(2,nextShardId); }