constructortestbeanintegrationtests.java

来自「一些很有用的spring的书籍」· Java 代码 · 共 32 行

JAVA
32
字号
package com.apress.springbook.chapter02;

import junit.framework.TestCase;

import org.springframework.core.io.ClassPathResource;
import org.springframework.beans.factory.BeanFactory;

import org.springframework.beans.factory.xml.XmlBeanFactory;

public class ConstructorTestBeanIntegrationTests extends TestCase {

  private static BeanFactory beanFactory = new XmlBeanFactory(
    new ClassPathResource(
        "com/apress/springbook/chapter02/test-bean-tests.xml"
      )
    );

  private static ConstructorTestBean testBean;

  static {
    testBean = (ConstructorTestBean)beanFactory.getBean("testBean");
  }

  public void testIsConstructor1Used() {
    assertTrue(testBean.isConstructor1Used());
  }

  public void testIsConstructor2NotUsed() {
    assertFalse(testBean.isConstructor2Used());
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?