示例#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));
 }
示例#2
0
 @Test
 public void testBadCast() {
   assertThat(Adapters.cast(Integer.class).adapt("No time"), is(nullValue()));
 }
示例#3
0
 @Test
 public void testInalidParseInteger() {
   assertThat(Adapters.parseInt().adapt("SEVEN"), is(nullValue()));
 }
示例#4
0
 @Test
 public void testCastingAdapter() {
   assertThat(Adapters.cast(String.class).adapt("No time"), is("No time"));
 }
示例#5
0
 @Test
 public void testValidParseInteger() {
   assertThat(Adapters.parseInt().adapt("42"), is(42));
 }