public void test_Parameter_create() {
   assertTrue(P.getTypeCode() == libsbml.SBML_PARAMETER);
   assertTrue(P.getMetaId().equals("") == true);
   assertTrue(P.getNotes() == null);
   assertTrue(P.getAnnotation() == null);
   assertTrue(P.getId().equals("") == true);
   assertTrue(P.getName().equals("") == true);
   assertTrue(P.getUnits().equals("") == true);
   assertTrue(P.getConstant() == true);
   assertEquals(false, P.isSetId());
   assertEquals(false, P.isSetName());
   assertEquals(false, P.isSetValue());
   assertEquals(false, P.isSetUnits());
   assertEquals(true, P.isSetConstant());
 }
Ejemplo n.º 2
0
  /**
   * This is used to validate the annotations associated with a field and a matching constructor
   * parameter. Each constructor parameter paired with an annotated field or method must be the same
   * annotation type and must also contain the same name.
   *
   * @param label this is the label associated with the parameter
   * @param parameter this is the constructor parameter to use
   */
  private void validateAnnotations(Label label, Parameter parameter) throws Exception {
    Annotation field = label.getAnnotation();
    Annotation argument = parameter.getAnnotation();
    String name = parameter.getName();

    if (!comparer.equals(field, argument)) {
      Class expect = field.annotationType();
      Class actual = argument.annotationType();

      if (!expect.equals(actual)) {
        throw new ConstructorException(
            "Annotation %s does not match %s for '%s' in %s", actual, expect, name, parameter);
      }
    }
  }
 public void test_Parameter_createWithNS() {
   XMLNamespaces xmlns = new XMLNamespaces();
   xmlns.add("http://www.sbml.org", "testsbml");
   SBMLNamespaces sbmlns = new SBMLNamespaces(2, 1);
   sbmlns.addNamespaces(xmlns);
   Parameter object = new Parameter(sbmlns);
   assertTrue(object.getTypeCode() == libsbml.SBML_PARAMETER);
   assertTrue(object.getMetaId().equals("") == true);
   assertTrue(object.getNotes() == null);
   assertTrue(object.getAnnotation() == null);
   assertTrue(object.getLevel() == 2);
   assertTrue(object.getVersion() == 1);
   assertTrue(object.getNamespaces() != null);
   assertTrue(object.getNamespaces().getLength() == 2);
   object = null;
 }