PrimaryKeyBundle implements SchemaEquality<PrimaryKeyBundle> { @Override public boolean isSchemaEqual(PrimaryKeyBundle other) { return mColumnNames.equals(other.mColumnNames) && mAutoGenerate == other.mAutoGenerate; } PrimaryKeyBundle(boolean autoGenerate, List<String> columnNames); List<String> getColumnNames(); boolean isAutoGenerate(); @Override boolean isSchemaEqual(PrimaryKeyBundle other);  }
@Test public void schemaEquality_same_equal() { PrimaryKeyBundle bundle = new PrimaryKeyBundle(true, Arrays.asList("foo", "bar")); PrimaryKeyBundle other = new PrimaryKeyBundle(true, Arrays.asList("foo", "bar")); assertThat(bundle.isSchemaEqual(other), is(true)); }
@Test public void schemaEquality_diffAutoGen_notEqual() { PrimaryKeyBundle bundle = new PrimaryKeyBundle(true, Arrays.asList("foo", "bar")); PrimaryKeyBundle other = new PrimaryKeyBundle(false, Arrays.asList("foo", "bar")); assertThat(bundle.isSchemaEqual(other), is(false)); }
@Test public void schemaEquality_diffColumns_notEqual() { PrimaryKeyBundle bundle = new PrimaryKeyBundle(true, Arrays.asList("foo", "baz")); PrimaryKeyBundle other = new PrimaryKeyBundle(true, Arrays.asList("foo", "bar")); assertThat(bundle.isSchemaEqual(other), is(false)); }
@Test public void schemaEquality_diffColumnOrder_notEqual() { PrimaryKeyBundle bundle = new PrimaryKeyBundle(true, Arrays.asList("foo", "bar")); PrimaryKeyBundle other = new PrimaryKeyBundle(true, Arrays.asList("bar", "foo")); assertThat(bundle.isSchemaEqual(other), is(false)); }