⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 currencyconverterintegrationtests.java

📁 一些很有用的spring的书籍
💻 JAVA
字号:
package com.apress.springbook.chapter10;

import org.springframework.test.AbstractDependencyInjectionSpringContextTests;

public class CurrencyConverterIntegrationTests 
  extends AbstractDependencyInjectionSpringContextTests {
    
  private CurrencyConverter currencyConverter;

  public void setCurrencyConverter(CurrencyConverter currencyConverter) {
    this.currencyConverter = currencyConverter;
  }

  protected String[] getConfigLocations() {
    return new String[] { "classpath:/applicationContext.xml" };
  }

  public void testWithValidInput() {
      try {
    assertEquals(12.234, currencyConverter.convert(10.0, "EUR", "USD"));
      } catch (UnknownCurrencyException e) {
	  fail("something went wrong in testWithValidInput()");
    }
  }

  public void testConvertWithUnknownCurrency() {
    try {
      currencyConverter.convert(10.0, "EUR", "-UNKNOWN-");
      fail("an unknown currency exception was expected");
    } catch (UnknownCurrencyException e) {
      // do nothing, was expected
    }
  }
}

⌨️ 快捷键说明

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