Search in sources :

Example 1 with ResolvableViewableStatus

use of com.thoughtworks.go.server.web.i18n.ResolvableViewableStatus in project gocd by gocd.

the class JsonViewTest method testShouldRenderI18n.

@Test
public void testShouldRenderI18n() {
    Map<String, Object> map = new LinkedHashMap<>();
    final String i18nMessage = "waiting(zh_CN)";
    final ResolvableViewableStatus resolvableViewableStatus = new ResolvableViewableStatus(WAITING);
    map.put("key1", resolvableViewableStatus);
    JsonView view = new JsonView(requestContext);
    mockContext.checking(new Expectations() {

        {
            one(requestContext).getMessage(with(equal(resolvableViewableStatus)));
            will(returnValue(i18nMessage));
        }
    });
    String json = view.renderJson(map);
    mockContext.assertIsSatisfied();
    new JsonTester(json).is("{ 'key1' : '" + i18nMessage + "' }");
}
Also used : Expectations(org.jmock.Expectations) JsonTester(com.thoughtworks.go.util.JsonTester) ResolvableViewableStatus(com.thoughtworks.go.server.web.i18n.ResolvableViewableStatus) LinkedHashMap(java.util.LinkedHashMap) Test(org.junit.Test)

Aggregations

ResolvableViewableStatus (com.thoughtworks.go.server.web.i18n.ResolvableViewableStatus)1 JsonTester (com.thoughtworks.go.util.JsonTester)1 LinkedHashMap (java.util.LinkedHashMap)1 Expectations (org.jmock.Expectations)1 Test (org.junit.Test)1