service.runTest(null, true, true, true, "PST");
}
@Test
public void runTest_WillCallMethodRunnerAndGAERecorders() {
final WjrMethodItem methodItem = new WjrMethodItem("foo.Foo", "fooMethod");
final StringBuilder called = new StringBuilder();
KtrWjrServiceImpl service = new KtrWjrServiceImpl() {
@Override
protected WjrGAELogRecorder getGAELogRecorder() {
return new WjrGAELogRecorder() {
@Override
public String getRecordedLog() {
return "LOG";
}
@Override
public void startRecording(String timeZoneId) {
assertThat(timeZoneId, is("JST"));
called.append("1");
}
@Override
public void stopRecording() {
called.append("5");
}
@Override
public boolean isRecording() {
return true;
}
@Override
protected void startBare() {
}
@Override
protected void stopBare() {
}
};
}
@Override
protected WjrGAEQuotaRecorder getGAEQuotaRecorder() {
return new WjrGAEQuotaRecorder() {
@Override
public String getRecordedApiTime() {
return "APITIME";
}
@Override
public String getRecordedCpuTime() {
return "CPUTIME";
}
@Override
public void startRecording() {
called.append("2");
}
@Override
public void stopRecording() {
called.append("4");
}
@Override
public boolean isRecording() {
return true;
}
};
}
@Override
protected WjrMethodRunner getMethodRunner() {
return new WjrMethodRunner() {
public WjrMethodItem runWjrMethod(WjrMethodItem param) {
called.append("3");
assertThat(param, is(methodItem));
return param;
}
};
}
};
assertThat(
service.runTest(methodItem, true, true, true, "JST"),
is(methodItem));
assertThat(called.toString(), is("12345"));
assertThat(methodItem.getApiTime(), is("APITIME"));
assertThat(methodItem.getCpuTime(), is("CPUTIME"));
assertThat(methodItem.getLog(), is("LOG"));
}