Testing classes that use I18NProvider

Hi all,

I’m currently trying to write a JUnit test for a library class we use. It’s a utility class for grids, which has methods that for example set the header of columns to a localized String. However, I’m not sure how to get this test working, since I don’t have an Application to run the test with.

Cheers
Lukas

You could ramp up a I18NProvider that will respond with the key itself. (via ServiceLocator during Test-RampUp) With this you could test without managing a translation file as well. Your I18NProvider should be tested independently. How to ramp up an I18NProvider you can see in the tutorials : [https://vaadin.com/tutorials/i18n]
(https://vaadin.com/tutorials/i18n).

If you need more info´s, feel free to ping me directly: Twitter or mail.

Thanks for your reply.

The way I ended up doing it, is with [Karibu-Testing]
(https://github.com/mvysny/karibu-testing), which allows me to Mock a Provider and use an instantiator to provide it during the test.