### Question:
IndexBundle implements SchemaEquality<IndexBundle> { @Override public boolean isSchemaEqual(IndexBundle other) { if (mUnique != other.mUnique) return false; if (mName.startsWith(DEFAULT_PREFIX)) { if (!other.mName.startsWith(DEFAULT_PREFIX)) { return false; } } else if (other.mName.startsWith(DEFAULT_PREFIX)) { return false; } else if (!mName.equals(other.mName)) { return false; } if (mColumnNames != null ? !mColumnNames.equals(other.mColumnNames) : other.mColumnNames != null) { return false; } return true; } IndexBundle(String name, boolean unique, List<String> columnNames,
            String createSql); String getName(); boolean isUnique(); List<String> getColumnNames(); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) String create(String tableName); @Override boolean isSchemaEqual(IndexBundle other); static final String DEFAULT_PREFIX; }### Answer:
@Test public void schemaEquality_same_equal() { IndexBundle bundle = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql"); IndexBundle other = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql"); assertThat(bundle.isSchemaEqual(other), is(true)); }
@Test public void schemaEquality_diffName_notEqual() { IndexBundle bundle = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql"); IndexBundle other = new IndexBundle("index3", false, Arrays.asList("col1", "col2"), "sql"); assertThat(bundle.isSchemaEqual(other), is(false)); }
@Test public void schemaEquality_diffGenericName_equal() { IndexBundle bundle = new IndexBundle(IndexBundle.DEFAULT_PREFIX + "x", false, Arrays.asList("col1", "col2"), "sql"); IndexBundle other = new IndexBundle(IndexBundle.DEFAULT_PREFIX + "y", false, Arrays.asList("col1", "col2"), "sql"); assertThat(bundle.isSchemaEqual(other), is(true)); }
@Test public void schemaEquality_diffUnique_notEqual() { IndexBundle bundle = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql"); IndexBundle other = new IndexBundle("index1", true, Arrays.asList("col1", "col2"), "sql"); assertThat(bundle.isSchemaEqual(other), is(false)); }
@Test public void schemaEquality_diffColumns_notEqual() { IndexBundle bundle = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql"); IndexBundle other = new IndexBundle("index1", false, Arrays.asList("col2", "col1"), "sql"); assertThat(bundle.isSchemaEqual(other), is(false)); }
@Test public void schemaEquality_diffSql_equal() { IndexBundle bundle = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql"); IndexBundle other = new IndexBundle("index1", false, Arrays.asList("col1", "col2"), "sql22"); assertThat(bundle.isSchemaEqual(other), is(true)); }