/** Test todos se abstienen */ @Test public final void todosSeAbstienen() { when(voter1.getCharset(any(ResponseMetadata.class), any(InputStream.class))).thenReturn(null); when(voter2.getCharset(any(ResponseMetadata.class), any(InputStream.class))).thenReturn(null); when(voter3.getCharset(any(ResponseMetadata.class), any(InputStream.class))).thenReturn(null); final VotersCharsetStrategy strategy = new VotersCharsetStrategy(Arrays.asList(voter1, voter2, voter3), "utf-8"); Charset charset = strategy.getCharset(mock(ResponseMetadata.class), mock(InputStream.class)); Assert.assertEquals(charset.name(), "UTF-8"); }
/** Test donde no hay voters */ @Test public final void noVoters() { final VotersCharsetStrategy strategy = new VotersCharsetStrategy(null, "utf-8"); Charset charset = strategy.getCharset(mock(ResponseMetadata.class), mock(InputStream.class)); Assert.assertEquals(charset.name(), "UTF-8"); }