lazilyRetrievesBuildTypeDetails() {
context.checking(new Expectations() {{
allowing(contact).privileged(); will(returnValue(false));
}});
final TeamCitySpy spy = new TeamCitySpy("myEndpoint", detective, contact);
context.checking(new Expectations() {{
allowing(contact).makeJsonRestCall(with(any(String.class)), with(BuildTypes.class));
will(returnValue(buildTypesForProjectsNamed("myFeatureName")));
allowing(contact).makeJsonRestCall(with(any(String.class)), with(ProjectDetail.class));
will(returnValue(projectNamed("myTarget")));
never(contact).makeJsonRestCall(with(any(String.class)), with(BuildTypeDetail.class));
}});
final TargetDigestGroup digest = spy.targetsConstituting(new Feature("myFeatureName", "myEndpoint", new CiServerType("TEAMCITY")));
context.assertIsSatisfied();
context.checking(new Expectations() {{
oneOf(contact).makeJsonRestCall(with(any(String.class)), with(BuildTypeDetail.class));
will(returnValue(buildTypeDetail()));
allowing(contact).makeJsonRestCall(with(any(String.class)), with(Builds.class));
will(returnValue(new Builds()));
}});
spy.statusOf(digest.iterator().next().id());
context.assertIsSatisfied();
}