Example #1
0
  /**
   * Checks that {@link IdentifiableElement} and {@link Identifier} are always correctly connected.
   */
  @Test
  public void testCheckOpposite() {
    MyContainer newContainer = new MyContainer();
    Identifier id = GraphFactory.createIdentifier(newContainer, SaltUtil.LABEL_ID);
    assertEquals(newContainer.getIdentifier(), id);

    newContainer.setId("newId");
    assertFalse(newContainer.equals(id));
  }
Example #2
0
  public static void main(String[] args) {

    int tankCount = 0;

    MyContainer<AbstractTank> container1 = new MyContainer<AbstractTank>();
    container1.addItem(new FlyingTank(++tankCount, Color.BLACK, 100));
    container1.addItem(new SwimmingTank(++tankCount, Color.RED, 100));

    MyContainer<String> container2 = new MyContainer<String>();
    container2.addItem("Hello");
    container2.addItem("Sam hello");
  }