Skip to content

Commit

Permalink
fix: tests for create/update announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryT-CG committed Jan 15, 2024
1 parent 0ec8394 commit 51dc6bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ nb-configuration.xml

# Local environment
.env
.sh

# Plugin directory
/.quarkus/cli/plugins/
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ void getAnnouncementsByCriteriaTest() {
@Test
void createAnnouncementTest() {

// create product
// create announcement
var createDto = new CreateAnnouncementRequestDTO();

createDto.setAppId("app0");
createDto.setContent("test01");
createDto.setTitle("basePath");
createDto.setStartDate(OffsetDateTime.parse("2000-03-10T12:15:50-04:00"));

var dto = given()
.when()
Expand All @@ -93,8 +93,9 @@ void createAnnouncementTest() {
assertThat(dto).isNotNull();
assertThat(dto.getAppId()).isNotNull().isEqualTo(createDto.getAppId());
assertThat(dto.getTitle()).isNotNull().isEqualTo(createDto.getTitle());
assertThat(dto.getStartDate()).isNotNull().isEqualTo(createDto.getStartDate());

// create theme without body
// create announcement without body
var exception = given()
.when()
.contentType(APPLICATION_JSON)
Expand All @@ -106,7 +107,7 @@ void createAnnouncementTest() {
assertThat(exception.getErrorCode()).isEqualTo(AnnouncementMapper.ErrorKeys.CONSTRAINT_VIOLATIONS.name());
assertThat(exception.getDetail()).isEqualTo("createAnnouncement.createAnnouncementRequestDTO: must not be null");

// create theme with existing name
// create announcement with existing name
dto = given().when()
.contentType(APPLICATION_JSON)
.body(createDto)
Expand Down Expand Up @@ -165,9 +166,11 @@ void getAnnouncementTest() {

@Test
void updateAnnouncementTest() {

var updateDto = new UpdateAnnouncementRequestDTO();

updateDto.setTitle("test01");
updateDto.setContent("0.0.0");
updateDto.setStartDate(OffsetDateTime.parse("2000-03-10T12:15:50-04:00"));

given()
.contentType(APPLICATION_JSON)
Expand Down Expand Up @@ -195,6 +198,7 @@ void updateAnnouncementTest() {

assertThat(dto).isNotNull();
assertThat(dto.getTitle()).isEqualTo(updateDto.getTitle());
assertThat(dto.getStartDate()).isEqualTo(updateDto.getStartDate());
}

@Test
Expand Down

0 comments on commit 51dc6bc

Please sign in to comment.