Skip to content

Commit 18331c1

Browse files
Review No.2 Fields are matched: message has been got. Added correct annotation and messages
1 parent 0892f93 commit 18331c1

File tree

3 files changed

+71
-60
lines changed

3 files changed

+71
-60
lines changed

src/main/java/ru/mystamps/web/feature/series/sale/AddSeriesSalesForm.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.hibernate.validator.constraints.URL;
2323
import org.springframework.format.annotation.DateTimeFormat;
2424
import ru.mystamps.web.dao.dto.Currency;
25+
import ru.mystamps.web.support.beanvalidation.FieldsMismatch;
2526
import ru.mystamps.web.support.beanvalidation.Group;
2627
import ru.mystamps.web.validation.ValidationRules;
2728

@@ -31,8 +32,14 @@
3132
import java.math.BigDecimal;
3233
import java.util.Date;
3334

35+
// @todo #503 Add integration test to ensure that seller and buyer are different
3436
@Getter
3537
@Setter
38+
@FieldsMismatch(
39+
first = "sellerId",
40+
second = "buyerId",
41+
message = "{seller.buyer.match}"
42+
)
3643
public class AddSeriesSalesForm implements AddSeriesSalesDto {
3744

3845
@DateTimeFormat(pattern = "dd.MM.yyyy")

src/main/resources/ru/mystamps/i18n/ValidationMessages.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ login.repetition_chars = Login must not contain repetition of hyphen, dot or und
4949
password.mismatch = Password mismatch
5050
password.login.match = Password and login must be different
5151

52+
seller.buyer.match = Seller and buyer must be different
53+
5254
name.invalid = Name must consist only letters, hyphen or spaces
5355

5456
key.invalid = Key must consist only latin letters in lower case or digits

0 commit comments

Comments
 (0)