properties files are completely defined:
// call this method for each properties file
public void checkMessagesDefinedProperlyInBothInterfaceAndFile(String
file) {
Properties f2 = new Properties();
FileInputStream in = null;
try {
in = new FileInputStream(file);
f2.load(in);
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.getMessage());
} finally {
IO.safelyClose(in);
}
Assert.assertNotNull(f2);
// check methods -> properties
for (Method m : YouMessagesClass.class.getDeclaredMethods()) {
Assert.assertTrue(m.getName() + " shoud not be empty",
Is.entered(f2.getProperty(m.getName())));
if (m.getParameterTypes().length > 0) {
Assert.assertTrue(m.getName() + " should contain {",
f2.getProperty(m.getName()).indexOf('{') > -1);
Assert.assertTrue(m.getName() + " should contain {",
f2.getProperty(m.getName()).indexOf('}') > -1);
}
}
// check properties -> methods
for (Object key : f2.keySet()) {
String property = f2.getProperty((String) key);
if (property.indexOf('}') == -1)
continue;
for (Method m : YourMessagesClass.class.getDeclaredMethods()) {
if (m.getName().equals(key)) {
Assert.assertTrue(key + " should have at least 1 parameter",
m.getParameterTypes().length > 0);
break;
}
}
}
}
What we do is have critical tests like this run on save, in
our .project file we have :
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/Autobuild.launch</value>
</dictionary>
</arguments>
</buildCommand>
This ensures that we don't have to remember to add keys, servlet
definitions in web.xml etc - all the critical things that can go
wrong, but are easy to forget.
Joe
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment