Пример #1
0
  /** Test of addMessageProperty method, of class UserMessage. */
  @Test
  public void test13_AddMessageProperty() {
    List<UserMessage> tps = em.createQuery("from UserMessage", UserMessage.class).getResultList();
    UserMessage instance;

    assertEquals(1, tps.size());
    assertEquals(2, tps.get(0).getMessageProperties().size());

    em.getTransaction().begin();
    instance = tps.get(0);
    instance.addMessageProperty(new Property(T_PROP_3_NAME, T_PROP_3_VALUE));
    em.getTransaction().commit();

    tps = em.createQuery("from UserMessage", UserMessage.class).getResultList();

    assertEquals(1, tps.size());
    Collection<IProperty> properties = tps.get(0).getMessageProperties();

    assertEquals(3, properties.size());
    for (IProperty p : properties) {
      if (p.getName().equals(T_PROP_1_NAME)) {
        assertEquals(T_PROP_1_VALUE, p.getValue());
        assertNull(p.getType());
      } else if (p.getName().equals(T_PROP_2_NAME)) {
        assertEquals(T_PROP_2_VALUE, p.getValue());
        assertEquals(T_PROP_2_TYPE, p.getType());
      } else {
        assertEquals(T_PROP_3_NAME, p.getName());
        assertEquals(T_PROP_3_VALUE, p.getValue());
        assertNull(p.getType());
      }
    }
  }
Пример #2
0
  /** Test of getMessageProperties method, of class UserMessage. */
  @Test
  public void test12_GetMessageProperties() {
    List<UserMessage> tps = em.createQuery("from UserMessage", UserMessage.class).getResultList();

    assertEquals(1, tps.size());
    Collection<IProperty> properties = tps.get(0).getMessageProperties();

    assertEquals(2, properties.size());

    for (IProperty p : properties) {
      if (p.getName().equals(T_PROP_1_NAME)) {
        assertEquals(T_PROP_1_VALUE, p.getValue());
        assertNull(p.getType());
      } else {
        assertEquals(T_PROP_2_NAME, p.getName());
        assertEquals(T_PROP_2_VALUE, p.getValue());
        assertEquals(T_PROP_2_TYPE, p.getType());
      }
    }
  }