LocalesService { public String getMessage(String lng, String ns, String path) { String key = lng + "_" + ns; String json = jsons.containsKey(key) ? jsons.get(key) : getJsonTranslation(lng, ns); return JsonPath.read(json, path); }  String getJsonTranslation(String lng, String ns); String getMessage(String lng, String ns, String path); String getMessage(String lng, String ns, String path, Map<String, String> variables);  }
@Test public void testGetSimpleMessage() { String message = localService.getMessage("fr", "pes", "$.pes.status.CREATED"); assertThat(message, is("Déposé")); }
@Test public void testGetVariableMessage() { String firstName = "John"; String lastName = "Doe"; Map<String, String> variables = new HashMap<>(); variables.put("firstname", firstName); variables.put("lastname", lastName); String text = localService.getMessage("fr", "pes_notification", "$.pes.unittest", variables); assertThat(text, is( "Bonjour John Doe, le test unitaire est passé")); }