예제 #1
0
 /** Tests op lookups by class. */
 @Test
 public void testMatchingByClass() {
   Op op = ops.op("test.arrr!", (Object) null);
   assertSame(FirstMate.class, op.getClass());
   op = ops.op("test.arrr!", (EyePatch) null);
   assertSame(FirstMate.class, op.getClass());
   op = ops.op("test.arrr!", (Booty) null);
   assertSame(FirstMate.class, op.getClass());
   op = ops.op("test.arrr!", EyePatch.class);
   assertSame(FirstMate.class, op.getClass());
   op = ops.op("test.arrr!", Booty.class);
   assertSame(Captain.class, op.getClass());
 }
예제 #2
0
  /** Tests {@link OpService#op(String, Object...)}. */
  @Test
  public void testOpByName() {
    final DoubleType value = new DoubleType(123.456);

    final Op op = ops.op("test.infinity", value);
    assertSame(InfinityOp.class, op.getClass());

    assertFalse(Double.isInfinite(value.get()));
    op.run();
    assertTrue(Double.isInfinite(value.get()));
  }