??????????????Щ????????????????????????????????????δ???????????????????к??????????????????????????????????????????????????????????????Щ?????д????ó??????????????????????????????????????????????????

????????????????ζ?????????

if (CARREFOUR.equals(supplier)) {
    return EUR;
} else if (CENTURY_MART.equals(supplier)) {
    return CNY;
} else {
    throw new UnsupportedSupplierException(supplier);
}

?????????????????????????????????????????????????????????????????

@Test
public void returnsEurWhenGetCurrenyGivenCarrefour() throws Exception {
        assertEquals(EUR?? target.getCurrencyBy(CARREFOUR));
}

@Test
public void returnsCnyWhenGetCurrenyGivenCenturyMart() throws Exception {
        assertEquals(CNY?? target.getCurrencyBy(CENTURY_MART));
}

@Test(expected=UnsupportedSupplierException.class)
public void throwsExceptionWhenGetCurrenyGivenUnknownSupplier() throws Exception {
        target.getCurrencyBy(WE_DONT_KNOW);
}

???????????????????μ???????????????????????????????????????????????????else if????????????????????????????????????????????????仯??????????????????£???????????ò???????????????????????????????????′???

final String currency = currencies.get(supplier);
if (currency != null) {
    return currency;
} else {
    throw new UnsupportedSupplierException(supplier);
}

?????????????Map???????????????????????????????????????

@Before
public void setupTestFixture() {
        Map<string?? String> currencies = new HashMap<String?? String>();
        currencies.put(MATCHED?? CORRESPONSED);
        currencies.put(ANOTHER?? ANOTHER_CURRENCY);
        target.setCurrencies(currencies);
}

@Test
public void returnsCorresponsedCurrencyWhenSupplierNameMatched() throws Exception {  
        assertEquals(CORRESPONSED?? target.getCurrencyBy(MATCHED));
}

@Test(expected=UnsupportedSupplierException.class)
public void throwsExceptionWhenGetCurrenyGivenUnknownSupplier() throws Exception {
        target.getCurrencyBy(WE_DONT_KNOW);
}