HardSoftCodeLimiter implements CodeLimiter { public int softLimit() { return softLimit; } private  HardSoftCodeLimiter(int softLimit, int hardLimit, int resolution, Handler handler); static Builder builder(); int instructionCount(); int softLimit(); int hardLimit(); void check();  }
@Test public void testSoftLimit() throws CodeException { TestHandler handler = new TestHandler(Limit.SOFT, 6); CodeLimiter limiter = HardSoftCodeLimiter.builder() .setSoftLimit(5) .setResolution(1) .setHandler(handler) .build(); JsonNode node = JsonUtils.decode("[0,1,2,3,4,5,6,7,8,9]"); Context ctx = new Context(node); ctx.setCodeLimiter(limiter); RootInst root = builder().repeated("@").var("@").end().eof().build(); ctx.execute(root); assertTrue(handler.wasCalled()); }