Skip to content

Commit e3c1a17

Browse files
committed
pom.xml: updated fest-assert to 2.0M7
@see https://github.com/alexruiz/fest-assert-2.x/blob/master/release-notes.txt Also uncommented overridingErrorMessage() calls. No functional changes.
1 parent e056b42 commit e3c1a17

11 files changed

+78
-78
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<testng.version>6.7</testng.version>
2727
<mockito.version>1.9.0</mockito.version>
28-
<fest.assert.version>2.0M6</fest.assert.version>
28+
<fest.assert.version>2.0M7</fest.assert.version>
2929
<powermock.version>1.4.12</powermock.version>
3030

3131
<java.version>1.6</java.version>

src/test/java/ru/mystamps/web/tests/cases/WhenAnonymousUserActivateAccount.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public void afterActivationShouldExistsMessageWithLinkForAuthentication() {
288288
assertThat(page.textPresent(stripHtmlTags(tr("t_activation_successful")))).isTrue();
289289

290290
assertThat(page.existsLinkTo(Url.AUTHENTICATION_PAGE))
291-
//.overridingErrorMessage("should exists link to authentication page")
291+
.overridingErrorMessage("should exists link to authentication page")
292292
.isTrue();
293293
}
294294

src/test/java/ru/mystamps/web/tests/cases/WhenAnonymousUserAtIndexPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ public void shouldAbsentWelcomeText() {
5252
@Test(groups = "misc", dependsOnGroups = "std")
5353
public void linkForAddingSeriesShouldBeAbsent() {
5454
assertThat(page.linkWithLabelExists(tr("t_add_series")))
55-
//.overridingErrorMessage("should absent link to page for adding series of stamps")
55+
.overridingErrorMessage("should absent link to page for adding series of stamps")
5656
.isFalse();
5757
}
5858

5959
@Test(groups = "misc", dependsOnGroups = "std")
6060
public void linkForAddingCountriesShouldBeAbsent() {
6161
assertThat(page.linkWithLabelExists(tr("t_add_country")))
62-
//.overridingErrorMessage("should absent link to page for adding countries")
62+
.overridingErrorMessage("should absent link to page for adding countries")
6363
.isFalse();
6464
}
6565

src/test/java/ru/mystamps/web/tests/cases/WhenAnonymousUserAuthenticates.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ public void validCredentialsShouldAuthenticateUserOnSite() {
8383
page.authorizeUser(validUserLogin, validUserPassword);
8484

8585
assertThat(page.getCurrentUrl())
86-
//.overridingErrorMessage("after login we should be redirected to main page")
86+
.overridingErrorMessage("after login we should be redirected to main page")
8787
.isEqualTo(Url.INDEX_PAGE);
8888

8989
assertThat(page.getUserBarEntries())
90-
//.overridingErrorMessage("after login user name should be in user bar")
90+
.overridingErrorMessage("after login user name should be in user bar")
9191
.contains(validUserName);
9292

9393
assertThat(page.getUserBarEntries())
94-
//.overridingErrorMessage("after login link for logout should be in user bar")
94+
.overridingErrorMessage("after login link for logout should be in user bar")
9595
.contains(tr("t_logout"));
9696

9797
page.logout();

src/test/java/ru/mystamps/web/tests/cases/WhenAnonymousUserRegisterAccount.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void shouldExistsMessageWithLinkToAuthenticationPage() {
5757
assertThat(page.getFormHints()).contains(stripHtmlTags(tr("t_if_you_already_registered")));
5858

5959
assertThat(page.existsLinkTo(Url.AUTHENTICATION_PAGE))
60-
//.overridingErrorMessage("should exists link to authentication page")
60+
.overridingErrorMessage("should exists link to authentication page")
6161
.isTrue();
6262
}
6363

src/test/java/ru/mystamps/web/tests/cases/WhenAnyUserAtAnyPage.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected void checkStandardStructure() {
9898

9999
protected void checkServerResponseCode() {
100100
assertThat(page.getServerResponseCode())
101-
//.overridingErrorMessage("Server response code")
101+
.overridingErrorMessage("Server response code")
102102
.isEqualTo(serverCode);
103103
}
104104

@@ -110,47 +110,47 @@ private void shouldHaveTitle() {
110110
);
111111

112112
assertThat(page.getTitle())
113-
//.overridingErrorMessage("title should be '" + title + "'")
113+
.overridingErrorMessage("title should be '" + title + "'")
114114
.isEqualTo(title);
115115
}
116116

117117
private void shouldHaveLogo() {
118118
assertThat(page.getTextAtLogo())
119-
//.overridingErrorMessage("text at logo should be '" + tr("t_my_stamps") + "'")
119+
.overridingErrorMessage("text at logo should be '" + tr("t_my_stamps") + "'")
120120
.isEqualTo(tr("t_my_stamps"));
121121
}
122122

123123
protected void shouldHaveUserBar() {
124124
assertThat(page.userBarExists())
125-
//.overridingErrorMessage("user bar should exists")
125+
.overridingErrorMessage("user bar should exists")
126126
.isTrue();
127127

128128
assertThat(page.linkWithLabelExists(tr("t_enter")))
129-
//.overridingErrorMessage("should exists link to authentication page")
129+
.overridingErrorMessage("should exists link to authentication page")
130130
.isTrue();
131131

132132
assertThat(page.linkWithLabelExists(tr("t_register")))
133-
//.overridingErrorMessage("should exists link to registration page")
133+
.overridingErrorMessage("should exists link to registration page")
134134
.isTrue();
135135
}
136136

137137
private void shouldHaveContentArea() {
138138
assertThat(page.contentAreaExists())
139-
//.overridingErrorMessage("should exists content area")
139+
.overridingErrorMessage("should exists content area")
140140
.isTrue();
141141
}
142142

143143
private void mayHaveHeader() {
144144
if (header != null) {
145145
assertThat(page.getHeader())
146-
//.overridingErrorMessage("header should exists")
146+
.overridingErrorMessage("header should exists")
147147
.isEqualTo(header);
148148
}
149149
}
150150

151151
private void shouldHaveFooter() {
152152
assertThat(page.footerExists())
153-
//.overridingErrorMessage("footer should exists")
153+
.overridingErrorMessage("footer should exists")
154154
.isTrue();
155155

156156
assertThat(
@@ -159,7 +159,7 @@ private void shouldHaveFooter() {
159159
tr("t_write_email")
160160
)
161161
)
162-
//.overridingErrorMessage("should exists link with author's email")
162+
.overridingErrorMessage("should exists link with author's email")
163163
.isTrue();
164164
}
165165

src/test/java/ru/mystamps/web/tests/cases/WhenAnyUserAtAnyPageWithForm.java

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ protected void checkStandardStructure() {
5353

5454
private void shouldHaveForm() {
5555
assertThat(page.formExists())
56-
//.overridingErrorMessage("form tag should exists")
56+
.overridingErrorMessage("form tag should exists")
5757
.isTrue();
5858
}
5959

6060
private void shouldHaveFields() {
6161
for (final Field field : page.getForm().getFields()) {
6262
assertThat(page.isFieldExists(field))
63-
//.overridingErrorMessage("field with XPath '" + field + "' should exists")
63+
.overridingErrorMessage("field with XPath '" + field + "' should exists")
6464
.isTrue();
6565
}
6666
}
@@ -71,38 +71,38 @@ private void shouldHaveLabels() {
7171
continue;
7272
}
7373

74-
//final String msg = String.format(
75-
// "field with id '%s' should have label '%s'",
76-
// field.getId(),
77-
// field.getLabel()
78-
//);
74+
final String msg = String.format(
75+
"field with id '%s' should have label '%s'",
76+
field.getId(),
77+
field.getLabel()
78+
);
7979

8080
assertThat(page.getInputLabelValue(field.getId()))
81-
//.overridingErrorMessage(msg)
81+
.overridingErrorMessage(msg)
8282
.isEqualTo(field.getLabel());
8383
}
8484
}
8585

8686
private void shouldHaveSubmitButton() {
8787
for (final SubmitButton button : page.getForm().getSubmitButtons()) {
8888
assertThat(page.isSubmitButtonExists(button))
89-
//.overridingErrorMessage(
90-
// String.format(
91-
// "submit button with value '%s' should exists", button.getValue()
92-
// )
93-
//)
89+
.overridingErrorMessage(
90+
String.format(
91+
"submit button with value '%s' should exists", button.getValue()
92+
)
93+
)
9494
.isTrue();
9595
}
9696
}
9797

9898
private void requiredFieldsShouldBeMarkedByAsterisk() {
9999
for (final Field field : page.getForm().getRequiredFields()) {
100100
assertThat(page.inputHasAsterisk(field.getId()))
101-
//.overridingErrorMessage(
102-
// String.format(
103-
// "required field with id '%s' should be marked by asterisk", field.getId()
104-
// )
105-
//)
101+
.overridingErrorMessage(
102+
String.format(
103+
"required field with id '%s' should be marked by asterisk", field.getId()
104+
)
105+
)
106106
.isTrue();
107107
}
108108
}
@@ -113,7 +113,7 @@ private void mayExistsLegendAboutRequiredFields() {
113113
}
114114

115115
assertThat(page.getFormHints())
116-
//.overridingErrorMessage("legend about required fields should exists")
116+
.overridingErrorMessage("legend about required fields should exists")
117117
.contains(tr("t_required_fields_legend", "*"));
118118
}
119119

