Skip to content

Commit 2f931f0

Browse files
author
Hugo Marcellin
committed
Remove id check from tests
1 parent a3fa770 commit 2f931f0

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/main/java/org/gridsuite/studyconfig/server/dto/GlobalFilterInfos.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
@Schema(name = "GlobalFilterDto", description = "Global filter configuration")
2121
public record GlobalFilterInfos(
2222

23+
@JsonInclude(JsonInclude.Include.NON_NULL)
24+
@Schema(description = "Global filter UUID")
25+
UUID id,
26+
2327
@JsonInclude(JsonInclude.Include.NON_NULL)
2428
@Schema(description = "Generic filter ID")
2529
UUID uuid,

src/main/java/org/gridsuite/studyconfig/server/mapper/SpreadsheetConfigMapper.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,16 @@ public static ColumnEntity toColumnEntity(ColumnInfos dto) {
9393
}
9494

9595
public static GlobalFilterInfos toGlobalFilterDto(GlobalFilterEntity entity) {
96-
return new GlobalFilterInfos(
97-
entity.getUuid(),
98-
entity.getFilterType(),
99-
entity.getFilterSubtype(),
100-
entity.getLabel(),
101-
entity.isRecent(),
102-
entity.getEquipmentType(),
103-
entity.getPath()
104-
);
96+
return GlobalFilterInfos.builder()
97+
.uuid(entity.getUuid())
98+
.filterType(entity.getFilterType())
99+
.filterSubtype(entity.getFilterSubtype())
100+
.label(entity.getLabel())
101+
.recent(entity.isRecent())
102+
.equipmentType(entity.getEquipmentType())
103+
.path(entity.getPath())
104+
.build();
105+
105106
}
106107

107108
public static GlobalFilterEntity toGlobalFilterEntity(GlobalFilterInfos dto) {

src/test/java/org/gridsuite/studyconfig/server/DtoConverterTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ void testConversionToDtoOfSpreadsheetConfig() {
8484
assertThat(d.columns().get(1).filterValue()).isNull();
8585
// Global filters assertions
8686
assertThat(d.globalFilters()).hasSize(2);
87-
assertThat(d.globalFilters().get(0).id()).isNotNull();
8887
assertThat(d.globalFilters().get(0).label()).isEqualTo("GlobalFilter1");
89-
90-
assertThat(d.globalFilters().get(1).id()).isNotNull();
9188
assertThat(d.globalFilters().get(1).label()).isEqualTo("GlobalFilter2");
9289
});
9390
}
@@ -249,7 +246,6 @@ void testConversionToDtoOfGlobalFilter() {
249246
assertThat(dto)
250247
.as("DTO conversion result")
251248
.satisfies(d -> {
252-
assertThat(d.id()).isEqualTo(uuid);
253249
assertThat(d.uuid()).isEqualTo(filterId);
254250
assertThat(d.label()).isEqualTo("TestGlobalFilter");
255251
});

0 commit comments

Comments
 (0)