diff --git a/src/main/java/ic/doc/IntOperator.java b/src/main/java/ic/doc/IntOperator.java index df24beb..698c16c 100644 --- a/src/main/java/ic/doc/IntOperator.java +++ b/src/main/java/ic/doc/IntOperator.java @@ -12,6 +12,10 @@ public class IntOperator { this.operator = operator; } + public int getOperands() { + return operands; + } + public int evaluate(List arguments) { if (arguments.size() != operands) { throw new IllegalArgumentException( diff --git a/src/test/java/ic/doc/IntOperatorTest.java b/src/test/java/ic/doc/IntOperatorTest.java index 796aa8c..b0244d3 100644 --- a/src/test/java/ic/doc/IntOperatorTest.java +++ b/src/test/java/ic/doc/IntOperatorTest.java @@ -25,4 +25,10 @@ public class IntOperatorTest { // good } } + + @Test + public void canGetOperatorOperandsCount() { + IntOperator intOperator = new IntOperator(2, arguments -> arguments.get(0) + arguments.get(1)); + assertThat(intOperator.getOperands(), is(2)); + } }