@@ -127,11 +127,11 @@ protected void emptyValueShouldBeForbiddenForRequiredFields() {
127127

128128
for (final Field field : requiredFields) {
129129
assertThat(page.getFieldError(field.getId()))
130-
//.overridingErrorMessage(
131-
// String.format(
132-
// "required field with id '%s' should not accept empty value", field.getId()
133-
// )
134-
//)
130+
.overridingErrorMessage(
131+
String.format(
132+
"required field with id '%s' should not accept empty value", field.getId()
133+
)
134+
)
135135
.isEqualTo(tr("org.hibernate.validator.constraints.NotEmpty.message"));
136136
}
137137
}
@@ -152,23 +152,23 @@ private void fieldsValuesShouldBePreservedWhenErrorOccurs() {
152152
page.submit();
153153

154154
if (field.shouldPreserveInvalidValue()) {
155-
//final String msg = String.format(
156-
// "field named '%s' should preserve input value after error",
157-
// field.getName()
158-
//);
155+
final String msg = String.format(
156+
"field named '%s' should preserve input value after error",
157+
field.getName()
158+
);
159159

160160
assertThat(page.getFieldValue(field.getName()))
161-
//.overridingErrorMessage(msg)
161+
.overridingErrorMessage(msg)
162162
.isEqualTo(field.getInvalidValue());
163163

164164
} else {
165-
//final String msg = String.format(
166-
// "field named '%s' should not preserve input value after error",
167-
// field.getName()
168-
//);
165+
final String msg = String.format(
166+
"field named '%s' should not preserve input value after error",
167+
field.getName()
168+
);
169169

170170
assertThat(page.getFieldValue(field.getName()))
171-
//.overridingErrorMessage(msg)
171+
.overridingErrorMessage(msg)
172172
.isEmpty();
173173
}
174174
}

