Source Code Cross Referenced for AccountTest.java in  » Testing » springunit-0.6 » org » springunit » framework » samples » jpetstore » domain » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » springunit 0.6 » org.springunit.framework.samples.jpetstore.domain 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.springunit.framework.samples.jpetstore.domain;
002:
003:        import org.springunit.framework.SpringUnitContext;
004:        import org.springunit.framework.SpringUnitTest;
005:
006:        /**
007:         * Test for the Account domain object in the JPetStore sample application.
008:         * This test reveals a SpringUnit anti-pattern:
009:         * if testing of a method does not require variation of the data,
010:         * then moving the test data into a separate XML file
011:         * introduces unnecessary overhead.
012:         * For the Account class, only two methods fall into this
013:         * category: getListOptionAsInt and getBannerOptionAsInt.
014:         * If tested at all, only these two methods require testing.
015:         * There exists a strong argument for not testing the class
016:         * at all, since there is nothing that could possibly break
017:         * (that could not be identified easily by code inspection).
018:         * @author <a href="mailto:ted@velkoff.com">Ted Velkoff</a>
019:         *
020:         */
021:        public class AccountTest extends SpringUnitTest {
022:
023:            public void testUsername() throws Exception {
024:                Account subject = getObject("subject");
025:                String username = getObject("username");
026:                String expected = getObject("expected");
027:                subject.setUsername(username);
028:                String actual = subject.getUsername();
029:                assertTrue(expected.equals(actual));
030:            }
031:
032:            public void testPassword() throws Exception {
033:                Account subject = getObject("subject");
034:                String password = getObject("password");
035:                String expected = getObject("expected");
036:                subject.setPassword(password);
037:                String actual = subject.getPassword();
038:                assertTrue(expected.equals(actual));
039:            }
040:
041:            public void testEmail() throws Exception {
042:                Account subject = getObject("subject");
043:                String email = getObject("email");
044:                String expected = getObject("expected");
045:                subject.setEmail(email);
046:                String actual = subject.getEmail();
047:                assertTrue(expected.equals(actual));
048:            }
049:
050:            public void testFirstName() throws Exception {
051:                Account subject = getObject("subject");
052:                String firstName = getObject("firstName");
053:                String expected = getObject("expected");
054:                subject.setFirstName(firstName);
055:                String actual = subject.getFirstName();
056:                assertTrue(expected.equals(actual));
057:            }
058:
059:            public void testLastName() throws Exception {
060:                Account subject = getObject("subject");
061:                String lastName = getObject("lastName");
062:                String expected = getObject("expected");
063:                subject.setLastName(lastName);
064:                String actual = subject.getLastName();
065:                assertTrue(expected.equals(actual));
066:            }
067:
068:            public void testStatus() throws Exception {
069:                Account subject = getObject("subject");
070:                String status = getObject("status");
071:                String expected = getObject("expected");
072:                subject.setStatus(status);
073:                String actual = subject.getStatus();
074:                assertTrue(expected.equals(actual));
075:            }
076:
077:            public void testAddress1() throws Exception {
078:                Account subject = getObject("subject");
079:                String address1 = getObject("address1");
080:                String expected = getObject("expected");
081:                subject.setAddress1(address1);
082:                String actual = subject.getAddress1();
083:                assertTrue(expected.equals(actual));
084:            }
085:
086:            public void testAddress2() throws Exception {
087:                Account subject = getObject("subject");
088:                String address2 = getObject("address2");
089:                String expected = getObject("expected");
090:                subject.setAddress2(address2);
091:                String actual = subject.getAddress2();
092:                assertTrue(expected.equals(actual));
093:            }
094:
095:            public void testCity() throws Exception {
096:                Account subject = getObject("subject");
097:                String city = getObject("city");
098:                String expected = getObject("expected");
099:                subject.setCity(city);
100:                String actual = subject.getCity();
101:                assertTrue(expected.equals(actual));
102:            }
103:
104:            public void testState() throws Exception {
105:                Account subject = getObject("subject");
106:                String state = getObject("state");
107:                String expected = getObject("expected");
108:                subject.setState(state);
109:                String actual = subject.getState();
110:                assertTrue(expected.equals(actual));
111:            }
112:
113:            public void testZip() throws Exception {
114:                Account subject = getObject("subject");
115:                String zip = getObject("zip");
116:                String expected = getObject("expected");
117:                subject.setZip(zip);
118:                String actual = subject.getZip();
119:                assertTrue(expected.equals(actual));
120:            }
121:
122:            public void testCountry() throws Exception {
123:                Account subject = getObject("subject");
124:                String country = getObject("country");
125:                String expected = getObject("expected");
126:                subject.setCountry(country);
127:                String actual = subject.getCountry();
128:                assertTrue(expected.equals(actual));
129:            }
130:
131:            public void testPhone() throws Exception {
132:                Account subject = getObject("subject");
133:                String phone = getObject("phone");
134:                String expected = getObject("expected");
135:                subject.setPhone(phone);
136:                String actual = subject.getPhone();
137:                assertTrue(expected.equals(actual));
138:            }
139:
140:            public void testFavouriteCategory() throws Exception {
141:                Account subject = getObject("subject");
142:                Category favouriteCategory = getObject("favouriteCategory");
143:                Category expected = getObject("expected");
144:                subject.setFavouriteCategory(favouriteCategory);
145:                Category actual = subject.getFavouriteCategory();
146:                assertTrue(expected.equals(actual));
147:            }
148:
149:            public void testLanguagePreference() throws Exception {
150:                Account subject = getObject("subject");
151:                String languagePreference = getObject("languagePreference");
152:                String expected = getObject("expected");
153:                subject.setLanguagePreference(languagePreference);
154:                String actual = subject.getLanguagePreference();
155:                assertTrue(expected.equals(actual));
156:            }
157:
158:            public void testBannerName() throws Exception {
159:                Account subject = getObject("subject");
160:                String bannerName = getObject("bannerName");
161:                String expected = getObject("expected");
162:                subject.setBannerName(bannerName);
163:                String actual = subject.getBannerName();
164:                assertTrue(expected.equals(actual));
165:            }
166:
167:            public void testIsListOption() throws Exception {
168:                Account subject = getObject("subject");
169:                Integer isListOption = getObject("isListOption");
170:                Integer expected = getObject("expected");
171:                subject.setListOption(isListOption);
172:                int actual = subject.isListOption();
173:                assertTrue(expected.equals(actual));
174:            }
175:
176:            public void testIsBannerOption() throws Exception {
177:                Account subject = getObject("subject");
178:                Integer isBannerOption = getObject("isBannerOption");
179:                Integer expected = getObject("expected");
180:                subject.setBannerOption(isBannerOption);
181:                int actual = subject.isBannerOption();
182:                assertTrue(expected.equals(actual));
183:            }
184:
185:            public void testEqualsSame() throws Exception {
186:                Account subject = getObject("subject");
187:                Account other = getObject("other");
188:                assertTrue(subject == other);
189:                assertTrue(subject.equals(other));
190:            }
191:
192:            public void testEqualsNotSame() throws Exception {
193:                Account subject = getObject("subject");
194:                Account other = getObject("other");
195:                assertFalse(subject == other);
196:                assertTrue(subject.equals(other));
197:            }
198:
199:            public void testEqualsTypeMismatch() throws Exception {
200:                Account subject = getObject("subject");
201:                Integer other = getObject("other");
202:                assertTrue(!subject.equals(other));
203:            }
204:
205:            public void testCompareToLessThan() throws Exception {
206:                Account subject = getObject("subject");
207:                Account other = getObject("other");
208:                assertTrue(subject.compareTo(other) < 0);
209:            }
210:
211:            public void testCompareToGreaterThan() throws Exception {
212:                Account subject = getObject("subject");
213:                Account other = getObject("other");
214:                assertTrue(subject.compareTo(other) > 0);
215:            }
216:
217:            public void testCompareToEquals() throws Exception {
218:                Account subject = getObject("subject");
219:                Account other = getObject("other");
220:                assertTrue(subject.compareTo(other) == 0);
221:            }
222:
223:            public void testHashCodeSame() throws Exception {
224:                Account subject = getObject("subject");
225:                Account other = getObject("other");
226:                assertTrue(subject.hashCode() == other.hashCode());
227:            }
228:
229:            public void testHashCodeDifferent() throws Exception {
230:                Account subject = getObject("subject");
231:                Account other = getObject("other");
232:                assertTrue(subject.hashCode() != other.hashCode());
233:            }
234:
235:            public void testToString() throws Exception {
236:                Account subject = getObject("subject");
237:                String s = subject.toString();
238:            }
239:
240:            public SpringUnitContext getAccountTest() {
241:                return accountTest;
242:            }
243:
244:            public void setAccountTest(SpringUnitContext accountTest) {
245:                this .accountTest = accountTest;
246:            }
247:
248:            private SpringUnitContext accountTest;
249:
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.