コード例 #1
0
 /**
  * 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());
 }
コード例 #2
0
 /**
  * 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)));
 }
コード例 #3
0
  /**
   * 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));
  }
コード例 #4
0
  /**
   * 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));
  }