MultiStereoEncoder implements StereoEncoder { @Override public void reset() { for (int i = 0; i < encoders.size(); i++) { unconfigured.set(i); encoders.get(i).reset(); } } MultiStereoEncoder(List<StereoEncoder> encoders); @Override boolean encode(long[] current, long[] next); @Override void reset();  }
@Test public void testReset() throws Exception { StereoEncoder a = mock(StereoEncoder.class); StereoEncoder b = mock(StereoEncoder.class); StereoEncoder encoder = new MultiStereoEncoder(Arrays.asList(a, b)); long[] current = new long[0]; long[] next = new long[0]; when(a.encode(current, next)).thenReturn(true); when(b.encode(current, next)).thenReturn(true); assertTrue(encoder.encode(current, next)); assertFalse(encoder.encode(current, next)); verify(a, times(1)).encode(current, next); verify(b, times(1)).encode(current, next); encoder.reset(); assertTrue(encoder.encode(current, next)); verify(a, times(2)).encode(current, next); verify(b, times(2)).encode(current, next); }