Skip to content

Commit bb89605

Browse files
committedMar 6, 2025
add validation to match database constraints #657
(cherry picked from commit 817026e)
1 parent 37a1c7d commit bb89605

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
 

‎pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<spring-cloud-sleuth.version>2.2.8.RELEASE</spring-cloud-sleuth.version>
8989

9090
<!-- GBIF -->
91-
<gbif-api.version>2.0.4</gbif-api.version>
91+
<gbif-api.version>2.0.5-SNAPSHOT</gbif-api.version>
9292
<gbif-common.version>0.59</gbif-common.version>
9393
<gbif-common-mybatis.version>2.0.0</gbif-common-mybatis.version>
9494
<gbif-common-ws.version>2.0.0</gbif-common-ws.version>

‎registry-integration-tests/src/test/java/org/gbif/registry/ws/it/collections/service/suggestions/BaseChangeSuggestionServiceIT.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ public void updateContactsTest() {
599599
.filter(c -> c.getKey().equals(contact1.getKey()))
600600
.findFirst()
601601
.get()
602-
.setModifiedBy("11");
602+
.setModifiedBy("111");
603603

604604
R suggestion3 = createEmptyChangeSuggestion();
605605
suggestion3.setSuggestedEntity(entity);
@@ -614,6 +614,23 @@ public void updateContactsTest() {
614614
// Then
615615
suggestion3 = changeSuggestionService.getChangeSuggestion(sugg3Key);
616616
assertEquals(0, suggestion3.getChanges().size());
617+
618+
// suggestion to change contact1 with an invalid name
619+
entity.getContactPersons().stream()
620+
.filter(c -> c.getKey().equals(contact1.getKey()))
621+
.findFirst()
622+
.get()
623+
.setFirstName("");
624+
625+
R suggestion4 = createEmptyChangeSuggestion();
626+
suggestion4.setSuggestedEntity(entity);
627+
suggestion4.setType(Type.UPDATE);
628+
suggestion4.setEntityKey(entityKey);
629+
suggestion4.setProposerEmail(PROPOSER);
630+
suggestion4.setComments(Collections.singletonList("contact1"));
631+
632+
assertThrows(ValidationException.class,
633+
() -> changeSuggestionService.createChangeSuggestion(suggestion4));
617634
}
618635

619636
protected void assertCreatedSuggestion(R created) {

0 commit comments

Comments
 (0)
Please sign in to comment.