Skip to content

Commit b358e22

Browse files
authored
add size validation to backend (#185)
1 parent cf76617 commit b358e22

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/com/redhat/labs/lodestar/model/Engagement.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import java.util.Set;
88

99
import javax.json.bind.annotation.JsonbProperty;
10+
import javax.validation.constraints.Size;
11+
1012
import com.fasterxml.jackson.annotation.JsonProperty;
1113
import com.redhat.labs.lodestar.validation.ValidName;
1214

@@ -26,9 +28,11 @@ public class Engagement {
2628

2729
private String uuid;
2830
@ValidName
31+
@Size(min = 3, max = 255)
2932
@JsonbProperty("customer_name")
3033
private String customerName;
3134
@ValidName
35+
@Size(min = 3, max = 255)
3236
private String name;
3337
@JsonbProperty("project_id") //Should this be sent to the FE?
3438
@DiffIgnore

src/test/java/com/redhat/labs/lodestar/resource/EngagementResourceJwtTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ void testPostEngagementWithAuthAndRoleHasUserClaim(String claimFile, String last
6565

6666
String token = TokenUtils.generateTokenString(claimFile);
6767

68-
Engagement engagement = Engagement.builder().uuid("uuid").customerName("c1").projectName("e1")
68+
Engagement engagement = Engagement.builder().uuid("uuid").customerName("c11").projectName("e11")
6969
.type("Residency").build();
7070

71-
Engagement created = Engagement.builder().uuid("uuid").customerName("c1").projectName("e1")
71+
Engagement created = Engagement.builder().uuid("uuid").customerName("c11").projectName("e11")
7272
.lastUpdateByName(lastUpdateName).lastUpdateByEmail(lastUpdateEmail).build();
7373

7474
Mockito.when(engagementApiClient.createEngagement(Mockito.any(Engagement.class))).thenReturn(created);

0 commit comments

Comments
 (0)