Exemplo n.º 1
0
  @Test
  public void entityMap() {
    Entities map = new Entities();

    map.addEntity("foo", 1);
    assertEquals(1, map.getEntityValue("foo"));
    assertEquals("foo", map.getEntityName(1));

    // 查找表将被更新
    map.addEntity("bar", 2);
    map.addEntity("baz", 3);
    assertEquals(3, map.getEntityValue("baz"));
    assertEquals("baz", map.getEntityName(3));
  }
Exemplo n.º 2
0
  @Test
  public void addEntities() throws Exception {
    String[][] array = {{"foo", "100"}, {"bar", "101"}};

    Entities e = new Entities();

    e.addEntities(array);

    assertEquals("foo", e.getEntityName(100));
    assertEquals("bar", e.getEntityName(101));

    assertEquals(100, e.getEntityValue("foo"));
    assertEquals(101, e.getEntityValue("bar"));
  }