use of jetbrains.buildServer.server.rest.model.Comment in project teamcity-rest by JetBrains.
the class InvestigationRequestTest method testAssignInvestigation.
@Test
void testAssignInvestigation() throws Throwable {
final SUser user2 = createUser("user2");
Investigation investigation = new Investigation();
investigation.state = "taken";
investigation.assignee = new User();
investigation.assignee.setId(user2.getId());
investigation.assignment = new Comment();
investigation.assignment.text = "comment here";
investigation.scope = new ProblemScope();
investigation.scope.project = new Project();
investigation.scope.project.id = myProject.getExternalId();
investigation.target = new ProblemTarget();
investigation.target.tests = new Tests();
jetbrains.buildServer.server.rest.model.problem.Test test = new jetbrains.buildServer.server.rest.model.problem.Test();
test.name = "testname";
investigation.target.tests.items = Collections.singletonList(test);
investigation.resolution = new Resolution();
investigation.resolution.type = Resolution.ResolutionType.manually;
investigation.resolution.time = "20900512T163700";
assertEmpty(myInvestigationFinder.getItems(null).myEntries);
createBuildWithFailedTest("testname");
Investigation result = myRequest.createInstance(investigation, "$long");
assertEquals("testname", result.target.tests.items.get(0).name);
List<InvestigationWrapper> currentInvestigations = myInvestigationFinder.getItems(null).myEntries;
assertEquals(1, currentInvestigations.size());
InvestigationWrapper investigationWrapper = currentInvestigations.get(0);
assertEquals(ResponsibilityEntry.State.TAKEN, investigationWrapper.getState());
assertEquals(user2.getId(), investigationWrapper.getResponsibleUser().getId());
assertEquals("comment here", investigationWrapper.getComment());
assertEquals(null, investigationWrapper.getProblemRE());
assertEquals(myProject.getProjectId(), investigationWrapper.getTestRE().getProjectId());
assertEquals("testname", investigationWrapper.getTestRE().getTestName().getAsString());
assertEquals(myProject.getProjectId(), investigationWrapper.getAssignmentProject().getProjectId());
myRequest.deleteInstance(investigationWrapper.getId());
assertEmpty(myInvestigationFinder.getItems(null).myEntries);
}
Aggregations