Author: mfranklin
Date: Tue Jun 19 19:37:11 2012
New Revision: 1351814
URL: http://svn.apache.org/viewvc?rev=1351814&view=rev
Log:
Updated Person conversion RAVE-652
Modified:
rave/branches/model_interfaces/rave-components/rave-jpa/src/test/java/org/apache/rave/portal/model/conversion/JpaPersonConverterTest.java
Modified:
rave/branches/model_interfaces/rave-components/rave-jpa/src/test/java/org/apache/rave/portal/model/conversion/JpaPersonConverterTest.java
URL:
http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-components/rave-jpa/src/test/java/org/apache/rave/portal/model/conversion/JpaPersonConverterTest.java?rev=1351814&r1=1351813&r2=1351814&view=diff
==============================================================================
---
rave/branches/model_interfaces/rave-components/rave-jpa/src/test/java/org/apache/rave/portal/model/conversion/JpaPersonConverterTest.java
(original)
+++
rave/branches/model_interfaces/rave-components/rave-jpa/src/test/java/org/apache/rave/portal/model/conversion/JpaPersonConverterTest.java
Tue Jun 19 19:37:11 2012
@@ -1,7 +1,6 @@
package org.apache.rave.portal.model.conversion;
-import org.apache.rave.portal.model.JpaPerson;
-import org.apache.rave.portal.model.Person;
+import org.apache.rave.portal.model.*;
import org.apache.rave.portal.model.impl.PersonImpl;
import org.junit.Before;
import org.junit.Test;
@@ -10,6 +9,8 @@ import org.springframework.beans.factory
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.util.ArrayList;
+
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
@@ -41,12 +42,41 @@ public class JpaPersonConverterTest {
@Test
public void convertValid() {
Person template = new PersonImpl();
+ template.setUsername("TEST_A");
+ template.setEmail("TEST_B");
+ template.setDisplayName("TEST_C");
+ template.setAdditionalName("TEST_D");
+ template.setFamilyName("TEST_E");
+ template.setGivenName("TEST_F");
+ template.setHonorificPrefix("TEST_G");
+ template.setHonorificSuffix("TEST_H");
+ template.setPreferredName("TEST_I");
+ template.setAboutMe("TEST_J");
+ template.setStatus("TEST_K");
+ template.setAddresses(new ArrayList<Address>());
+ template.setOrganizations(new ArrayList<Organization>());
+ template.setProperties(new ArrayList<PersonProperty>());
+ template.setFriends(new ArrayList<Person>());
JpaPerson jpaTemplate = converter.convert(template);
assertThat(jpaTemplate, is(not(sameInstance(template))));
assertThat(jpaTemplate, is(instanceOf(JpaPerson.class)));
- //TODO: Add coverage for all methods
+ assertThat(jpaTemplate.getUsername(),
is(equalTo(template.getUsername())));
+ assertThat(jpaTemplate.getEmail(), is(equalTo(template.getEmail())));
+ assertThat(jpaTemplate.getDisplayName(),
is(equalTo(template.getDisplayName())));
+ assertThat(jpaTemplate.getUsername(),
is(equalTo(template.getUsername())));
+ assertThat(jpaTemplate.getFamilyName(),
is(equalTo(template.getFamilyName())));
+ assertThat(jpaTemplate.getGivenName(),
is(equalTo(template.getGivenName())));
+ assertThat(jpaTemplate.getHonorificPrefix(),
is(equalTo(template.getHonorificPrefix())));
+ assertThat(jpaTemplate.getHonorificSuffix(),
is(equalTo(template.getHonorificSuffix())));
+ assertThat(jpaTemplate.getPreferredName(),
is(equalTo(template.getPreferredName())));
+ assertThat(jpaTemplate.getAboutMe(),
is(equalTo(template.getAboutMe())));
+ assertThat(jpaTemplate.getStatus(), is(equalTo(template.getStatus())));
+ assertThat(jpaTemplate.getAddresses(),
is(equalTo(template.getAddresses())));
+ assertThat(jpaTemplate.getOrganizations(),
is(equalTo(template.getOrganizations())));
+ assertThat(jpaTemplate.getProperties(),
is(equalTo(template.getProperties())));
+ assertThat(jpaTemplate.getFriends(),
is(equalTo(template.getFriends())));
}
}