BinaryLoggingDecorator implements PerformanceLogger, Binary { @Override public DRes<Boolean> open(DRes<SBool> toOpen) { return this.delegate.open(toOpen); } BinaryLoggingDecorator(Binary delegate); @Override DRes<SBool> known(boolean known); @Override DRes<SBool> input(boolean in, int inputter); @Override DRes<SBool> randomBit(); @Override DRes<Boolean> open(DRes<SBool> toOpen); @Override DRes<Boolean> open(DRes<SBool> toOpen, int towardsPartyId); @Override DRes<SBool> and(DRes<SBool> left, DRes<SBool> right); @Override DRes<SBool> xor(DRes<SBool> left, DRes<SBool> right); @Override DRes<SBool> not(DRes<SBool> in); @Override void reset(); @Override Map<String, Long> getLoggedValues(); static final String BINARY_BASIC_XOR; static final String BINARY_BASIC_AND; static final String BINARY_BASIC_RANDOM; }
@Test public void open() { Binary binary = mock(Binary.class); when(binary.open(any(DRes.class), any(int.class))) .then( invocationOnMock -> { firstArgument = invocationOnMock.getArgument(0); secondArgument = invocationOnMock.getArgument(1); return null; }); BinaryLoggingDecorator decorator = new BinaryLoggingDecorator(binary); DRes<SBool> toOpen = mock(DRes.class); decorator.open(toOpen, 2); Assert.assertEquals(toOpen, firstArgument); Assert.assertEquals(2, secondArgument); }