From 7bc03058357a55fefaf9fb96b943d2c589b38a9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 13 Aug 2018 01:09:48 +0200 Subject: [PATCH] Add tests --- .../codestyle/xml/FieldNamingConventions.xml | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/FieldNamingConventions.xml diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/FieldNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/FieldNamingConventions.xml new file mode 100644 index 0000000000..af0aab3808 --- /dev/null +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/FieldNamingConventions.xml @@ -0,0 +1,148 @@ + + + + Test property defaults + 4 + + The field name 'Foo' doesn't match '[a-z][a-zA-Z0-9]*' + The final field name 'Hoo' doesn't match '[a-z][a-zA-Z0-9]*' + The static field name 'Bar' doesn't match '[a-z][a-zA-Z0-9]*' + The constant name 'BOLGaaa_FIELD' doesn't match '[A-Z][A-Z_0-9]*' + + + + + + Test default field property + [A-Z][A-Z0-9]+ + 3 + + The field name 'Foo' doesn't match '[A-Z][A-Z0-9]+' + The final field name 'Hoo' doesn't match '[a-z][a-zA-Z0-9]*' + The static field name 'Bar' doesn't match '[a-z][a-zA-Z0-9]*' + + + + + + Test final field property + [A-Z][A-Z0-9]+ + 3 + + The field name 'Foo' doesn't match '[a-z][a-zA-Z0-9]*' + The final field name 'Hoo' doesn't match '[A-Z][A-Z0-9]+' + The static field name 'Bar' doesn't match '[a-z][a-zA-Z0-9]*' + + + + + + Test static field property + [A-Z][A-Z0-9]+ + 3 + + The field name 'Foo' doesn't match '[a-z][a-zA-Z0-9]*' + The final field name 'Hoo' doesn't match '[a-z][a-zA-Z0-9]*' + The static field name 'Bar' doesn't match '[A-Z][A-Z0-9]+' + + + + + + Test constant field property + cons_[A-Z][A-Z0-9]+ + 4 + + The field name 'Foo' doesn't match '[a-z][a-zA-Z0-9]*' + The final field name 'Hoo' doesn't match '[a-z][a-zA-Z0-9]*' + The static field name 'Bar' doesn't match '[a-z][a-zA-Z0-9]*' + The constant name 'BOLG_FIELD' doesn't match 'cons_[A-Z][A-Z0-9]+' + + + + + + Test enum constant property + cons_[A-Z][A-Z0-9]+ + 2 + + The enum constant name 'NET' doesn't match 'cons_[A-Z][A-Z0-9]+' + The enum constant name 'ORG' doesn't match 'cons_[A-Z][A-Z0-9]+' + + + + + + + + Interface fields should be treated like constants + 3 + + The constant name 'Foo' doesn't match '[A-Z][A-Z_0-9]*' + The constant name 'Hoo' doesn't match '[A-Z][A-Z_0-9]*' + The constant name 'Bar' doesn't match '[A-Z][A-Z_0-9]*' + + + + +