Exemplo n.º 1
0
  /**
   * Test the search of all entities TABLE.<br>
   *
   * <ul>
   *   <li>Step 1 : Create many entities
   *   <li>Step 2 : Search all entities and verify the entities created are found
   * </ul>
   *
   * @throws DaoException if an unexpected DAO exception occurs.
   */
  public final void testFindAllTABLEs() throws DaoException {
    // Verify number of element before testing
    int before = tABLEDao.findAllTABLEs().size();
    Assert.assertTrue("FindAll must return at least 0", before >= 0);

    // Add two elements
    TABLE tABLE1 = getTABLEExample();
    tABLEDao.createTABLE(tABLE1);

    TABLE tABLE2 = getTABLEExample();
    tABLEDao.createTABLE(tABLE2);

    // Verify result
    int after = tABLEDao.findAllTABLEs().size();
    Assert.assertEquals("FindAll don't find the good number of elements", 2, after - before);
  }
Exemplo n.º 2
0
  /**
   * Tests the creation of the entity TABLE.<br>
   *
   * <ul>
   *   <li>Step 1 : Create an entity
   *   <li>Step 2 : Search the entity and verify it exists
   * </ul>
   *
   * @throws DaoException if an unexpected DAO exception occurs.
   */
  public final void testCreateTABLE() throws DaoException {
    // fill attributes with example values
    TABLE tABLE = getTABLEExample();

    // Execute the tested code
    tABLEDao.createTABLE(tABLE);

    // Verify result
    boolean found = false;
    for (TABLE currentTABLE : tABLEDao.findAllTABLEs()) {
      if (currentTABLE.equals(tABLE)) {
        found = true;
      }
    }
    Assert.assertTrue("TABLE not created", found);
  }
Exemplo n.º 3
0
  /**
   * Test the suppression of an entity TABLE.<br>
   *
   * <ul>
   *   <li>Step 1 : Create an entity
   *   <li>Step 2 : Delete the entity
   *   <li>Step 3 : Search the entity and verify it doesn't exist anymore
   * </ul>
   *
   * @throws DaoException if an unexpected DAO exception occurs.
   */
  public final void testDeleteTABLE() throws DaoException {
    // Initialized the test
    TABLE tABLE = getTABLEExample();
    tABLEDao.createTABLE(tABLE);

    // Execute the tested code
    tABLEDao.deleteTABLE(tABLE);

    // Verify result
    boolean found = false;
    for (TABLE currentTABLE : tABLEDao.findAllTABLEs()) {
      if (currentTABLE.getId().equals(tABLE.getId())) {
        found = true;
      }
    }
    Assert.assertFalse("TABLE not deleted", found);
  }
Exemplo n.º 4
0
  /**
   * Test the modification of an entity TABLE.<br>
   *
   * <ul>
   *   <li>Step 1 : Create an entity
   *   <li>Step 2 : Modify the entity
   *   <li>Step 3 : Search the entity and verify the modified values
   * </ul>
   *
   * @throws DaoException if an unexpected DAO exception occurs.
   */
  public final void testUpdateTABLE() throws DaoException {
    // Initialized the test
    TABLE tABLE = getTABLEExample();
    tABLEDao.createTABLE(tABLE);

    // Execute the tested code
    tABLE.setCOLUMN(new Integer(1993459542));
    tABLE.setPRIMARYKEY(new Integer(1284802305));
    tABLEDao.updateTABLE(tABLE);

    // Verify result
    boolean found = false;
    for (TABLE currentTABLE : tABLEDao.findAllTABLEs()) {
      if (currentTABLE.equals(tABLE)) {
        found = true;
        Assert.assertEquals(
            "Value cOLUMN not modified", new Integer(1993459542), tABLE.getCOLUMN());
        Assert.assertEquals(
            "Value pRIMARYKEY not modified", new Integer(1284802305), tABLE.getPRIMARYKEY());
      }
    }
    Assert.assertTrue("TABLE not found", found);
  }