@Before public void setup() { setup(Config.class); }
@Test public void decodeFromBinaryCannotConvert() throws Exception { setup(NoConvertersConfig.class); Decoder.Binary<MyType> decoder = new MyBinaryDecoder(); assertThat(decoder.willDecode(CONVERTED_BYTES), is(false)); thown.expect(DecodeException.class); thown.expectCause(isA(ConverterNotFoundException.class)); decoder.decode(CONVERTED_BYTES); }
@Test public void decodeFromTextCannotConvert() throws Exception { setup(NoConvertersConfig.class); Decoder.Text<MyType> decoder = new MyTextDecoder(); assertThat(decoder.willDecode(CONVERTED_TEXT), is(false)); thown.expect(DecodeException.class); thown.expectCause(isA(ConverterNotFoundException.class)); decoder.decode(CONVERTED_TEXT); }
@Test public void cannotFindConversionService() throws Exception { setup(NoConfig.class); MyBinaryEncoder encoder = new MyBinaryEncoder(); encoder.init(null); thown.expect(IllegalStateException.class); thown.expectMessage("Unable to find ConversionService"); encoder.encode(myType); }
@Test public void encodeToTextCannotConvert() throws Exception { setup(NoConvertersConfig.class); thown.expect(EncodeException.class); thown.expectCause(isA(ConverterNotFoundException.class)); new MyTextEncoder().encode(myType); }
@Test public void encodeToBinaryCannotConvert() throws Exception { setup(NoConvertersConfig.class); thown.expect(EncodeException.class); thown.expectCause(isA(ConverterNotFoundException.class)); new MyBinaryEncoder().encode(myType); }