Package dev.zemco.codegame.execution.io
Class VerifyingInputSourceToOutputSinkAdapter
java.lang.Object
dev.zemco.codegame.execution.io.VerifyingInputSourceToOutputSinkAdapter
- All Implemented Interfaces:
IOutputSink
Output sink that matches execution outputs to values from input source.
This output sink is only satisfied if output values exactly match values from the adapted
input source.
- Author:
- Erik Zemčík
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVerifyingInputSourceToOutputSinkAdapter(IInputSource inputSource) Creates an instance ofVerifyingInputSourceToOutputSinkAdapterby adapting existinginput source. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(int value) Attempts to match outputvalueto next value from the adaptedinput source.booleanReturns if the adaptedinput sourcehas no next value available.
-
Constructor Details
-
VerifyingInputSourceToOutputSinkAdapter
Creates an instance ofVerifyingInputSourceToOutputSinkAdapterby adapting existinginput source.- Parameters:
inputSource-input sourceto adapt
-
-
Method Details
-
accept
public void accept(int value) Attempts to match outputvalueto next value from the adaptedinput source.- Specified by:
acceptin interfaceIOutputSink- Parameters:
value- value to match- Throws:
NotAcceptedException- if adaptedinput sourcehas no next value or if next value frominput sourcedoes not match outputvalue
-
isSatisfied
public boolean isSatisfied()Returns if the adaptedinput sourcehas no next value available.- Specified by:
isSatisfiedin interfaceIOutputSink- Returns:
- true if the adapted
input sourcehas no next value available, else false
-