@ThreadedTest public void getPosition_atEndOfLastMethod() throws Exception { control.add(0, 0); CodePosition cp = recorder.atEndOfLastMethod().position(); CodePosition verification = ic.atMethodEnd(SimpleClass.class.getDeclaredMethod("add", int.class, int.class)); assertTrue(verification.matches(cp)); }
@ThreadedTest public void getPosition_atStart() throws Exception { final SimpleInteger value = new SimpleInteger(0); CodePosition cp = recorder.atStartOf(control.add(value, value)).position(); CodePosition verification = ic.atMethodStart( SimpleClass.class.getDeclaredMethod("add", SimpleInteger.class, SimpleInteger.class)); assertTrue(verification.matches(cp)); }
@ThreadedTest public void getPosition_afterCall() throws Exception { SimpleClass2 target = recorder.createTarget(SimpleClass2.class); control.add(0, 0); CodePosition cp = recorder.in(control.callSecond()).afterCalling(target.setPosition(null, 0)).position(); CodePosition verification = ic.afterCall( SimpleClass.class.getDeclaredMethod("callSecond"), SimpleClass2.class.getDeclaredMethod("setPosition", SimpleClass.class, int.class)); assertTrue(verification.matches(cp)); }