Exemplo n.º 1
0
 @Test
 public void testPutProperty() throws Exception {
   Project project = initializeJavaProject();
   Shell shell = getShell();
   shell.execute("i18n setup");
   PropertiesFileResource resource =
       (PropertiesFileResource)
           project.getFacet(ResourceFacet.class).getResource("messages.properties");
   shell.execute("i18n put --key mykey --value myvalue");
   assertEquals("myvalue", resource.getProperty("mykey"));
   shell.execute("i18n put --key mykey --value Ol\u00e1");
   assertEquals("Ol\u00e1", resource.getProperty("mykey"));
 }
Exemplo n.º 2
0
 @Test
 public void testRemoveProperty() throws Exception {
   Project project = initializeJavaProject();
   Shell shell = getShell();
   shell.execute("i18n setup");
   shell.execute("i18n put --key mykey --value myvalue");
   shell.execute("i18n add-locale --locale pt_BR");
   shell.execute("i18n put --key mykey --value meuvalor");
   shell.execute("i18n remove --key mykey");
   ResourceFacet resourceFacet = project.getFacet(ResourceFacet.class);
   PropertiesFileResource resource =
       (PropertiesFileResource) resourceFacet.getResource("messages.properties");
   PropertiesFileResource resource_ptBR =
       (PropertiesFileResource) resourceFacet.getResource("messages_pt_BR.properties");
   assertNull(resource.getProperty("mykey"));
   assertNull(resource_ptBR.getProperty("mykey"));
 }