Package org.mockitousage.annotation

Source Code of org.mockitousage.annotation.MockInjectionUsingConstructorIssue421Test$Issue421

/*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/

package org.mockitousage.annotation;

import static org.fest.assertions.Assertions.*;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.internal.util.MockUtil;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockitousage.examples.use.ArticleCalculator;

@RunWith(MockitoJUnitRunner.class)
public class MockInjectionUsingConstructorIssue421Test {

    @Mock private ArticleCalculator calculator;

    @InjectMocks private Issue421 issue421;

    @Test
    public void mockJustWorks() {
      issue421.checkIfMockIsInjected();
    }

  static class Issue421 {

    private ArticleCalculator calculator;

    public Issue421(int a) {
    }

    public Issue421(ArticleCalculator calculator) {
      this.calculator = calculator;
    }

    public void checkIfMockIsInjected(){
      assertThat(new MockUtil().isMock(calculator)).isTrue();
    }
  }

}
TOP

Related Classes of org.mockitousage.annotation.MockInjectionUsingConstructorIssue421Test$Issue421

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.