コード例 #1
0
 @Test
 public void testParameterDefaultValueInitialisation() {
   final SomeOp op = new SomeOp();
   op.setParameterDefaultValues();
   testParameterValues(op, false);
   op.getTargetProduct(); // force initialisation through framework
   testParameterValues(op, true);
 }
コード例 #2
0
  @Test
  public void testUnknownParameters() {
    try {
      final SomeOp op = new SomeOp();
      op.setParameterDefaultValues();
      op.setParameter("pi", 21);
      op.getTargetProduct(); // force initialisation through framework
      assertEquals(21, op.getParameter("pi"));
      assertEquals(21, op.pi);
    } catch (OperatorException e) {
      e.printStackTrace();
      fail("Unexpected: " + e.getMessage());
    }

    try {
      final SomeOp op = new SomeOp();
      op.setParameterDefaultValues();
      op.setParameter("iamAnUnknownParameter", -1);
      op.getTargetProduct(); // force initialisation through framework
    } catch (OperatorException e) {
      e.printStackTrace();
      fail("Unexpected: " + e.getMessage());
    }
  }