コード例 #1
0
  /**
   * Through <code>XEnumeration</code> interface an element from the set is retrieved. Then this
   * element removed.
   *
   * <p>Has <b> OK </b> status if after removing <code>has()</code> method returns false.
   */
  public void _remove() {
    requiredMethod("insert()");
    boolean res = true;

    try {

      // get an element to be removed/inserted

      oObj.remove(element);

      if (oObj.has(element)) {
        res = false;
        log.println("After removing element method has()" + " returned true");
        hasResult = false;
      }

    } catch (com.sun.star.container.NoSuchElementException e) {
      e.printStackTrace(log);
      res = false;
    } catch (com.sun.star.lang.IllegalArgumentException e) {
      e.printStackTrace(log);
      res = false;
    }

    tRes.tested("remove()", res);
  }
コード例 #2
0
  /**
   * Inserts the element stored and removed before.
   *
   * <p>Has <b> OK </b> status if <code>has()</code> method returns <code>true</code>. The following
   * method tests are to be completed successfully before :
   *
   * <ul>
   *   <li><code> remove() </code> : element from set is stored and removed
   * </ul>
   */
  public void _insert() {
    boolean res = true;
    try {
      XMultiServiceFactory xMSF = (XMultiServiceFactory) tParam.getMSF();
      element = xMSF.createInstance("com.sun.star.reflection.TypeDescriptionProvider");

      oObj.insert(element);

      if (!oObj.has(element)) {
        res = false;
        log.println("After adding element method has()" + " returned false");
        hasResult = false;
      }
    } catch (com.sun.star.container.ElementExistException e) {
      e.printStackTrace(log);
      res = false;
    } catch (com.sun.star.lang.IllegalArgumentException e) {
      e.printStackTrace(log);
      res = false;
    } catch (com.sun.star.uno.Exception e) {
      e.printStackTrace(log);
      res = false;
    }

    tRes.tested("insert()", res);
  }