-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADM-794:[backend]fix: add test for pipeline #1014
Changes from all commits
4023cfe
7316696
9b63d5f
65b2d4a
387df3b
5cb1dfc
b32b607
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package heartbeat.service.report; | ||
|
||
import heartbeat.controller.board.dto.request.RequestJiraBoardColumnSetting; | ||
import heartbeat.controller.board.dto.request.StoryPointsAndCycleTimeRequest; | ||
import heartbeat.controller.board.dto.response.TargetField; | ||
import heartbeat.controller.report.dto.request.JiraBoardSetting; | ||
|
||
import java.util.List; | ||
|
||
public class KanbanFixture { | ||
|
||
public static JiraBoardSetting MOCK_JIRA_BOARD_SETTING() { | ||
return JiraBoardSetting.builder() | ||
.users(List.of("user1")) | ||
.token("token") | ||
.type("jira") | ||
.site("site") | ||
.projectKey("ADM") | ||
.boardId("2") | ||
.boardColumns(List.of(RequestJiraBoardColumnSetting.builder().value("DONE").name("DONE").build())) | ||
.targetFields(List.of(TargetField.builder().key("customer").build())) | ||
.treatFlagCardAsBlock(true) | ||
.assigneeFilter("assignee") | ||
.build(); | ||
} | ||
|
||
public static StoryPointsAndCycleTimeRequest MOCK_EXPECT_STORY_POINT_AND_CYCLE_TIME_REQUEST() { | ||
return StoryPointsAndCycleTimeRequest.builder() | ||
.token("token") | ||
.type("jira") | ||
.site("site") | ||
.project("ADM") | ||
.boardId("2") | ||
.targetFields(List.of(TargetField.builder().key("customer").build())) | ||
.treatFlagCardAsBlock(true) | ||
.startTime("startTime") | ||
.endTime("endTime") | ||
.build(); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,12 @@ class KanbanServiceTest { | |
private KanbanCsvService kanbanCsvService; | ||
|
||
@Test | ||
void shouldCallCsvServiceToGenerateScvInfo() { | ||
void shouldCallCsvServiceToGenerateCSVInfoWhenJiraBoardSettingIsNotNull() { | ||
JiraBoardSetting mockJiraBoardSetting = KanbanFixture.MOCK_JIRA_BOARD_SETTING(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the test description There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
GenerateReportRequest request = GenerateReportRequest.builder() | ||
.jiraBoardSetting(JiraBoardSetting.builder().treatFlagCardAsBlock(true).build()) | ||
.jiraBoardSetting(mockJiraBoardSetting) | ||
.startTime("startTime") | ||
.endTime("endTime") | ||
.build(); | ||
CardCollection realDoneCardCollection = CardCollection.builder().build(); | ||
CardCollection nonDoneCardCollection = CardCollection.builder().build(); | ||
|
@@ -49,6 +52,12 @@ void shouldCallCsvServiceToGenerateScvInfo() { | |
assertEquals(realDoneCardCollection, result.getRealDoneCardCollection()); | ||
assertEquals(nonDoneCardCollection, result.getNonDoneCardCollection()); | ||
verify(kanbanCsvService).generateCsvInfo(request, realDoneCardCollection, nonDoneCardCollection); | ||
verify(jiraService).getStoryPointsAndCycleTimeForNonDoneCards( | ||
KanbanFixture.MOCK_EXPECT_STORY_POINT_AND_CYCLE_TIME_REQUEST(), mockJiraBoardSetting.getBoardColumns(), | ||
mockJiraBoardSetting.getUsers()); | ||
verify(jiraService).getStoryPointsAndCycleTimeForDoneCards( | ||
KanbanFixture.MOCK_EXPECT_STORY_POINT_AND_CYCLE_TIME_REQUEST(), mockJiraBoardSetting.getBoardColumns(), | ||
mockJiraBoardSetting.getUsers(), mockJiraBoardSetting.getAssigneeFilter()); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated code with line 29 ~ line 33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
different types of object definitions, do not know how to repeat