Example #1
0
 @Test
 public void testEntry() {
   final Map<String, Integer> nums = new HashMap<String, Integer>();
   nums.put("Foo", 42);
   final MapEntryAdapter<String, Integer> adapter = Adapters.entryFor("Foo");
   assertThat(adapter.adapt(nums), is(42));
 }
Example #2
0
 @Test
 public void testBadCast() {
   assertThat(Adapters.cast(Integer.class).adapt("No time"), is(nullValue()));
 }
Example #3
0
 @Test
 public void testInalidParseInteger() {
   assertThat(Adapters.parseInt().adapt("SEVEN"), is(nullValue()));
 }
Example #4
0
 @Test
 public void testCastingAdapter() {
   assertThat(Adapters.cast(String.class).adapt("No time"), is("No time"));
 }
Example #5
0
 @Test
 public void testValidParseInteger() {
   assertThat(Adapters.parseInt().adapt("42"), is(42));
 }