Skip to content

Commit b311eee

Browse files
committed
refactor(ParticipantValidation): omit PARTICIPANT_ prefix from the constants.
Fix #1037 No functional changes.
1 parent 9993b1e commit b311eee

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/main/java/ru/mystamps/web/feature/participant/AddParticipantForm.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,23 @@
2525
import javax.validation.constraints.NotNull;
2626
import javax.validation.constraints.Size;
2727

28-
import static ru.mystamps.web.feature.participant.ParticipantValidation.PARTICIPANT_NAME_MAX_LENGTH;
29-
import static ru.mystamps.web.feature.participant.ParticipantValidation.PARTICIPANT_NAME_MIN_LENGTH;
30-
import static ru.mystamps.web.feature.participant.ParticipantValidation.PARTICIPANT_URL_MAX_LENGTH;
28+
import static ru.mystamps.web.feature.participant.ParticipantValidation.NAME_MAX_LENGTH;
29+
import static ru.mystamps.web.feature.participant.ParticipantValidation.NAME_MIN_LENGTH;
30+
import static ru.mystamps.web.feature.participant.ParticipantValidation.URL_MAX_LENGTH;
3131

3232
@Getter
3333
@Setter
3434
public class AddParticipantForm implements AddParticipantDto {
3535

3636
@NotEmpty
3737
@Size.List({
38-
@Size(min = PARTICIPANT_NAME_MIN_LENGTH, message = "{value.too-short}"),
39-
@Size(max = PARTICIPANT_NAME_MAX_LENGTH, message = "{value.too-long}")
38+
@Size(min = NAME_MIN_LENGTH, message = "{value.too-short}"),
39+
@Size(max = NAME_MAX_LENGTH, message = "{value.too-long}")
4040
})
4141
private String name;
4242

4343
@URL
44-
@Size(max = PARTICIPANT_URL_MAX_LENGTH, message = "{value.too-long}")
44+
@Size(max = URL_MAX_LENGTH, message = "{value.too-long}")
4545
private String url;
4646

4747
// FIXME: must be positive

src/main/java/ru/mystamps/web/feature/participant/ParticipantValidation.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@
1919

2020
import ru.mystamps.web.feature.participant.ParticipantDb.TransactionParticipant;
2121

22-
// @todo #927 ParticipantValidation: remove PARTICIPANT_ prefix from the constants
2322
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
2423
public final class ParticipantValidation {
2524

26-
public static final int PARTICIPANT_NAME_MIN_LENGTH = 3;
27-
public static final int PARTICIPANT_NAME_MAX_LENGTH = TransactionParticipant.NAME_LENGTH;
28-
static final int PARTICIPANT_URL_MAX_LENGTH = TransactionParticipant.URL_LENGTH;
25+
public static final int NAME_MIN_LENGTH = 3;
26+
public static final int NAME_MAX_LENGTH = TransactionParticipant.NAME_LENGTH;
27+
static final int URL_MAX_LENGTH = TransactionParticipant.URL_LENGTH;
2928

3029
private ParticipantValidation() {
3130
}

src/test/java/ru/mystamps/web/tests/Random.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ public static String countrySlug() {
176176

177177
public static String participantName() {
178178
return between(
179-
ParticipantValidation.PARTICIPANT_NAME_MIN_LENGTH,
180-
ParticipantValidation.PARTICIPANT_NAME_MAX_LENGTH
179+
ParticipantValidation.NAME_MIN_LENGTH,
180+
ParticipantValidation.NAME_MAX_LENGTH
181181
).english();
182182
}
183183

0 commit comments

Comments
 (0)