我必须对下面的类进行jUnit测试。我想测试方法使用后返回值是否正确。我从2小时开始坐着,在Google和这里寻求帮助。有人可以帮忙并提供一些提示吗?还是示例它的外观?
@Service
public class CurrencyToDBImpl implements CurrencyToDB
{
@Override
public ArrayList<CurrencyValue> createCurrencyListToDB(List<CurrencyRateList> list)
{
ArrayList<CurrencyValue> currencyArrayList = new ArrayList<>();
List<Rate> rateList = list.get(0).getRates();
rateList.forEach(rate -> {
if(rate.getCode().equals("USD") || rate.getCode().equals("GBP") ||
rate.getCode().equals("EUR") || rate.getCode().equals("AUD"))
{
currencyArrayList.add(new CurrencyValue(rate.getMid(), rate.getCode(), rate.getCurrency()));
}
});
return currencyArrayList;
}
}