/** * Test method for {@link DivisionExpression#toString()}. Asserts that the method was overridden. */ @Test public void toStringT() { assertThat( new DivisionExpression( EVALUABLE_EXPRESSION_FACTORY.getOne(), EVALUABLE_EXPRESSION_FACTORY.getOne()), hasOverriddenToString()); }
/** * Test method for {@link DivisionExpression#getDividend()}. Asserts that in returns the dividend. */ @Test public void getDividend() { final EvaluableExpression dividend = EVALUABLE_EXPRESSION_FACTORY.getOne(); assertThat( "should return the instance passed in the constructor!", new DivisionExpression(dividend, EVALUABLE_EXPRESSION_FACTORY.getOne()).getDividend(), is(theInstance(dividend))); }
/** * Test method for {@link DivisionExpression#receive(dEvaluableExpressionVisitor)}. Asserts that * {@link EvaluableExpressionVisitor#visit(DivisionExpression)} is called. */ @Test public void receive() { final EvaluableExpressionVisitor mockVisitor = mock(EvaluableExpressionVisitor.class); final DivisionExpression testedExpression = new DivisionExpression( EVALUABLE_EXPRESSION_FACTORY.getOne(), EVALUABLE_EXPRESSION_FACTORY.getOne()); assertThat(() -> testedExpression.receive(null), throwsException(NullPointerException.class)); testedExpression.receive(mockVisitor); then(mockVisitor).should().visit(same(testedExpression)); }
/** * Test method for {@link DivisionExpression#DivisionExpression(EvaluableExpression, * EvaluableExpression)} . Asserts that {@code null} cannot be passed and creation is possible. */ @Test public void constructor() { new DivisionExpression( EVALUABLE_EXPRESSION_FACTORY.getOne(), EVALUABLE_EXPRESSION_FACTORY.getOne()); assertThat( () -> new DivisionExpression(EVALUABLE_EXPRESSION_FACTORY.getOne(), null), throwsException(NullPointerException.class)); assertThat( () -> new DivisionExpression(null, EVALUABLE_EXPRESSION_FACTORY.getOne()), throwsException(NullPointerException.class)); }