src/test/java/ru/mystamps/web/tests/cases/WhenUserAtIndexPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ public void shouldExistsWelcomeText() {
6767
@Test(groups = "misc", dependsOnGroups = "std")
6868
public void shouldExistsLinkForAddingSeries() {
6969
assertThat(page.linkWithLabelExists(tr("t_add_series")))
70-
//.overridingErrorMessage("should exists link to page for adding series of stamps")
70+
.overridingErrorMessage("should exists link to page for adding series of stamps")
7171
.isTrue();
7272
}
7373

7474
@Test(groups = "misc", dependsOnGroups = "std")
7575
public void shouldExistsLinkForAddingCountries() {
7676
assertThat(page.linkWithLabelExists(tr("t_add_country")))
77-
//.overridingErrorMessage("should exists link to page for adding countries")
77+
.overridingErrorMessage("should exists link to page for adding countries")
7878
.isTrue();
7979
}
8080

src/test/java/ru/mystamps/web/tests/cases/WhenUserLogsOut.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ public void shouldRedirectAndClearSession() {
4646
page.open();
4747

4848
assertThat(page.getCurrentUrl())
49-
//.overridingErrorMessage("after logout we should be redirected to main page")
49+
.overridingErrorMessage("after logout we should be redirected to main page")
5050
.isEqualTo(Url.INDEX_PAGE);
5151

5252
assertThat(page.linkWithLabelExists(tr("t_enter")))
53-
//.overridingErrorMessage("should exists link to authentication page")
53+
.overridingErrorMessage("should exists link to authentication page")
5454
.isTrue();
5555

5656
assertThat(page.linkWithLabelExists(tr("t_register")))
57-
//.overridingErrorMessage("should exists link to registration page")
57+
.overridingErrorMessage("should exists link to registration page")
5858
.isTrue();
5959
}
6060

src/test/java/ru/mystamps/web/tests/fest/AbstractPageWithFormAssert.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ public AbstractPageWithFormAssert hasError(final String expectedErrorMessage) {
5454

5555
final String errorMessage = actual.getFieldError(fieldName);
5656

57-
//final String msg = String.format(
58-
// "Expected that field '%s' should have error '%s' but was '%s'",
59-
// fieldName,
60-
// expectedErrorMessage,
61-
// errorMessage
62-
//);
57+
final String msg = String.format(
58+
"Expected that field '%s' should have error '%s' but was '%s'",
59+
fieldName,
60+
expectedErrorMessage,
61+
errorMessage
62+
);
6363

6464
Assertions.assertThat(errorMessage)
65-
//.overridingErrorMessage(msg)
65+
.overridingErrorMessage(msg)
6666
.isEqualTo(expectedErrorMessage);
6767

6868
return this;
@@ -72,13 +72,13 @@ public AbstractPageWithFormAssert hasNoError() {
7272
isNotNull();
7373
checkState(fieldName != null, "Error in test case: field name should be specified");
7474

75-
//final String msg = String.format(
76-
// "Expected that field '%s' should not have any error",
77-
// fieldName
78-
//);
75+
final String msg = String.format(
76+
"Expected that field '%s' should not have any error",
77+
fieldName
78+
);
7979

8080
Assertions.assertThat(actual.isFieldHasError(fieldName))
81-
//.overridingErrorMessage(msg)
81+
.overridingErrorMessage(msg)
8282
.isFalse();
8383

8484
return this;
@@ -90,15 +90,15 @@ public AbstractPageWithFormAssert hasValue(final String expectedValue) {
9090

9191
final String value = actual.getFieldValue(fieldName);
9292

93-
//final String msg = String.format(
94-
// "Expected value of field '%s' is '%s' but was '%s'",
95-
// fieldName,
96-
// expectedValue,
97-
// value
98-
//);
93+
final String msg = String.format(
94+
"Expected value of field '%s' is '%s' but was '%s'",
95+
fieldName,
96+
expectedValue,
97+
value
98+
);
9999

100100
Assertions.assertThat(value)
101-
//.overridingErrorMessage(msg)
101+
.overridingErrorMessage(msg)
102102
.isEqualTo(expectedValue);
103103

104104
return this;

src/test/java/ru/mystamps/web/tests/fest/DateAssert.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public DateAssert isCurrentDate() {
4848
isNotNull();
4949

5050
final Date now = new Date();
51-
//final String msg = String.format("%s is not current date. Expected: %s", actual, now);
51+
final String msg = String.format("%s is not current date. Expected: %s", actual, now);
5252

5353
Assertions.assertThat(actual)
54-
//.overridingErrorMessage(msg)
54+
.overridingErrorMessage(msg)
5555
.isCloseTo(now, TimeUnit.SECONDS.toMillis(TIME_DELTA));
5656

5757
return this;

0 commit comments

Comments
 (0)