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