Exemplo n.º 1
0
 @Test
 public void testExtensionRenamingIsReversible() {
   Renaming r = Renaming.extension(sid, ssid, name, sname);
   assertTrue(r.isReversible());
   Renaming reverse = Renaming.extension(ssid, sid, sname, name);
   assertEquals(reverse, r.reverse());
 }
Exemplo n.º 2
0
  @Test
  public void testProjectOnExtension() {
    Renaming r = Renaming.extension(sid, ssid, name, sname);
    Renaming expected = Renaming.extension(name, sname);

    // it works with a subset of original attributes
    AttrList list = AttrList.attrs(name);
    Renaming got = r.project(list);
    assertEquals(expected, got);

    // it is robust to a superset too (city was not part of it)
    list = AttrList.attrs(name, city);
    got = r.project(list);
    assertEquals(expected, got);
  }
Exemplo n.º 3
0
 @Test
 public void testSuffixRenamingIsReversible() {
   Renaming r = Renaming.suffix("foo");
   assertTrue(r.isReversible());
   assertEquals(attr("sid"), r.reverse().apply(attr("sidfoo")));
 }
Exemplo n.º 4
0
 @Test
 public void testItSupportsSuffixRenaming() {
   Renaming r = Renaming.suffix("foo");
   assertEquals(r.apply(sid), attr("sidfoo"));
 }
Exemplo n.º 5
0
 @Test
 public void testItSupportsPrefixRenaming() {
   Renaming r = Renaming.prefix("foo");
   assertEquals(r.apply(sid), attr("foosid"));
 }
Exemplo n.º 6
0
 @Test
 public void testItSupportsIntensionRenaming() {
   AttrName SID = attr("SID");
   Renaming r = Renaming.intension(a -> attr(a.getName().toUpperCase()));
   assertEquals(r.apply(sid), SID);
 }
Exemplo n.º 7
0
 @Test
 public void testExtensionRenamingIsTotal() {
   Renaming r = Renaming.extension(sid, ssid, name, sname);
   assertEquals(r.apply(city), city);
 }
Exemplo n.º 8
0
 @Test
 public void testItSupportsExtensionRenaming() {
   Renaming r = Renaming.extension(sid, ssid, name, sname);
   assertEquals(r.apply(sid), ssid);
   assertEquals(r.apply(name), sname);
 }