StringToNumberDecoder implements RpcDecoder { @Override public boolean isApplicable(JsonValue value, Class<?> type) { return value.getType().equals(JsonType.STRING) && Number.class.isAssignableFrom(type) && type.getPackage().equals(Integer.class.getPackage()); }  @Override boolean isApplicable(JsonValue value, Class<?> type); @Override T decode(JsonValue value, Class<T> type);  }
@Test public void isApplicable_applicableToStringAndNumber() { Assert.assertTrue( decoder.isApplicable(Json.create("foo"), Number.class)); }
@Test public void isApplicable_notApplicableToBooleanAndNumber() { Assert.assertFalse( decoder.isApplicable(Json.create(true), Number.class)); }
@Test public void isApplicable_notApplicableToStringAndString() { Assert.assertFalse( decoder.isApplicable(Json.create("foo"), String.class)); }
@Test public void isApplicable_notApplicableToStringAndAtomicInteger() { Assert.assertFalse( decoder.isApplicable(Json.create("foo"), AtomicInteger.class)); }
@Test public void isApplicable_applicableToStringAndLong() { Assert.assertTrue(decoder.isApplicable(Json.create("foo"), Long.class)); }