@Test public void whenThereIsAFormatGivenShouldUseCorrectSerializer() { when(formatResolver.getAcceptFormat()).thenReturn("xml"); when(serialization.accepts("xml")).thenReturn(true); Object object = new Object(); representation.from(object); verify(serialization).from(object); }
@Test public void whenSerializationDontAcceptsFormatItShouldntBeUsed() { when(formatResolver.getAcceptFormat()).thenReturn("xml"); when(serialization.accepts("xml")).thenReturn(false); Object object = new Object(); representation.from(object); verify(serialization, never()).from(object); }