@Test(expected = IllegalArgumentException.class) public void throw_exception_when_input_is_invalid() throws Exception { String invalidInput = "invalid"; integerBodyMarshaller.marshal(invalidInput); }
@Test(expected = java.lang.NumberFormatException.class) public void throw_exception_when_input_is_double() throws Exception { String invalidInput = "3.5d"; integerBodyMarshaller.marshal(invalidInput); }
@Test(expected = IllegalArgumentException.class) public void throw_exception_when_input_is_float() throws Exception { String invalidInput = "0.5f"; integerBodyMarshaller.marshal(invalidInput); }
@Test(expected = IllegalArgumentException.class) public void throw_exception_when_input_is_null() throws Exception { integerBodyMarshaller.marshal(null); } }
@Test public void marshal_strings_to_integers() throws Exception { String validInput = "5"; int expectedOutput = 5; assertThat(integerBodyMarshaller.marshal(validInput)).isEqualTo(expectedOutput); }