Java Reference
In-Depth Information
Finally, we can test that a value in the request overrides a value in the
session:
Download email_27/src/stripesbook/test/plainmock/MyLocalePickerTest.java
@Test
public void testLocaleInRequestOverridesSession() {
stub(session.getAttribute(MyLocalePicker.LOCALE)).toReturn("fr");
stub(req.getParameter(MyLocalePicker.LOCALE)).toReturn("en");
Locale locale = localePicker.pickLocale(req);
assertEquals(Locale.ENGLISH, locale);
}
Wrapping Up
You took the webmail application to the next level in this chapter. Now,
you're using a real database, you can use dependency injection if that
suits you, and you can write automated tests that involve various levels
of the stack.
After you've let the ideas from this chapter simmer and perhaps have
played around with the examples and tried different things, you're
ready to continue learning more techniques and add some polish to
the application. Onward and upward!
 
 
Search WWH ::




Custom Search