Skip to content

Commit

Permalink
32920 Fix ObjectExportNotification to string and constructor
Browse files Browse the repository at this point in the history
Fixed Lombok annotaiton + added tests
  • Loading branch information
cgendreau committed Feb 5, 2024
1 parent b11f4cd commit 311d92c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dina-messaging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.aafc-bicoe</groupId>
<artifactId>dina-test-support</artifactId>
<version>0.117-SNAPSHOT</version>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import ca.gc.aafc.dina.messaging.DinaMessage;

@Builder
@AllArgsConstructor
@Data
@NoArgsConstructor
@Getter
public class ObjectExportNotification implements DinaMessage {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package ca.gc.aafc.dina.messaging.message;

import java.util.UUID;

import org.junit.jupiter.api.Test;

import com.fasterxml.jackson.core.JsonProcessingException;

import ca.gc.aafc.dina.testsupport.TestResourceHelper;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class ObjectExportNotificationIT {

@Test
public void testSerDe() throws JsonProcessingException {

ObjectExportNotification oen = ObjectExportNotification.builder()
.uuid(UUID.randomUUID())
.username("user")
.toa("toa").build();

String asJson = TestResourceHelper.OBJECT_MAPPER.writeValueAsString(oen);

ObjectExportNotification oen2 = TestResourceHelper.OBJECT_MAPPER.readValue(asJson, ObjectExportNotification.class);
assertEquals(oen, oen2);
}
}

0 comments on commit 311d92c

Please sign in to comment.