Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added test for UUID to TestMapping

  • Loading branch information...
commit 9072b8b3d308a68ce5fc6a0c1d0f4b13f21701cb 1 parent 6fb430f
Raffael Stein authored
View
8 src/test/java/com/netflix/astyanax/mapping/FakeKeyspaceBean.java
@@ -1,9 +1,11 @@
package com.netflix.astyanax.mapping;
+import java.util.UUID;
+
@SuppressWarnings({ "UnusedDeclaration", "SimplifiableIfStatement" })
public class FakeKeyspaceBean implements Comparable<FakeKeyspaceBean> {
@Id("PK")
- private String id;
+ private UUID id;
@Column("OVERRIDE_BY_TYPE")
private String type;
@@ -40,7 +42,7 @@ public FakeKeyspaceBean() {
*
* @return value
*/
- public String getId() {
+ public UUID getId() {
return id;
}
@@ -50,7 +52,7 @@ public String getId() {
* @param id
* value
*/
- public void setId(String id) {
+ public void setId(UUID id) {
this.id = id;
}
View
8 src/test/java/com/netflix/astyanax/mapping/TestMapping.java
@@ -3,11 +3,13 @@
import junit.framework.Assert;
import org.junit.Test;
+import java.util.UUID;
+
public class TestMapping {
@Test
public void testKeyspaceAnnotations() {
FakeKeyspaceBean override = new FakeKeyspaceBean();
- override.setId("1");
+ override.setId(UUID.fromString("553a6af3-14f0-419c-b257-b6c55babafe7"));
override.setCountry("USA");
override.setCountryStatus(2);
override.setCreateTS(12345678L);
@@ -20,10 +22,10 @@ public void testKeyspaceAnnotations() {
Mapping<FakeKeyspaceBean> mapping = Mapping
.make(FakeKeyspaceBean.class);
- Assert.assertEquals(mapping.getIdValue(override, String.class),
+ Assert.assertEquals(mapping.getIdValue(override, UUID.class),
override.getId());
Assert.assertEquals(
- mapping.getColumnValue(override, "PK", String.class),
+ mapping.getColumnValue(override, "PK", UUID.class),
override.getId());
Assert.assertEquals(mapping.getColumnValue(override,
"COUNTRY_OVERRIDE", String.class), override.getCountry());
Please sign in to comment.
Something went wrong with that request. Please try again.