Skip to content

Commit

Permalink
Merge branch '2.5' of github.com:FasterXML/jackson-databind into 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 23, 2015
2 parents a52e6c5 + 035b24d commit 46d7037
Showing 1 changed file with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.LRUMap;

/**
* Tests to verify that most core Jackson components can be serialized
* using default JDK serialization: this feature is useful for some
Expand Down Expand Up @@ -96,7 +99,35 @@ public void testObjectMapper() throws IOException
assertEquals(p.x, p2.x);
assertEquals(p.y, p2.y);
}


public void testTypeFactory() throws Exception
{
TypeFactory orig = TypeFactory.defaultInstance();
JavaType t = orig.constructType(JavaType.class);
assertNotNull(t);

byte[] bytes = jdkSerialize(orig);
TypeFactory result = jdkDeserialize(bytes);
assertNotNull(result);
t = orig.constructType(JavaType.class);
assertEquals(JavaType.class, t.getRawClass());
}

public void testLRUMap() throws Exception
{
LRUMap<String,Integer> map = new LRUMap<String,Integer>(32, 32);
map.put("a", 1);

byte[] bytes = jdkSerialize(map);
LRUMap<String,Integer> result = jdkDeserialize(bytes);
// transient implementation, will be read as empty
assertEquals(0, result.size());

// but should be possible to re-populate
result.put("a", 2);
assertEquals(1, result.size());
}

/*
/**********************************************************
/* Helper methods
Expand Down

0 comments on commit 46d7037

Please sign in to comment.