@Test public void testUniqueItems() throws IOException { Path sampleFile = newLegacySample(); try (Indexer indexer = new LegacyIndexer(sampleFile)) { assertThatThrownBy(() -> indexer.checkId(new Index.Key(UTIL_CAL, "Calendars2"))).isInstanceOf(IOException.class); assertThatThrownBy(() -> indexer.checkId(new Index.Key(UTIL_VAR, "Variables2"))).isInstanceOf(IOException.class); } }
@Override public void checkId(Index.Key key) throws IOException { if (WorkspaceFamily.UTIL_CAL.equals(key.getFamily())) { if (!key.getId().equals("Calendars")) { throw new IOException("Only one calendar file is allowed"); } } else if (WorkspaceFamily.UTIL_VAR.equals(key.getFamily())) { if (!key.getId().equals("Variables")) { throw new IOException("Only one variable file is allowed"); } } }
LegacyIndexer implements Indexer { @Override public void checkId(Index.Key key) throws IOException { if (WorkspaceFamily.UTIL_CAL.equals(key.getFamily())) { if (!key.getId().equals("Calendars")) { throw new IOException("Only one calendar file is allowed"); } } else if (WorkspaceFamily.UTIL_VAR.equals(key.getFamily())) { if (!key.getId().equals("Variables")) { throw new IOException("Only one variable file is allowed"); } } } }
LegacyIndexer implements Indexer { @Override public void checkId(Index.Key key) throws IOException { if (WorkspaceFamily.UTIL_CAL.equals(key.getFamily())) { if (!key.getId().equals("Calendars")) { throw new IOException("Only one calendar file is allowed"); } } else if (WorkspaceFamily.UTIL_VAR.equals(key.getFamily())) { if (!key.getId().equals("Variables")) { throw new IOException("Only one variable file is allowed"); } } } LegacyIndexer(Path file); }
LegacyIndexer implements Indexer { @Override public void checkId(Index.Key key) throws IOException { if (WorkspaceFamily.UTIL_CAL.equals(key.getFamily())) { if (!key.getId().equals("Calendars")) { throw new IOException("Only one calendar file is allowed"); } } else if (WorkspaceFamily.UTIL_VAR.equals(key.getFamily())) { if (!key.getId().equals("Variables")) { throw new IOException("Only one variable file is allowed"); } } } LegacyIndexer(Path file); @Override void checkId(Index.Key key); @Override Index loadIndex(); @Override void storeIndex(Index index); @Override void close(); }
LegacyIndexer implements Indexer { @Override public void checkId(Index.Key key) throws IOException { if (WorkspaceFamily.UTIL_CAL.equals(key.getFamily())) { if (!key.getId().equals("Calendars")) { throw new IOException("Only one calendar file is allowed"); } } else if (WorkspaceFamily.UTIL_VAR.equals(key.getFamily())) { if (!key.getId().equals("Variables")) { throw new IOException("Only one variable file is allowed"); } } } LegacyIndexer(Path file); @Override void checkId(Index.Key key); @Override Index loadIndex(); @Override void storeIndex(Index index); @Override void close();  }