geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r462562 - in /geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory: UserTest.java model/User.java
Date Tue, 10 Oct 2006 20:58:25 GMT
Author: dain
Date: Tue Oct 10 13:58:24 2006
New Revision: 462562

URL: http://svn.apache.org/viewvc?view=rev&rev=462562
Log:
Added a simpler test case

Added:
    geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/UserTest.java
    geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/model/User.java

Added: geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/UserTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/UserTest.java?view=auto&rev=462562
==============================================================================
--- geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/UserTest.java
(added)
+++ geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/UserTest.java
Tue Oct 10 13:58:24 2006
@@ -0,0 +1,50 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.xbean.factory;
+
+import junit.framework.TestCase;
+import org.apache.xbean.factory.model.User;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class UserTest extends TestCase {
+    private User user;
+
+    public void test() {
+        User testUser = loadUser();
+        assertNotNull(testUser);
+        assertEquals(user.getPk(), testUser.getPk());
+        assertEquals(user.getName(), testUser.getName());
+        assertEquals(user.getFullName(), testUser.getFullName());
+        assertEquals(user.getPhoneNumber(), testUser.getPhoneNumber());
+        assertEquals(user, testUser);
+    }
+
+    public User loadUser() {
+        User testUser = new User(42, "dain", "Dain Sundstrom");
+        testUser.setPhoneNumber("(310) XXX-XXXX");
+        return testUser;
+    }
+
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        user = new User(42, "dain", "Dain Sundstrom");
+        user.setPhoneNumber("(310) XXX-XXXX");
+    }
+}

Added: geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/model/User.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/model/User.java?view=auto&rev=462562
==============================================================================
--- geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/model/User.java
(added)
+++ geronimo/xbean/sandbox/xbean-factory/src/test/java/org/apache/xbean/factory/model/User.java
Tue Oct 10 13:58:24 2006
@@ -0,0 +1,91 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.xbean.factory.model;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class User {
+    private long pk;
+    private String name;
+    private String fullName;
+    private String phoneNumber;
+
+    public User() {
+    }
+
+    public User(long pk, String name, String fullName) {
+        this.pk = pk;
+        this.name = name;
+        this.fullName = fullName;
+    }
+
+    public long getPk() {
+        return pk;
+    }
+
+    public void setPk(long pk) {
+        this.pk = pk;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getFullName() {
+        return fullName;
+    }
+
+    public void setFullName(String fullName) {
+        this.fullName = fullName;
+    }
+
+    public String getPhoneNumber() {
+        return phoneNumber;
+    }
+
+    public void setPhoneNumber(String phoneNumber) {
+        this.phoneNumber = phoneNumber;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        final User user = (User) o;
+
+        if (pk != user.pk) return false;
+        if (fullName != null ? !fullName.equals(user.fullName) : user.fullName != null) return
false;
+        if (name != null ? !name.equals(user.name) : user.name != null) return false;
+        if (phoneNumber != null ? !phoneNumber.equals(user.phoneNumber) : user.phoneNumber
!= null) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        int result;
+        result = (int) (pk ^ (pk >>> 32));
+        result = 29 * result + (name != null ? name.hashCode() : 0);
+        result = 29 * result + (fullName != null ? fullName.hashCode() : 0);
+        result = 29 * result + (phoneNumber != null ? phoneNumber.hashCode() : 0);
+        return result;
+    }
+}



Mime
View raw message