This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
ValidEmailAddressTest.java
113 lines (103 loc) · 4.66 KB
/
ValidEmailAddressTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Copyright 2013, Red Hat, Inc. and individual contributors as indicated by the
* @author tags. See the copyright.txt file in the distribution for a full
* listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
* site: http://www.fsf.org.
*/
package org.zanata.feature.account;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.experimental.categories.Category;
import org.junit.experimental.theories.DataPoint;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import org.zanata.feature.DetailedTest;
import org.zanata.feature.FunctionalTest;
import org.zanata.page.account.RegisterPage;
import org.zanata.util.rfc2822.ValidEmailAddressRFC2822;
import org.zanata.workflow.BasicWorkFlow;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.zanata.util.rfc2822.ValidEmailAddressRFC2822.*;
/**
* @author Damian Jansen <a
* href="mailto:djansen@redhat.com">djansen@redhat.com</a>
*/
@RunWith(Theories.class)
@Category(DetailedTest.class)
public class ValidEmailAddressTest {
@DataPoint
public static ValidEmailAddressRFC2822 TEST_BASIC_EMAIL = BASIC_EMAIL;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_SPECIAL_LOCALPART_CHARACTERS =
SPECIAL_CHARACTERS_LOCALPART;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_LOCALPART_MULTIPLE_LABELS =
LOCALPART_MULTIPLE_LABELS;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_DOMAIN_MULTIPLE_LABELS =
DOMAIN_MULTIPLE_LABELS;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_DOMAIN_LABEL_MAX_CHARACTERS =
DOMAIN_LABEL_MAX_CHARACTERS;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_LOCALPART_LABEL_MAX_CHARACTERS =
LOCALPART_LABEL_MAX_CHARACTERS;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_HYPHENATED_DOMAIN_LABEL =
HYPHENATED_DOMAIN_LABEL;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_HYPHENATED_LOCALPART_LABEL =
HYPHENATED_LOCALPART_LABEL;
@DataPoint
public static ValidEmailAddressRFC2822 TEST_LOCALPART_MAX_LENGTH =
LOCALPART_MAX_LENGTH;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_BASIC_QUOTED_EMAIL = BASIC_QUOTED_EMAIL;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_ENCLOSED_QUOTED_LABEL = ENCLOSED_QUOTED_LABEL;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_LOCALPART_EMPTY_QUOTE = LOCALPART_WITH_EMPTY_QUOTE;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_QUOTED_ESCAPED_SPECIAL_CHARACTERS =
// QUOTED_ESCAPED_SPECIAL_CHARACTERS;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_QUOTED_ESCAPED_QUOTES = QUOTED_ESCAPED_QUOTES;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_QUOTED_WITH_SPACE = QUOTED_WITH_SPACE;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_BRACKETED_DOMAIN = BRACKETED_DOMAIN;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_BRACKETED_IPV4_DOMAIN = BRACKETED_IPV4_DOMAIN;
// BUG982048 @DataPoint public static ValidEmailAddressRFC2822
// TEST_BRACKETED_IPV6_DOMAIN = BRACKETED_IPV6_DOMAIN;
@Before
public void setUp() {
new BasicWorkFlow().goToHome().deleteCookiesAndRefresh();
}
@Theory
public void validEmailAcceptance(ValidEmailAddressRFC2822 emailAddress) {
String errorMsg = "not a well-formed email address";
RegisterPage registerPage =
new BasicWorkFlow().goToHome().goToRegistration();
registerPage = registerPage.enterEmail(emailAddress.toString());
registerPage.defocus();
assertThat("Email validation errors are not shown",
registerPage.getFieldErrors(),
Matchers.not(Matchers.hasItem(errorMsg)));
}
}