Verify { public static void isValidIndexSchema(final Collection<IndexSchema> indices, final Collection<ColumnSchema> columns) { checkNotNull(indices); checkNotNull(columns); Set<String> columnNames = Sets.newHashSet(); for (ColumnSchema column : columns) { columnNames.add(column.getColumnName()); } for (final IndexSchema index : indices) { for (final String column : index.getColumns()) { if (!columnNames.contains(column)) { throw new IllegalArgumentException("Only columns in the table may be indexed."); } } } }  static boolean hasAutoIncrementColumn(final TableSchema schema); static void isValidId(final long id, final String... message); static void isNotNullOrEmpty(final String value, final String... message); static void isValidTableSchema(final TableSchema schema); static void isValidIndexSchema(final Collection<IndexSchema> indices,
                                          final Collection<ColumnSchema> columns);  }
@Test(expected = IllegalArgumentException.class) public void testIsValidIndexSchemaInvalidColumn() { final List<IndexSchema> indices = ImmutableList.of( new IndexSchema("index_name", ImmutableList.of("invalid"), false) ); Verify.isValidIndexSchema(indices, COLUMNS); }
@Test(expected = NullPointerException.class) public void testIsValidIndexSchemaNullIndices() { Verify.isValidIndexSchema(null, ImmutableList.<ColumnSchema>of()); }
@Test(expected = NullPointerException.class) public void testIsValidIndexSchemaNullColumns() { Verify.isValidIndexSchema(ImmutableList.<IndexSchema>of(), null); }
@Test public void testIsValidIndexSchema() { Verify.isValidIndexSchema(INDICES, COLUMNS); }