Skip to content

Commit

Permalink
changed EntityChange to use timestamp as jsonProperty instead of date…
Browse files Browse the repository at this point in the history
…Time.
  • Loading branch information
soimugeo committed Dec 24, 2024
1 parent 175981a commit d06e753
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package edu.stanford.protege.webprotegeeventshistory.uiHistoryConcern.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import edu.stanford.protege.webprotege.common.UserId;

import java.time.LocalDateTime;

public record EntityChange(String changeSummary,
UserId userId,
LocalDateTime dateTime) {
@JsonProperty("timestamp") LocalDateTime timestamp) {

public static EntityChange create(String changeSummary,
UserId userId,
LocalDateTime dateTime){
return new EntityChange(changeSummary,userId,dateTime);
LocalDateTime timestamp){
return new EntityChange(changeSummary,userId,timestamp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ public void GIVEN_validHistoryForEntity_WHEN_getEntityHistorySummaryCalled_THEN_
EntityChange entityUpdate = result.changes().get(0);
assertEquals("Update", entityUpdate.changeSummary());
assertEquals(userId2, entityUpdate.userId());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp2), ZoneId.of("UTC")), entityUpdate.dateTime());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp2), ZoneId.of("UTC")), entityUpdate.timestamp());

EntityChange entityCreate = result.changes().get(1);
assertEquals("Create", entityCreate.changeSummary());
assertEquals(userId1, entityCreate.userId());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp1), ZoneId.of("UTC")), entityCreate.dateTime());
assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp1), ZoneId.of("UTC")), entityCreate.timestamp());

verify(repository).findByProjectIdAndWhoficEntityIriOrderByTimestampDesc(projectId, entityIri);
verify(projectChangeMapper).mapProjectChangeDocumentToProjectChange(eventCreate.projectChange());
Expand Down

0 comments on commit d06e753

Please sign in to comment.