private ObjectTransformationException failure() { return new ObjectTransformationException("Unsupported value type '"+prettyPrint(targetClass())+"'",null,targetClass()); }
@Test public void rejectUnsupportedTypes$toStringFailure() { try { ObjectUtil.toString(Lists.newArrayList()); fail("Should fail on unsupported types"); } catch (ObjectTransformationException e) { assertThat((Object)e.getValueClass(),equalTo((Object)ArrayList.class)); } }
@Test public void rejectUnsupportedTypes$parseFailure() { try { ObjectUtil.fromString(ObjectUtil.class,"random data"); fail("Should fail on unsupported types"); } catch (ObjectTransformationException e) { assertThat((Object)e.getValueClass(),equalTo((Object)ObjectUtil.class)); } }