コード例 #1
0
  public void testJoinTableSetSchemaNull() throws Exception {
    ICompilationUnit cu = this.createTestAssociationOverrideJoinTableWithSchema();
    JavaResourceType resourceType = buildJavaResourceType(cu);
    AssociationOverrideAnnotation2_0 associationOverride =
        this.associationOverrideAt(0, resourceType);
    JoinTableAnnotation table = associationOverride.getJoinTable();
    assertEquals(SCHEMA_NAME, table.getSchema());

    table.setSchema(null);
    assertNull(table.getSchema());

    assertSourceDoesNotContain("@JoinTable(", cu);
  }
コード例 #2
0
  public void testJoinTableSetSchema() throws Exception {
    ICompilationUnit cu = this.createTestAssociationOverrideWithJoinTable();
    JavaResourceType resourceType = buildJavaResourceType(cu);
    AssociationOverrideAnnotation2_0 associationOverride =
        this.associationOverrideAt(0, resourceType);
    JoinTableAnnotation table = associationOverride.getJoinTable();
    assertNotNull(table);
    assertNull(table.getSchema());

    table.setSchema("Foo");
    assertEquals("Foo", table.getSchema());

    assertSourceContains(
        "@AssociationOverride(name = \""
            + ASSOCIATION_OVERRIDE_NAME
            + "\", joinTable = @JoinTable(name = \"MY_JOIN_TABLE\", schema = \"Foo\"))",
        cu);
  }