Browse Source

Enable PMD in gradle + apply fixes.

Change-Id: I3665cac8af833da793ca418953d934cc3a333459
Depends-On: I348b37a14097439f8a56b0a671794410e46201ca
Depends-On: Ifc4aa601de14ca2526646f499f60329ed7c5935e
Reviewed-on: http://gerrit.dmdirc.com/3939
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
pull/1/head
Chris Smith 9 years ago
parent
commit
6ae693893d
51 changed files with 555 additions and 569 deletions
  1. 6
    0
      build.gradle
  2. 119
    120
      etc/pmd/full.xml
  3. 13
    15
      src/com/dmdirc/Server.java
  4. 2
    2
      src/com/dmdirc/commandparser/PopupMenuItem.java
  5. 7
    7
      src/com/dmdirc/config/ConfigFileBackedConfigProvider.java
  6. 9
    7
      src/com/dmdirc/config/ConfigManager.java
  7. 6
    6
      src/com/dmdirc/config/IdentityManager.java
  8. 4
    3
      src/com/dmdirc/config/prefs/PreferencesCategory.java
  9. 3
    3
      src/com/dmdirc/config/prefs/reader/CategoryReader.java
  10. 2
    2
      src/com/dmdirc/events/DisplayProperty.java
  11. 1
    1
      src/com/dmdirc/logger/ErrorReporter.java
  12. 10
    12
      src/com/dmdirc/plugins/PluginInfo.java
  13. 9
    9
      src/com/dmdirc/ui/core/feedback/CoreFeedbackDialogModel.java
  14. 9
    11
      src/com/dmdirc/ui/input/InputHandler.java
  15. 13
    12
      src/com/dmdirc/updater/checking/DMDircCheckStrategy.java
  16. 25
    24
      src/com/dmdirc/updater/manager/UpdateManagerImpl.java
  17. 1
    1
      test/com/dmdirc/ServerManagerTest.java
  18. 2
    2
      test/com/dmdirc/WritableFrameContainerTest.java
  19. 4
    4
      test/com/dmdirc/actions/ActionConditionTest.java
  20. 18
    18
      test/com/dmdirc/actions/ActionGroupTest.java
  21. 8
    14
      test/com/dmdirc/actions/ActionModelTest.java
  22. 5
    7
      test/com/dmdirc/actions/ActionTest.java
  23. 1
    1
      test/com/dmdirc/actions/ConditionTreeEvaluatorTest.java
  24. 1
    1
      test/com/dmdirc/actions/ConditionTreeParserTest.java
  25. 12
    15
      test/com/dmdirc/actions/CoreActionComparisonTest.java
  26. 19
    19
      test/com/dmdirc/actions/wrappers/ProfileTest.java
  27. 2
    2
      test/com/dmdirc/commandparser/CommandArgumentsTest.java
  28. 23
    23
      test/com/dmdirc/commandparser/commands/flags/CommandFlagHandlerTest.java
  29. 24
    24
      test/com/dmdirc/config/ConfigTargetTest.java
  30. 20
    20
      test/com/dmdirc/config/prefs/PreferencesSettingTest.java
  31. 8
    8
      test/com/dmdirc/harness/TestCommandParser.java
  32. 3
    3
      test/com/dmdirc/harness/TestConfigSource.java
  33. 2
    2
      test/com/dmdirc/logger/DMDircExceptionHandlerTest.java
  34. 9
    9
      test/com/dmdirc/logger/ProgramErrorTest.java
  35. 7
    7
      test/com/dmdirc/ui/StatusMessageTest.java
  36. 7
    13
      test/com/dmdirc/ui/WindowManagerTest.java
  37. 15
    15
      test/com/dmdirc/ui/core/aliases/CoreAliasDialogModelTest.java
  38. 6
    6
      test/com/dmdirc/ui/core/components/StatusBarManagerTest.java
  39. 9
    9
      test/com/dmdirc/ui/core/feedback/CoreFeedbackDialogModelTest.java
  40. 35
    35
      test/com/dmdirc/ui/core/newserver/CoreNewServerDialogModelTest.java
  41. 1
    1
      test/com/dmdirc/ui/core/util/URLHandlerTest.java
  42. 20
    20
      test/com/dmdirc/ui/messages/ColourManagerTest.java
  43. 6
    6
      test/com/dmdirc/ui/messages/FormatterTest.java
  44. 1
    1
      test/com/dmdirc/ui/messages/IntelligentLinkingTest.java
  45. 1
    1
      test/com/dmdirc/ui/messages/StyliserIndicesTest.java
  46. 3
    3
      test/com/dmdirc/ui/messages/StyliserStylesTest.java
  47. 15
    15
      test/com/dmdirc/ui/messages/StyliserTest.java
  48. 3
    4
      test/com/dmdirc/updater/installing/LegacyInstallationStrategyTest.java
  49. 1
    1
      test/com/dmdirc/util/URIParserTextParameterizedTest.java
  50. 1
    1
      test/com/dmdirc/util/URIParserURIParameterizedTest.java
  51. 24
    24
      test/com/dmdirc/util/URLBuilderTest.java

+ 6
- 0
build.gradle View File

@@ -21,6 +21,7 @@ dependencies {
21 21
 
22 22
 allprojects {
23 23
     apply plugin: 'java'
24
+    apply plugin: 'pmd'
24 25
 
25 26
     sourceSets {
26 27
         main {
@@ -55,6 +56,11 @@ allprojects {
55 56
         testCompile group: 'junit', name: 'junit', version: '4.+'
56 57
         testCompile group: 'org.mockito', name: 'mockito-all', version: '1.+'
57 58
     }
59
+
60
+    pmd {
61
+        ruleSets = []
62
+        ruleSetFiles = files("$rootDir/etc/pmd/full.xml")
63
+    }
58 64
 }
59 65
 
60 66
 task wrapper(type: Wrapper) {

+ 119
- 120
etc/pmd/full.xml View File

@@ -6,138 +6,137 @@
6 6
          xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
7 7
         <description>DMDirc minimal PMD checks.</description>
8 8
 
9
-<rule ref="rulesets/basic.xml/EmptyIfStmt"><priority>1</priority></rule>
10
-<rule ref="rulesets/basic.xml/EmptyWhileStmt"><priority>1</priority></rule>
11
-<rule ref="rulesets/basic.xml/EmptyTryBlock"><priority>1</priority></rule>
12
-<rule ref="rulesets/basic.xml/EmptyFinallyBlock"><priority>1</priority></rule>
13
-<rule ref="rulesets/basic.xml/EmptySwitchStatements"><priority>1</priority></rule>
14
-<rule ref="rulesets/basic.xml/JumbledIncrementer"><priority>1</priority></rule>
15
-<rule ref="rulesets/basic.xml/ForLoopShouldBeWhileLoop"><priority>1</priority></rule>
16
-<rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"><priority>1</priority></rule>
17
-<rule ref="rulesets/basic.xml/OverrideBothEqualsAndHashcode"><priority>1</priority></rule>
18
-<rule ref="rulesets/basic.xml/DoubleCheckedLocking"><priority>1</priority></rule>
19
-<rule ref="rulesets/basic.xml/ReturnFromFinallyBlock"><priority>1</priority></rule>
20
-<rule ref="rulesets/basic.xml/EmptySynchronizedBlock"><priority>1</priority></rule>
21
-<rule ref="rulesets/basic.xml/EmptyStaticInitializer"><priority>1</priority></rule>
22
-<rule ref="rulesets/basic.xml/UnconditionalIfStatement"><priority>1</priority></rule>
23
-<rule ref="rulesets/basic.xml/EmptyStatementNotInLoop"><priority>1</priority></rule>
24
-<rule ref="rulesets/basic.xml/BooleanInstantiation"><priority>1</priority></rule>
25
-<rule ref="rulesets/basic.xml/UnnecessaryFinalModifier"><priority>1</priority></rule>
26
-<rule ref="rulesets/basic.xml/CollapsibleIfStatements"><priority>1</priority></rule>
27
-<rule ref="rulesets/basic.xml/UselessOverridingMethod"><priority>1</priority></rule>
28
-<rule ref="rulesets/basic.xml/ClassCastExceptionWithToArray"><priority>1</priority></rule>
29
-<rule ref="rulesets/basic.xml/AvoidDecimalLiteralsInBigDecimalConstructor"><priority>1</priority></rule>
30
-<rule ref="rulesets/basic.xml/UselessOperationOnImmutable"><priority>1</priority></rule>
31
-<rule ref="rulesets/basic.xml/MisplacedNullCheck"><priority>1</priority></rule>
32
-<rule ref="rulesets/basic.xml/UnusedNullCheckInEquals"><priority>1</priority></rule>
33
-<rule ref="rulesets/basic.xml/BrokenNullCheck"><priority>1</priority></rule>
34
-<rule ref="rulesets/basic.xml/BigIntegerInstantiation"><priority>1</priority></rule>
35
-<rule ref="rulesets/basic.xml/AvoidMultipleUnaryOperators"><priority>1</priority></rule>
36
-<rule ref="rulesets/basic.xml/EmptyInitializer"><priority>1</priority></rule>
9
+<rule ref="rulesets/java/empty.xml/EmptyIfStmt"><priority>1</priority></rule>
10
+<rule ref="rulesets/java/empty.xml/EmptyWhileStmt"><priority>1</priority></rule>
11
+<rule ref="rulesets/java/empty.xml/EmptyTryBlock"><priority>1</priority></rule>
12
+<rule ref="rulesets/java/empty.xml/EmptyFinallyBlock"><priority>1</priority></rule>
13
+<rule ref="rulesets/java/empty.xml/EmptySwitchStatements"><priority>1</priority></rule>
14
+<rule ref="rulesets/java/basic.xml/JumbledIncrementer"><priority>1</priority></rule>
15
+<rule ref="rulesets/java/basic.xml/ForLoopShouldBeWhileLoop"><priority>1</priority></rule>
16
+<rule ref="rulesets/java/unnecessary.xml/UnnecessaryConversionTemporary"><priority>1</priority></rule>
17
+<rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode"><priority>1</priority></rule>
18
+<rule ref="rulesets/java/basic.xml/DoubleCheckedLocking"><priority>1</priority></rule>
19
+<rule ref="rulesets/java/basic.xml/ReturnFromFinallyBlock"><priority>1</priority></rule>
20
+<rule ref="rulesets/java/empty.xml/EmptySynchronizedBlock"><priority>1</priority></rule>
21
+<rule ref="rulesets/java/empty.xml/EmptyStaticInitializer"><priority>1</priority></rule>
22
+<rule ref="rulesets/java/basic.xml/UnconditionalIfStatement"><priority>1</priority></rule>
23
+<rule ref="rulesets/java/empty.xml/EmptyStatementNotInLoop"><priority>1</priority></rule>
24
+<rule ref="rulesets/java/basic.xml/BooleanInstantiation"><priority>1</priority></rule>
25
+<rule ref="rulesets/java/unnecessary.xml/UnnecessaryFinalModifier"><priority>1</priority></rule>
26
+<rule ref="rulesets/java/basic.xml/CollapsibleIfStatements"><priority>1</priority></rule>
27
+<rule ref="rulesets/java/unnecessary.xml/UselessOverridingMethod"><priority>1</priority></rule>
28
+<rule ref="rulesets/java/basic.xml/ClassCastExceptionWithToArray"><priority>1</priority></rule>
29
+<rule ref="rulesets/java/basic.xml/AvoidDecimalLiteralsInBigDecimalConstructor"><priority>1</priority></rule>
30
+<rule ref="rulesets/java/unnecessary.xml/UselessOperationOnImmutable"><priority>1</priority></rule>
31
+<rule ref="rulesets/java/basic.xml/MisplacedNullCheck"><priority>1</priority></rule>
32
+<rule ref="rulesets/java/unnecessary.xml/UnusedNullCheckInEquals"><priority>1</priority></rule>
33
+<rule ref="rulesets/java/basic.xml/BrokenNullCheck"><priority>1</priority></rule>
34
+<rule ref="rulesets/java/basic.xml/BigIntegerInstantiation"><priority>1</priority></rule>
35
+<rule ref="rulesets/java/basic.xml/AvoidMultipleUnaryOperators"><priority>1</priority></rule>
36
+<rule ref="rulesets/java/empty.xml/EmptyInitializer"><priority>1</priority></rule>
37 37
 
38
-<rule ref="rulesets/braces.xml/IfStmtsMustUseBraces"><priority>1</priority></rule>
39
-<rule ref="rulesets/braces.xml/WhileLoopsMustUseBraces"><priority>1</priority></rule>
40
-<rule ref="rulesets/braces.xml/IfElseStmtsMustUseBraces"><priority>1</priority></rule>
41
-<rule ref="rulesets/braces.xml/ForLoopsMustUseBraces"><priority>1</priority></rule>
38
+<rule ref="rulesets/java/braces.xml/IfStmtsMustUseBraces"><priority>1</priority></rule>
39
+<rule ref="rulesets/java/braces.xml/WhileLoopsMustUseBraces"><priority>1</priority></rule>
40
+<rule ref="rulesets/java/braces.xml/IfElseStmtsMustUseBraces"><priority>1</priority></rule>
41
+<rule ref="rulesets/java/braces.xml/ForLoopsMustUseBraces"><priority>1</priority></rule>
42 42
 
43
-<rule ref="rulesets/controversial.xml/UnusedModifier"><priority>1</priority></rule>
44
-<rule ref="rulesets/controversial.xml/DontImportSun"><priority>1</priority></rule>
45
-<rule ref="rulesets/controversial.xml/UnnecessaryParentheses"><priority>1</priority></rule>
43
+<rule ref="rulesets/java/unusedcode.xml/UnusedModifier"><priority>1</priority></rule>
44
+<rule ref="rulesets/java/controversial.xml/DontImportSun"><priority>1</priority></rule>
46 45
 
47
-<rule ref="rulesets/design.xml/SimplifyBooleanReturns"><priority>1</priority></rule>
48
-<rule ref="rulesets/design.xml/SimplifyBooleanExpressions"><priority>1</priority></rule>
49
-<rule ref="rulesets/design.xml/AvoidReassigningParameters"><priority>1</priority></rule>
50
-<rule ref="rulesets/design.xml/FinalFieldCouldBeStatic"><priority>1</priority></rule>
51
-<rule ref="rulesets/design.xml/NonStaticInitializer"><priority>1</priority></rule>
52
-<rule ref="rulesets/design.xml/OptimizableToArrayCall"><priority>1</priority></rule>
53
-<rule ref="rulesets/design.xml/BadComparison"><priority>1</priority></rule>
54
-<rule ref="rulesets/design.xml/EqualsNull"><priority>1</priority></rule>
55
-<rule ref="rulesets/design.xml/InstantiationToGetClass"><priority>1</priority></rule>
56
-<rule ref="rulesets/design.xml/IdempotentOperations"><priority>1</priority></rule>
57
-<rule ref="rulesets/design.xml/AssignmentToNonFinalStatic"><priority>1</priority></rule>
58
-<rule ref="rulesets/design.xml/MissingStaticMethodInNonInstantiatableClass"><priority>1</priority></rule>
59
-<rule ref="rulesets/design.xml/UseNotifyAllInsteadOfNotify"><priority>1</priority></rule>
60
-<rule ref="rulesets/design.xml/AvoidInstanceofChecksInCatchClause"><priority>1</priority></rule>
61
-<rule ref="rulesets/design.xml/SimplifyConditional"><priority>1</priority></rule>
62
-<rule ref="rulesets/design.xml/UnnecessaryLocalBeforeReturn"><priority>1</priority></rule>
63
-<rule ref="rulesets/design.xml/NonThreadSafeSingleton"><priority>1</priority></rule>
64
-<rule ref="rulesets/design.xml/AvoidConstantsInterface"><priority>1</priority></rule>
65
-<rule ref="rulesets/design.xml/UnsynchronizedStaticDateFormatter"><priority>1</priority></rule>
66
-<rule ref="rulesets/design.xml/PreserveStackTrace"><priority>1</priority></rule>
67
-<rule ref="rulesets/design.xml/UseCollectionIsEmpty"><priority>1</priority></rule>
46
+<rule ref="rulesets/java/design.xml/SimplifyBooleanReturns"><priority>1</priority></rule>
47
+<rule ref="rulesets/java/design.xml/SimplifyBooleanExpressions"><priority>1</priority></rule>
48
+<rule ref="rulesets/java/design.xml/AvoidReassigningParameters"><priority>1</priority></rule>
49
+<rule ref="rulesets/java/design.xml/FinalFieldCouldBeStatic"><priority>1</priority></rule>
50
+<rule ref="rulesets/java/design.xml/NonStaticInitializer"><priority>1</priority></rule>
51
+<rule ref="rulesets/java/design.xml/OptimizableToArrayCall"><priority>1</priority></rule>
52
+<rule ref="rulesets/java/design.xml/BadComparison"><priority>1</priority></rule>
53
+<rule ref="rulesets/java/design.xml/EqualsNull"><priority>1</priority></rule>
54
+<rule ref="rulesets/java/design.xml/InstantiationToGetClass"><priority>1</priority></rule>
55
+<rule ref="rulesets/java/design.xml/IdempotentOperations"><priority>1</priority></rule>
56
+<rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic"><priority>1</priority></rule>
57
+<rule ref="rulesets/java/design.xml/MissingStaticMethodInNonInstantiatableClass"><priority>1</priority></rule>
58
+<rule ref="rulesets/java/design.xml/UseNotifyAllInsteadOfNotify"><priority>1</priority></rule>
59
+<rule ref="rulesets/java/design.xml/AvoidInstanceofChecksInCatchClause"><priority>1</priority></rule>
60
+<rule ref="rulesets/java/design.xml/SimplifyConditional"><priority>1</priority></rule>
61
+<rule ref="rulesets/java/design.xml/UnnecessaryLocalBeforeReturn"><priority>1</priority></rule>
62
+<rule ref="rulesets/java/design.xml/NonThreadSafeSingleton"><priority>1</priority></rule>
63
+<rule ref="rulesets/java/design.xml/AvoidConstantsInterface"><priority>1</priority></rule>
64
+<rule ref="rulesets/java/design.xml/UnsynchronizedStaticDateFormatter"><priority>1</priority></rule>
65
+<rule ref="rulesets/java/design.xml/PreserveStackTrace"><priority>1</priority></rule>
66
+<rule ref="rulesets/java/design.xml/UseCollectionIsEmpty"><priority>1</priority></rule>
68 67
 
69
-<rule ref="rulesets/finalizers.xml/EmptyFinalizer"><priority>1</priority></rule>
70
-<rule ref="rulesets/finalizers.xml/FinalizeOnlyCallsSuperFinalize"><priority>1</priority></rule>
71
-<rule ref="rulesets/finalizers.xml/FinalizeOverloaded"><priority>1</priority></rule>
72
-<rule ref="rulesets/finalizers.xml/FinalizeDoesNotCallSuperFinalize"><priority>1</priority></rule>
73
-<rule ref="rulesets/finalizers.xml/FinalizeShouldBeProtected"><priority>1</priority></rule>
74
-<rule ref="rulesets/finalizers.xml/AvoidCallingFinalize"><priority>1</priority></rule>
68
+<rule ref="rulesets/java/finalizers.xml/EmptyFinalizer"><priority>1</priority></rule>
69
+<rule ref="rulesets/java/finalizers.xml/FinalizeOnlyCallsSuperFinalize"><priority>1</priority></rule>
70
+<rule ref="rulesets/java/finalizers.xml/FinalizeOverloaded"><priority>1</priority></rule>
71
+<rule ref="rulesets/java/finalizers.xml/FinalizeDoesNotCallSuperFinalize"><priority>1</priority></rule>
72
+<rule ref="rulesets/java/finalizers.xml/FinalizeShouldBeProtected"><priority>1</priority></rule>
73
+<rule ref="rulesets/java/finalizers.xml/AvoidCallingFinalize"><priority>1</priority></rule>
75 74
 
76
-<rule ref="rulesets/imports.xml/DuplicateImports"><priority>1</priority></rule>
77
-<rule ref="rulesets/imports.xml/DontImportJavaLang"><priority>1</priority></rule>
78
-<rule ref="rulesets/imports.xml/UnusedImports"><priority>1</priority></rule>
79
-<rule ref="rulesets/imports.xml/ImportFromSamePackage"><priority>1</priority></rule>
75
+<rule ref="rulesets/java/imports.xml/DuplicateImports"><priority>1</priority></rule>
76
+<rule ref="rulesets/java/imports.xml/DontImportJavaLang"><priority>1</priority></rule>
77
+<rule ref="rulesets/java/imports.xml/UnusedImports"><priority>1</priority></rule>
78
+<rule ref="rulesets/java/imports.xml/ImportFromSamePackage"><priority>1</priority></rule>
80 79
 
81
-<rule ref="rulesets/logging-java.xml/MoreThanOneLogger"><priority>1</priority></rule>
82
-<rule ref="rulesets/logging-java.xml/LoggerIsNotStaticFinal"><priority>1</priority></rule>
80
+<rule ref="rulesets/java/logging-java.xml/MoreThanOneLogger"><priority>1</priority></rule>
81
+<rule ref="rulesets/java/logging-java.xml/LoggerIsNotStaticFinal"><priority>1</priority></rule>
83 82
 
84
-<rule ref="rulesets/migrating.xml/ReplaceVectorWithList"><priority>1</priority></rule>
85
-<rule ref="rulesets/migrating.xml/ReplaceHashtableWithMap"><priority>1</priority></rule>
86
-<rule ref="rulesets/migrating.xml/ReplaceEnumerationWithIterator"><priority>1</priority></rule>
87
-<rule ref="rulesets/migrating.xml/AvoidEnumAsIdentifier"><priority>1</priority></rule>
88
-<rule ref="rulesets/migrating.xml/AvoidAssertAsIdentifier"><priority>1</priority></rule>
89
-<rule ref="rulesets/migrating.xml/IntegerInstantiation"><priority>1</priority></rule>
90
-<rule ref="rulesets/migrating.xml/ByteInstantiation"><priority>1</priority></rule>
91
-<rule ref="rulesets/migrating.xml/ShortInstantiation"><priority>1</priority></rule>
92
-<rule ref="rulesets/migrating.xml/LongInstantiation"><priority>1</priority></rule>
83
+<rule ref="rulesets/java/migrating.xml/ReplaceVectorWithList"><priority>1</priority></rule>
84
+<rule ref="rulesets/java/migrating.xml/ReplaceHashtableWithMap"><priority>1</priority></rule>
85
+<rule ref="rulesets/java/migrating.xml/ReplaceEnumerationWithIterator"><priority>1</priority></rule>
86
+<rule ref="rulesets/java/migrating.xml/AvoidEnumAsIdentifier"><priority>1</priority></rule>
87
+<rule ref="rulesets/java/migrating.xml/AvoidAssertAsIdentifier"><priority>1</priority></rule>
88
+<rule ref="rulesets/java/migrating.xml/IntegerInstantiation"><priority>1</priority></rule>
89
+<rule ref="rulesets/java/migrating.xml/ByteInstantiation"><priority>1</priority></rule>
90
+<rule ref="rulesets/java/migrating.xml/ShortInstantiation"><priority>1</priority></rule>
91
+<rule ref="rulesets/java/migrating.xml/LongInstantiation"><priority>1</priority></rule>
93 92
 
94
-<rule ref="rulesets/naming.xml/VariableNamingConventions"><priority>1</priority></rule>
95
-<rule ref="rulesets/naming.xml/MethodNamingConventions"><priority>1</priority></rule>
96
-<rule ref="rulesets/naming.xml/ClassNamingConventions"><priority>1</priority></rule>
97
-<rule ref="rulesets/naming.xml/AvoidDollarSigns"><priority>1</priority></rule>
98
-<rule ref="rulesets/naming.xml/MethodWithSameNameAsEnclosingClass"><priority>1</priority></rule>
99
-<rule ref="rulesets/naming.xml/SuspiciousHashcodeMethodName"><priority>1</priority></rule>
100
-<rule ref="rulesets/naming.xml/SuspiciousConstantFieldName"><priority>1</priority></rule>
101
-<rule ref="rulesets/naming.xml/SuspiciousEqualsMethodName"><priority>1</priority></rule>
102
-<rule ref="rulesets/naming.xml/NoPackage"><priority>1</priority></rule>
103
-<rule ref="rulesets/naming.xml/PackageCase"><priority>1</priority></rule>
93
+<rule ref="rulesets/java/naming.xml/VariableNamingConventions"><priority>1</priority></rule>
94
+<rule ref="rulesets/java/naming.xml/MethodNamingConventions"><priority>1</priority></rule>
95
+<rule ref="rulesets/java/naming.xml/ClassNamingConventions"><priority>1</priority></rule>
96
+<rule ref="rulesets/java/naming.xml/AvoidDollarSigns"><priority>1</priority></rule>
97
+<rule ref="rulesets/java/naming.xml/MethodWithSameNameAsEnclosingClass"><priority>1</priority></rule>
98
+<rule ref="rulesets/java/naming.xml/SuspiciousHashcodeMethodName"><priority>1</priority></rule>
99
+<rule ref="rulesets/java/naming.xml/SuspiciousConstantFieldName"><priority>1</priority></rule>
100
+<rule ref="rulesets/java/naming.xml/SuspiciousEqualsMethodName"><priority>1</priority></rule>
101
+<rule ref="rulesets/java/naming.xml/NoPackage"><priority>1</priority></rule>
102
+<rule ref="rulesets/java/naming.xml/PackageCase"><priority>1</priority></rule>
104 103
 
105
-<rule ref="rulesets/optimizations.xml/LocalVariableCouldBeFinal"><priority>1</priority></rule>
106
-<rule ref="rulesets/optimizations.xml/MethodArgumentCouldBeFinal"><priority>1</priority></rule>
107
-<rule ref="rulesets/optimizations.xml/UseArrayListInsteadOfVector"><priority>1</priority></rule>
108
-<rule ref="rulesets/optimizations.xml/SimplifyStartsWith"><priority>1</priority></rule>
109
-<rule ref="rulesets/optimizations.xml/UseArraysAsList"><priority>1</priority></rule>
110
-<rule ref="rulesets/optimizations.xml/AvoidArrayLoops"><priority>1</priority></rule>
111
-<rule ref="rulesets/optimizations.xml/UnnecessaryWrapperObjectCreation"><priority>1</priority></rule>
112
-<rule ref="rulesets/optimizations.xml/AddEmptyString"><priority>1</priority></rule>
104
+<rule ref="rulesets/java/optimizations.xml/LocalVariableCouldBeFinal"><priority>1</priority><properties><property name="violationSuppressXPath" value="//ForInit|//ForStatement/LocalVariableDeclaration"/></properties></rule>
105
+<rule ref="rulesets/java/optimizations.xml/MethodArgumentCouldBeFinal"><priority>1</priority></rule>
106
+<rule ref="rulesets/java/optimizations.xml/UseArrayListInsteadOfVector"><priority>1</priority></rule>
107
+<rule ref="rulesets/java/optimizations.xml/SimplifyStartsWith"><priority>1</priority></rule>
108
+<rule ref="rulesets/java/optimizations.xml/UseArraysAsList"><priority>1</priority></rule>
109
+<rule ref="rulesets/java/optimizations.xml/AvoidArrayLoops"><priority>1</priority></rule>
110
+<rule ref="rulesets/java/optimizations.xml/UnnecessaryWrapperObjectCreation"><priority>1</priority></rule>
111
+<rule ref="rulesets/java/optimizations.xml/AddEmptyString"><priority>1</priority></rule>
113 112
 
114
-<rule ref="rulesets/strictexception.xml/AvoidCatchingThrowable"><priority>1</priority></rule>
115
-<rule ref="rulesets/strictexception.xml/SignatureDeclareThrowsException"><priority>1</priority></rule>
116
-<rule ref="rulesets/strictexception.xml/ExceptionAsFlowControl"><priority>1</priority></rule>
117
-<rule ref="rulesets/strictexception.xml/AvoidCatchingNPE"><priority>1</priority></rule>
118
-<rule ref="rulesets/strictexception.xml/AvoidThrowingRawExceptionTypes"><priority>1</priority></rule>
119
-<rule ref="rulesets/strictexception.xml/DoNotExtendJavaLangError"><priority>1</priority></rule>
120
-<rule ref="rulesets/strictexception.xml/DoNotThrowExceptionInFinally"><priority>1</priority></rule>
121
-<rule ref="rulesets/strictexception.xml/AvoidThrowingNewInstanceOfSameException"><priority>1</priority></rule>
113
+<rule ref="rulesets/java/strictexception.xml/AvoidCatchingThrowable"><priority>1</priority></rule>
114
+<rule ref="rulesets/java/strictexception.xml/SignatureDeclareThrowsException"><priority>1</priority></rule>
115
+<rule ref="rulesets/java/strictexception.xml/ExceptionAsFlowControl"><priority>1</priority></rule>
116
+<rule ref="rulesets/java/strictexception.xml/AvoidCatchingNPE"><priority>1</priority></rule>
117
+<rule ref="rulesets/java/strictexception.xml/AvoidThrowingRawExceptionTypes"><priority>1</priority></rule>
118
+<rule ref="rulesets/java/strictexception.xml/DoNotExtendJavaLangError"><priority>1</priority></rule>
119
+<rule ref="rulesets/java/strictexception.xml/DoNotThrowExceptionInFinally"><priority>1</priority></rule>
120
+<rule ref="rulesets/java/strictexception.xml/AvoidThrowingNewInstanceOfSameException"><priority>1</priority></rule>
122 121
 
123
-<rule ref="rulesets/strings.xml/StringInstantiation"><priority>1</priority></rule>
124
-<rule ref="rulesets/strings.xml/StringToString"><priority>1</priority></rule>
125
-<rule ref="rulesets/strings.xml/InefficientStringBuffering"><priority>1</priority></rule>
126
-<rule ref="rulesets/strings.xml/UnnecessaryCaseChange"><priority>1</priority></rule>
127
-<rule ref="rulesets/strings.xml/UseStringBufferLength"><priority>1</priority></rule>
128
-<rule ref="rulesets/strings.xml/AppendCharacterWithChar"><priority>1</priority></rule>
129
-<rule ref="rulesets/strings.xml/UseIndexOfChar"><priority>1</priority></rule>
130
-<rule ref="rulesets/strings.xml/InefficientEmptyStringCheck"><priority>1</priority></rule>
131
-<rule ref="rulesets/strings.xml/UselessStringValueOf"><priority>1</priority></rule>
132
-<rule ref="rulesets/strings.xml/StringBufferInstantiationWithChar"><priority>1</priority></rule>
133
-<rule ref="rulesets/strings.xml/UseEqualsToCompareStrings"><priority>1</priority></rule>
122
+<rule ref="rulesets/java/strings.xml/StringInstantiation"><priority>1</priority></rule>
123
+<rule ref="rulesets/java/strings.xml/StringToString"><priority>1</priority></rule>
124
+<rule ref="rulesets/java/strings.xml/InefficientStringBuffering"><priority>1</priority></rule>
125
+<rule ref="rulesets/java/strings.xml/UnnecessaryCaseChange"><priority>1</priority></rule>
126
+<rule ref="rulesets/java/strings.xml/UseStringBufferLength"><priority>1</priority></rule>
127
+<rule ref="rulesets/java/strings.xml/AppendCharacterWithChar"><priority>1</priority></rule>
128
+<rule ref="rulesets/java/strings.xml/UseIndexOfChar"><priority>1</priority></rule>
129
+<rule ref="rulesets/java/strings.xml/InefficientEmptyStringCheck"><priority>1</priority></rule>
130
+<rule ref="rulesets/java/strings.xml/UselessStringValueOf"><priority>1</priority></rule>
131
+<rule ref="rulesets/java/strings.xml/StringBufferInstantiationWithChar"><priority>1</priority></rule>
132
+<rule ref="rulesets/java/strings.xml/UseEqualsToCompareStrings"><priority>1</priority></rule>
134 133
 
135
-<rule ref="rulesets/typeresolution.xml/UnusedImports"><priority>1</priority></rule>
136
-<rule ref="rulesets/typeresolution.xml/SignatureDeclareThrowsException"><priority>1</priority></rule>
134
+<rule ref="rulesets/java/typeresolution.xml/UnusedImports"><priority>1</priority><properties><property name="violationSuppressXPath" value="//ImportDeclaration[@ImportOnDemand='true']"/></properties></rule>
135
+<rule ref="rulesets/java/typeresolution.xml/SignatureDeclareThrowsException"><priority>1</priority></rule>
137 136
 
138
-<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"><priority>1</priority></rule>
139
-<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable"><priority>1</priority></rule>
140
-<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"><priority>1</priority></rule>
141
-<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"><priority>1</priority></rule>
137
+<rule ref="rulesets/java/unusedcode.xml/UnusedPrivateField"><priority>1</priority></rule>
138
+<rule ref="rulesets/java/unusedcode.xml/UnusedLocalVariable"><priority>1</priority></rule>
139
+<rule ref="rulesets/java/unusedcode.xml/UnusedPrivateMethod"><priority>1</priority></rule>
140
+<rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter"><priority>1</priority></rule>
142 141
 
143 142
 </ruleset>

+ 13
- 15
src/com/dmdirc/Server.java View File

@@ -109,7 +109,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
109 109
 public class Server extends FrameContainer implements ConfigChangeListener,
110 110
         CertificateProblemListener, Connection {
111 111
 
112
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(Server.class);
112
+    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(Server.class);
113 113
     /** The name of the general domain. */
114 114
     private static final String DOMAIN_GENERAL = "general";
115 115
     /** The name of the profile domain. */
@@ -311,12 +311,11 @@ public class Server extends FrameContainer implements ConfigChangeListener,
311 311
         assert profile != null;
312 312
 
313 313
         synchronized (myStateLock) {
314
-            log.info("Connecting to {}, current state is {}", address,
315
-                    myState.getState());
314
+            LOG.info("Connecting to {}, current state is {}", address, myState.getState());
316 315
 
317 316
             switch (myState.getState()) {
318 317
                 case RECONNECT_WAIT:
319
-                    log.debug("Cancelling reconnection timer");
318
+                    LOG.debug("Cancelling reconnection timer");
320 319
                     if (reconnectTimerFuture != null) {
321 320
                         reconnectTimerFuture.cancel(false);
322 321
                     }
@@ -414,7 +413,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
414 413
     @Override
415 414
     public void disconnect(final String reason) {
416 415
         synchronized (myStateLock) {
417
-            log.info("Disconnecting. Current state: {}", myState.getState());
416
+            LOG.info("Disconnecting. Current state: {}", myState.getState());
418 417
 
419 418
             switch (myState.getState()) {
420 419
                 case CLOSING:
@@ -423,7 +422,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
423 422
                 case TRANSIENTLY_DISCONNECTED:
424 423
                     return;
425 424
                 case RECONNECT_WAIT:
426
-                    log.debug("Cancelling reconnection timer");
425
+                    LOG.debug("Cancelling reconnection timer");
427 426
                     if (reconnectTimerFuture != null) {
428 427
                         reconnectTimerFuture.cancel(false);
429 428
                     }
@@ -467,7 +466,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
467 466
     @Precondition("The server state is transiently disconnected")
468 467
     private void doDelayedReconnect() {
469 468
         synchronized (myStateLock) {
470
-            log.info("Performing delayed reconnect. State: {}", myState.getState());
469
+            LOG.info("Performing delayed reconnect. State: {}", myState.getState());
471 470
 
472 471
             if (myState.getState() != ServerState.TRANSIENTLY_DISCONNECTED) {
473 472
                 throw new IllegalStateException("doDelayedReconnect when not "
@@ -483,8 +482,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
483 482
                 @Override
484 483
                 public void run() {
485 484
                     synchronized (myStateLock) {
486
-                        log.debug("Reconnect task executing, state: {}",
487
-                                myState.getState());
485
+                        LOG.debug("Reconnect task executing, state: {}", myState.getState());
488 486
                         if (myState.getState() == ServerState.RECONNECT_WAIT) {
489 487
                             myState.transition(ServerState.TRANSIENTLY_DISCONNECTED);
490 488
                             reconnect();
@@ -493,7 +491,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
493 491
                 }
494 492
             }, delay, TimeUnit.MILLISECONDS);
495 493
 
496
-            log.info("Scheduling reconnect task for delay of {}", delay);
494
+            LOG.info("Scheduling reconnect task for delay of {}", delay);
497 495
 
498 496
             myState.transition(ServerState.RECONNECT_WAIT);
499 497
             updateIcon();
@@ -1188,14 +1186,14 @@ public class Server extends FrameContainer implements ConfigChangeListener,
1188 1186
      * Called when the socket has been closed.
1189 1187
      */
1190 1188
     public void onSocketClosed() {
1191
-        log.info("Received socket closed event, state: {}", myState.getState());
1189
+        LOG.info("Received socket closed event, state: {}", myState.getState());
1192 1190
 
1193 1191
         if (whoTimerFuture != null) {
1194 1192
             whoTimerFuture.cancel(false);
1195 1193
         }
1196 1194
 
1197 1195
         if (Thread.holdsLock(myStateLock)) {
1198
-            log.info("State lock contended: rerunning on a new thread");
1196
+            LOG.info("State lock contended: rerunning on a new thread");
1199 1197
 
1200 1198
             executorService.schedule(new Runnable() {
1201 1199
                 @Override
@@ -1264,8 +1262,8 @@ public class Server extends FrameContainer implements ConfigChangeListener,
1264 1262
     @Precondition("The current server state is CONNECTING")
1265 1263
     public void onConnectError(final ParserError errorInfo) {
1266 1264
         synchronized (myStateLock) {
1267
-            log.info("Received connect error event, state: {}; error: {}",
1268
-                    myState.getState(), errorInfo);
1265
+            LOG.info("Received connect error event, state: {}; error: {}", myState.getState(),
1266
+                    errorInfo);
1269 1267
 
1270 1268
             if (myState.getState() == ServerState.CLOSING
1271 1269
                     || myState.getState() == ServerState.DISCONNECTING) {
@@ -1337,7 +1335,7 @@ public class Server extends FrameContainer implements ConfigChangeListener,
1337 1335
 
1338 1336
         if (parser.getPingTime()
1339 1337
                 >= getConfigManager().getOptionInt(DOMAIN_SERVER, "pingtimeout")) {
1340
-            log.warn("Server appears to be stoned, reconnecting");
1338
+            LOG.warn("Server appears to be stoned, reconnecting");
1341 1339
             handleNotification("stonedServer", getAddress());
1342 1340
             reconnect();
1343 1341
         }

+ 2
- 2
src/com/dmdirc/commandparser/PopupMenuItem.java View File

@@ -150,7 +150,7 @@ public class PopupMenuItem {
150 150
 
151 151
             if (offset >= expectedArgs) {
152 152
                 if (builder.length() > 0) {
153
-                    builder.append("\n");
153
+                    builder.append('\n');
154 154
                 }
155 155
 
156 156
                 builder.append(commandManager.getCommandChar());
@@ -165,7 +165,7 @@ public class PopupMenuItem {
165 165
             }
166 166
 
167 167
             if (builder.length() > 0) {
168
-                builder.append("\n");
168
+                builder.append('\n');
169 169
             }
170 170
 
171 171
             builder.append(commandManager.getCommandChar());

+ 7
- 7
src/com/dmdirc/config/ConfigFileBackedConfigProvider.java View File

@@ -51,7 +51,7 @@ import org.slf4j.LoggerFactory;
51 51
  */
52 52
 public class ConfigFileBackedConfigProvider extends BaseConfigProvider implements ConfigProvider {
53 53
 
54
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(
54
+    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(
55 55
             ConfigFileBackedConfigProvider.class);
56 56
     /** The domain used for identity settings. */
57 57
     private static final String DOMAIN = "identity";
@@ -318,7 +318,7 @@ public class ConfigFileBackedConfigProvider extends BaseConfigProvider implement
318 318
 
319 319
         synchronized (this) {
320 320
             oldValue = getOption(domain, option);
321
-            log.trace("{}: setting {}.{} to {} (was: {})", getName(), domain, option, value,
321
+            LOG.trace("{}: setting {}.{} to {} (was: {})", getName(), domain, option, value,
322 322
                     oldValue);
323 323
 
324 324
             if (myTarget.getType() == ConfigTarget.TYPE.GLOBAL) {
@@ -409,11 +409,11 @@ public class ConfigFileBackedConfigProvider extends BaseConfigProvider implement
409 409
 
410 410
     @Override
411 411
     public synchronized void save() {
412
-        log.info("{}: saving. Needsave = {}", new Object[]{getName(), needSave});
412
+        LOG.info("{}: saving. Needsave = {}", new Object[]{getName(), needSave});
413 413
 
414 414
         if (needSave && file != null && file.isWritable()) {
415 415
             if (myTarget != null && myTarget.getType() == ConfigTarget.TYPE.GLOBAL) {
416
-                log.debug("{}: I'm a global config", getName());
416
+                LOG.debug("{}: I'm a global config", getName());
417 417
 
418 418
                 // This branch is executed if this identity is global. In this
419 419
                 // case, we build a global config (removing ourself and the
@@ -437,9 +437,9 @@ public class ConfigFileBackedConfigProvider extends BaseConfigProvider implement
437 437
                 globalConfig.removeIdentity(this);
438 438
                 globalConfig.removeIdentity(identityManager.getVersionSettings());
439 439
 
440
-                if (log.isTraceEnabled()) {
440
+                if (LOG.isTraceEnabled()) {
441 441
                     for (ConfigProvider source : globalConfig.getSources()) {
442
-                        log.trace("{}: source: {}",
442
+                        LOG.trace("{}: source: {}",
443 443
                                 new Object[]{getName(), source.getName()});
444 444
                     }
445 445
                 }
@@ -455,7 +455,7 @@ public class ConfigFileBackedConfigProvider extends BaseConfigProvider implement
455 455
 
456 456
                         if (globalConfig.hasOptionString(domain, key)
457 457
                                 && globalConfig.getOption(domain, key).equals(value)) {
458
-                            log.debug("{}: found superfluous setting: {}.{} (= {})", getName(),
458
+                            LOG.debug("{}: found superfluous setting: {}.{} (= {})", getName(),
459 459
                                     domain, key, value);
460 460
                             file.getKeyDomain(domain).remove(key);
461 461
                         }

+ 9
- 7
src/com/dmdirc/config/ConfigManager.java View File

@@ -39,6 +39,7 @@ import java.util.Map;
39 39
 import java.util.Set;
40 40
 import java.util.TreeMap;
41 41
 
42
+import org.slf4j.Logger;
42 43
 import org.slf4j.LoggerFactory;
43 44
 
44 45
 /**
@@ -47,7 +48,7 @@ import org.slf4j.LoggerFactory;
47 48
 class ConfigManager extends BaseConfigProvider implements ConfigChangeListener,
48 49
         ConfigProviderListener, AggregateConfigProvider {
49 50
 
50
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(ConfigManager.class);
51
+    private static final Logger LOG = LoggerFactory.getLogger(ConfigManager.class);
51 52
     /** Temporary map for lookup stats. */
52 53
     private static final Map<String, Integer> STATS = new TreeMap<>();
53 54
     /** Magical domain to redirect to the version identity. */
@@ -276,7 +277,7 @@ class ConfigManager extends BaseConfigProvider implements ConfigChangeListener,
276 277
         final boolean result = comp != null
277 278
                 && identityTargetMatches(identity.getTarget().getData(), comp);
278 279
 
279
-        log.trace("Checking if identity {} applies. Comparison: {}, target: {}, result: {}",
280
+        LOG.trace("Checking if identity {} applies. Comparison: {}, target: {}, result: {}",
280 281
                 identity, comp, identity.getTarget().getData(), result);
281 282
 
282 283
         return result;
@@ -359,8 +360,9 @@ class ConfigManager extends BaseConfigProvider implements ConfigChangeListener,
359 360
      */
360 361
     void migrate(final String protocol, final String ircd,
361 362
             final String network, final String server, final String channel) {
362
-        log.debug("Migrating from {{}, {}, {}, {}, {}} to {{}, {}, {}, {}, {}}", this.protocol, this.ircd,
363
-                this.network, this.server, this.channel, protocol, ircd, network, server, channel);
363
+        LOG.debug("Migrating from {{}, {}, {}, {}, {}} to {{}, {}, {}, {}, {}}", this.protocol,
364
+                this.ircd, this.network, this.server, this.channel, protocol, ircd, network, server,
365
+                channel);
364 366
 
365 367
         this.protocol = protocol;
366 368
         this.ircd = ircd;
@@ -370,18 +372,18 @@ class ConfigManager extends BaseConfigProvider implements ConfigChangeListener,
370 372
 
371 373
         for (ConfigProvider identity : new ArrayList<>(sources)) {
372 374
             if (!identityApplies(identity)) {
373
-                log.debug("Removing identity that no longer applies: {}", identity);
375
+                LOG.debug("Removing identity that no longer applies: {}", identity);
374 376
                 removeIdentity(identity);
375 377
             }
376 378
         }
377 379
 
378 380
         final List<ConfigProvider> newSources = manager.getIdentitiesForManager(this);
379 381
         for (ConfigProvider identity : newSources) {
380
-            log.trace("Testing new identity: {}", identity);
382
+            LOG.trace("Testing new identity: {}", identity);
381 383
             checkIdentity(identity);
382 384
         }
383 385
 
384
-        log.debug("New identities: {}", sources);
386
+        LOG.debug("New identities: {}", sources);
385 387
     }
386 388
 
387 389
     /**

+ 6
- 6
src/com/dmdirc/config/IdentityManager.java View File

@@ -49,6 +49,7 @@ import java.util.List;
49 49
 import java.util.Map;
50 50
 import java.util.Set;
51 51
 
52
+import org.slf4j.Logger;
52 53
 import org.slf4j.LoggerFactory;
53 54
 
54 55
 import static com.google.common.base.Preconditions.checkArgument;
@@ -56,7 +57,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
56 57
 
57 58
 public class IdentityManager implements IdentityFactory, IdentityController {
58 59
 
59
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(IdentityManager.class);
60
+    private static final Logger LOG = LoggerFactory.getLogger(IdentityManager.class);
60 61
     /** A regular expression that will match all characters illegal in file names. */
61 62
     private static final String ILLEGAL_CHARS = "[\\\\\"/:\\*\\?\"<>\\|]";
62 63
     /** The domain used for identity settings. */
@@ -77,7 +78,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
77 78
     /** The event bus to post events to. */
78 79
     private final DMDircMBassador eventBus;
79 80
     /**
80
-     * The {@link IdentityListener}s that have registered with this manager.
81
+     * The {@link ConfigProviderListener}s that have registered with this manager.
81 82
      *
82 83
      * Listeners for standard identities are inserted with a <code>null</code> key, listeners for a
83 84
      * specific custom type use their type as the key.
@@ -417,8 +418,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
417 418
             identities.add(target, identity);
418 419
         }
419 420
 
420
-        log.debug("Adding identity: {} (group: {})",
421
-                new Object[]{identity, target});
421
+        LOG.debug("Adding identity: {} (group: {})", new Object[]{identity, target});
422 422
 
423 423
         synchronized (listeners) {
424 424
             for (ConfigProviderListener listener : listeners.safeGet(target)) {
@@ -491,7 +491,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
491 491
 
492 492
         Collections.sort(sources, new ConfigProviderTargetComparator());
493 493
 
494
-        log.debug("Found {} source(s) for {}", sources.size(), manager);
494
+        LOG.debug("Found {} source(s) for {}", sources.size(), manager);
495 495
 
496 496
         return sources;
497 497
     }
@@ -693,7 +693,7 @@ public class IdentityManager implements IdentityFactory, IdentityController {
693 693
         final List<ConfigProvider> sources = getIdentitiesForManager(configManager);
694 694
 
695 695
         for (ConfigProvider identity : sources) {
696
-            log.trace("Found {}", identity);
696
+            LOG.trace("Found {}", identity);
697 697
             configManager.checkIdentity(identity);
698 698
         }
699 699
 

+ 4
- 3
src/com/dmdirc/config/prefs/PreferencesCategory.java View File

@@ -27,6 +27,7 @@ import com.dmdirc.util.collections.ListenerList;
27 27
 import java.util.ArrayList;
28 28
 import java.util.List;
29 29
 
30
+import org.slf4j.Logger;
30 31
 import org.slf4j.LoggerFactory;
31 32
 
32 33
 /**
@@ -35,7 +36,7 @@ import org.slf4j.LoggerFactory;
35 36
  */
36 37
 public class PreferencesCategory {
37 38
 
38
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(PreferencesCategory.class);
39
+    private static final Logger LOG = LoggerFactory.getLogger(PreferencesCategory.class);
39 40
     /** The title (name) of this category. */
40 41
     private final String title;
41 42
     /** A description of this category. */
@@ -235,11 +236,11 @@ public class PreferencesCategory {
235 236
      * @return Is a restart needed after saving?
236 237
      */
237 238
     public boolean save() {
238
-        log.debug("{} save method called", getTitle());
239
+        LOG.debug("{} save method called", getTitle());
239 240
 
240 241
         boolean restart = false;
241 242
         for (PreferencesSetting setting : settings) {
242
-            log.trace("{}: saving setting '{}'", getTitle(), setting.getTitle());
243
+            LOG.trace("{}: saving setting '{}'", getTitle(), setting.getTitle());
243 244
             if (setting.save() && setting.isRestartNeeded()) {
244 245
                 restart = true;
245 246
             }

+ 3
- 3
src/com/dmdirc/config/prefs/reader/CategoryReader.java View File

@@ -61,15 +61,15 @@ public class CategoryReader {
61 61
     private static final String PARENT_KEY = "parent";
62 62
     private static final String ICON_KEY = "icon";
63 63
     private static final String DOMAIN_KEY = "domain";
64
-    private static final String ITEMS_KEY = "items";
64
+    private static final String ITEMS_KEY = "items"; // NOPMD
65 65
 
66 66
     private final Map<Object, Object> data;
67 67
     private final List<PreferencesSetting> items = new LinkedList<>();
68 68
     private String title;
69 69
     private String description;
70 70
     private String icon;
71
-    private String parent;
72
-    private String domain;
71
+    private String parent;  // NOPMD
72
+    private String domain;  // NOPMD
73 73
 
74 74
     public CategoryReader(final Map<Object, Object> data) {
75 75
         this.data = checkNotNull(data);

+ 2
- 2
src/com/dmdirc/events/DisplayProperty.java View File

@@ -30,8 +30,8 @@ import com.dmdirc.util.colours.Colour;
30 30
 public final class DisplayProperty<T> {
31 31
 
32 32
     /** The foreground colour of text relating to the event. */
33
-    public static DisplayProperty<Colour> FOREGROUND_COLOUR = new DisplayProperty<>();
33
+    public static final DisplayProperty<Colour> FOREGROUND_COLOUR = new DisplayProperty<>();
34 34
     /** The background colour of text relating to the event. */
35
-    public static DisplayProperty<Colour> BACKGROUND_COLOUR = new DisplayProperty<>();
35
+    public static final DisplayProperty<Colour> BACKGROUND_COLOUR = new DisplayProperty<>();
36 36
 
37 37
 }

+ 1
- 1
src/com/dmdirc/logger/ErrorReporter.java View File

@@ -129,7 +129,7 @@ public class ErrorReporter {
129 129
             title.append(" user: ").append(userModes);
130 130
         }
131 131
 
132
-        title.append(" [").append(ircd).append("]");
132
+        title.append(" [").append(ircd).append(']');
133 133
         return title.toString();
134 134
     }
135 135
 

+ 10
- 12
src/com/dmdirc/plugins/PluginInfo.java View File

@@ -52,6 +52,7 @@ import java.util.TreeMap;
52 52
 import javax.annotation.Nonnull;
53 53
 import javax.inject.Provider;
54 54
 
55
+import org.slf4j.Logger;
55 56
 import org.slf4j.LoggerFactory;
56 57
 
57 58
 import dagger.ObjectGraph;
@@ -61,7 +62,7 @@ import dagger.ObjectGraph;
61 62
  */
62 63
 public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
63 64
 
64
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(PluginInfo.class);
65
+    private static final Logger LOG = LoggerFactory.getLogger(PluginInfo.class);
65 66
     /** The metadata for this plugin. */
66 67
     private final PluginMetaData metaData;
67 68
     /** The initialiser to use for the injector. */
@@ -252,8 +253,7 @@ public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
252 253
     private void getDefaults() {
253 254
         final ConfigProvider defaults = identityController.getAddonSettings();
254 255
 
255
-        log.trace("{}: Using domain '{}'",
256
-                new Object[]{metaData.getName(), getDomain()});
256
+        LOG.trace("{}: Using domain '{}'", new Object[]{metaData.getName(), getDomain()});
257 257
 
258 258
         for (Map.Entry<String, String> entry : metaData.getDefaultSettings().entrySet()) {
259 259
             final String key = entry.getKey();
@@ -569,7 +569,7 @@ public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
569 569
      * @return True if the plugin was found and loaded, false otherwise
570 570
      */
571 571
     protected boolean loadRequiredPlugin(final String name) {
572
-        log.info("Loading required plugin '{}' for plugin {}",
572
+        LOG.info("Loading required plugin '{}' for plugin {}",
573 573
                 new Object[]{name, metaData.getName()});
574 574
 
575 575
         final PluginInfo pi = metaData.getManager().getPluginInfoByName(name);
@@ -746,7 +746,7 @@ public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
746 746
                     } else {
747 747
                         plugin = (Plugin) temp;
748 748
 
749
-                        log.debug("{}: Setting domain '{}'",
749
+                        LOG.debug("{}: Setting domain '{}'",
750 750
                                 new Object[]{metaData.getName(), getDomain()});
751 751
 
752 752
                         plugin.setDomain(getDomain());
@@ -831,13 +831,11 @@ public class PluginInfo implements Comparable<PluginInfo>, ServiceProvider {
831 831
                 }
832 832
 
833 833
                 // Delete ourself as a child of our parent.
834
-                if (!parentUnloading) {
835
-                    if (metaData.getParent() != null) {
836
-                        final PluginInfo pi = metaData.getManager()
837
-                                .getPluginInfoByName(metaData.getParent());
838
-                        if (pi != null) {
839
-                            pi.delChild(this);
840
-                        }
834
+                if (!parentUnloading && metaData.getParent() != null) {
835
+                    final PluginInfo pi = metaData.getManager()
836
+                            .getPluginInfoByName(metaData.getParent());
837
+                    if (pi != null) {
838
+                        pi.delChild(this);
841 839
                     }
842 840
                 }
843 841
 

+ 9
- 9
src/com/dmdirc/ui/core/feedback/CoreFeedbackDialogModel.java View File

@@ -175,29 +175,29 @@ public class CoreFeedbackDialogModel implements FeedbackDialogModel {
175 175
                     continue;
176 176
                 }
177 177
                 serverInfo.append("Actual name: ").append(connection.getParser()
178
-                        .getServerName()).append("\n");
178
+                        .getServerName()).append('\n');
179 179
                 serverInfo.append("Network: ").append(connection.getNetwork())
180
-                        .append("\n");
180
+                        .append('\n');
181 181
                 serverInfo.append("IRCd: ").append(connection.getParser()
182 182
                         .getServerSoftware()).append(" - ");
183 183
                 serverInfo.append(connection.getParser().getServerSoftwareType())
184
-                        .append("\n");
184
+                        .append('\n');
185 185
                 serverInfo.append("Modes: ").append(connection.getParser()
186
-                        .getBooleanChannelModes()).append(" ");
186
+                        .getBooleanChannelModes()).append(' ');
187 187
                 serverInfo.append(connection.getParser().getListChannelModes())
188
-                        .append(" ");
188
+                        .append(' ');
189 189
                 serverInfo.append(connection.getParser().getParameterChannelModes())
190
-                        .append(" ");
190
+                        .append(' ');
191 191
                 serverInfo.append(connection.getParser().
192 192
                         getDoubleParameterChannelModes());
193 193
             }
194 194
         }
195 195
         if (getIncludeDMDircInfo()) {
196 196
             dmdircInfo.append("DMDirc version: ").append(ClientInfo.getVersionInformation())
197
-                    .append("\n");
198
-            dmdircInfo.append("Profile directory: ").append(configDirectory).append("\n");
197
+                    .append('\n');
198
+            dmdircInfo.append("Profile directory: ").append(configDirectory).append('\n');
199 199
             dmdircInfo.append("Java version: ").append(ClientInfo.getJavaInformation())
200
-                    .append("\n");
200
+                    .append('\n');
201 201
             dmdircInfo.append("OS Version: ").append(ClientInfo.getOperatingSystemInformation());
202 202
         }
203 203
         final FeedbackSender sender = feedbackSenderFactory.getFeedbackSender(

+ 9
- 11
src/com/dmdirc/ui/input/InputHandler.java View File

@@ -62,7 +62,7 @@ import org.slf4j.LoggerFactory;
62 62
  */
63 63
 public abstract class InputHandler implements ConfigChangeListener {
64 64
 
65
-    private static final Logger log = LoggerFactory.getLogger(InputHandler.class);
65
+    private static final Logger LOG = LoggerFactory.getLogger(InputHandler.class);
66 66
     /**
67 67
      * Indicates that the caret should be moved to the start of a selection when a control code has
68 68
      * been inserted.
@@ -291,18 +291,18 @@ public abstract class InputHandler implements ConfigChangeListener {
291 291
     /** Resets the composition state to idle and notifies the parent if relevant. */
292 292
     private void cancelTypingNotification() {
293 293
         if (compositionTimer != null) {
294
-            log.debug("Cancelling composition timer");
294
+            LOG.debug("Cancelling composition timer");
295 295
             compositionTimer.cancel();
296 296
         }
297 297
 
298
-        log.debug("Cancelling typing notification");
298
+        LOG.debug("Cancelling typing notification");
299 299
         setCompositionState(CompositionState.IDLE);
300 300
     }
301 301
 
302 302
     /** Updates the composition state to typing and starts/resets the idle timer. */
303 303
     private void updateTypingNotification() {
304 304
         if (compositionTimer != null) {
305
-            log.debug("Cancelling composition timer");
305
+            LOG.debug("Cancelling composition timer");
306 306
             compositionTimer.cancel();
307 307
         }
308 308
 
@@ -314,13 +314,13 @@ public abstract class InputHandler implements ConfigChangeListener {
314 314
             }
315 315
         }, TYPING_TIMEOUT);
316 316
 
317
-        log.debug("Setting composition state to typing. Timer scheduled for {}", TYPING_TIMEOUT);
317
+        LOG.debug("Setting composition state to typing. Timer scheduled for {}", TYPING_TIMEOUT);
318 318
         setCompositionState(CompositionState.TYPING);
319 319
     }
320 320
 
321 321
     /** Updates the composition state to "entered text". */
322 322
     private void timeoutTypingNotification() {
323
-        log.debug("Composition state timeout reached");
323
+        LOG.debug("Composition state timeout reached");
324 324
         setCompositionState(CompositionState.ENTERED_TEXT);
325 325
     }
326 326
 
@@ -485,15 +485,14 @@ public abstract class InputHandler implements ConfigChangeListener {
485 485
      */
486 486
     protected void doTabCompletion(final boolean shiftPressed) {
487 487
         if (tabCompleter == null || (flags & HANDLE_TABCOMPLETION) == 0) {
488
-            log.debug(
489
-                    "Aborting tab completion. Completer: {}, flags: {}",
488
+            LOG.debug("Aborting tab completion. Completer: {}, flags: {}",
490 489
                     new Object[]{tabCompleter, flags});
491 490
             return;
492 491
         }
493 492
 
494 493
         final String text = target.getText();
495 494
 
496
-        log.trace("Text for tab completion: {}", text);
495
+        LOG.trace("Text for tab completion: {}", text);
497 496
 
498 497
         if (text.isEmpty()) {
499 498
             doNormalTabCompletion(text, 0, 0, shiftPressed, null);
@@ -521,8 +520,7 @@ public abstract class InputHandler implements ConfigChangeListener {
521 520
             end = start;
522 521
         }
523 522
 
524
-        log.trace("Offsets: start: {}, end: {}",
525
-                new Object[]{start, end});
523
+        LOG.trace("Offsets: start: {}, end: {}", new Object[]{start, end});
526 524
 
527 525
         if (start > 0 && text.charAt(0) == commandController.getCommandChar()) {
528 526
             doCommandTabCompletion(text, start, end, shiftPressed);

+ 13
- 12
src/com/dmdirc/updater/checking/DMDircCheckStrategy.java View File

@@ -40,6 +40,7 @@ import java.util.Map;
40 40
 
41 41
 import javax.inject.Inject;
42 42
 
43
+import org.slf4j.Logger;
43 44
 import org.slf4j.LoggerFactory;
44 45
 
45 46
 /**
@@ -47,7 +48,7 @@ import org.slf4j.LoggerFactory;
47 48
  */
48 49
 public class DMDircCheckStrategy implements UpdateCheckStrategy {
49 50
 
50
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(DMDircCheckStrategy.class);
51
+    private static final Logger LOG = LoggerFactory.getLogger(DMDircCheckStrategy.class);
51 52
     /** The URL to request to check for updates. */
52 53
     private static final String UPDATE_URL = "http://updates.dmdirc.com/";
53 54
     /** The update channel to check for updates on. */
@@ -75,12 +76,12 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
75 76
      */
76 77
     @ConfigBinding(domain = "updater", key = "channel")
77 78
     public void setChannel(final String channel) {
78
-        log.info("Changing channel to {}", channel);
79
+        LOG.info("Changing channel to {}", channel);
79 80
 
80 81
         try {
81 82
             this.channel = UpdateChannel.valueOf(channel.toUpperCase());
82 83
         } catch (IllegalArgumentException ex) {
83
-            log.warn("Unknown channel {}", channel, ex);
84
+            LOG.warn("Unknown channel {}", channel, ex);
84 85
         }
85 86
     }
86 87
 
@@ -92,13 +93,13 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
92 93
 
93 94
         try {
94 95
             final List<String> response = downloader.getPage(UPDATE_URL, getPayload(components));
95
-            log.trace("Response from update server: {}", response);
96
+            LOG.trace("Response from update server: {}", response);
96 97
 
97 98
             for (String line : response) {
98 99
                 final UpdateComponent component = names.get(getComponent(line));
99 100
 
100 101
                 if (component == null) {
101
-                    log.warn("Unable to extract component from line: {}", line);
102
+                    LOG.warn("Unable to extract component from line: {}", line);
102 103
                     continue;
103 104
                 }
104 105
 
@@ -109,7 +110,7 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
109 110
                 }
110 111
             }
111 112
         } catch (IOException ex) {
112
-            log.warn("I/O exception when checking for updates", ex);
113
+            LOG.warn("I/O exception when checking for updates", ex);
113 114
         }
114 115
 
115 116
         return res;
@@ -127,8 +128,8 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
127 128
         final StringBuilder data = new StringBuilder("data=");
128 129
 
129 130
         for (UpdateComponent component : components) {
130
-            log.trace("Adding payload info for component {} (version {})",
131
-                    component.getName(), component.getVersion());
131
+            LOG.trace("Adding payload info for component {} (version {})", component.getName(),
132
+                    component.getVersion());
132 133
 
133 134
             data.append(component.getName());
134 135
             data.append(',');
@@ -138,7 +139,7 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
138 139
             data.append(';');
139 140
         }
140 141
 
141
-        log.debug("Constructed update payload: {}", data);
142
+        LOG.debug("Constructed update payload: {}", data);
142 143
 
143 144
         return data.toString();
144 145
     }
@@ -175,10 +176,10 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
175 176
             case "uptodate":
176 177
                 return new BaseCheckResult(component);
177 178
             case "error":
178
-                log.warn("Error received from update server: {}", line);
179
+                LOG.warn("Error received from update server: {}", line);
179 180
                 break;
180 181
             default:
181
-                log.error("Unknown update line received from server: {}", line);
182
+                LOG.error("Unknown update line received from server: {}", line);
182 183
                 break;
183 184
         }
184 185
 
@@ -199,7 +200,7 @@ public class DMDircCheckStrategy implements UpdateCheckStrategy {
199 200
             return new BaseDownloadableResult(component, new URL(parts[5]),
200 201
                     parts[4], new Version(parts[3]));
201 202
         } catch (MalformedURLException ex) {
202
-            log.error("Unable to construct URL for update. Parts: {}", parts, ex);
203
+            LOG.error("Unable to construct URL for update. Parts: {}", parts, ex);
203 204
             return null;
204 205
         }
205 206
     }

+ 25
- 24
src/com/dmdirc/updater/manager/UpdateManagerImpl.java View File

@@ -42,6 +42,7 @@ import java.util.Map;
42 42
 import java.util.concurrent.CopyOnWriteArrayList;
43 43
 import java.util.concurrent.Executor;
44 44
 
45
+import org.slf4j.Logger;
45 46
 import org.slf4j.LoggerFactory;
46 47
 
47 48
 /**
@@ -49,7 +50,7 @@ import org.slf4j.LoggerFactory;
49 50
  */
50 51
 public class UpdateManagerImpl implements UpdateManager {
51 52
 
52
-    private static final org.slf4j.Logger log = LoggerFactory.getLogger(UpdateManagerImpl.class);
53
+    private static final Logger LOG = LoggerFactory.getLogger(UpdateManagerImpl.class);
53 54
     /** Collection of known update checking strategies. */
54 55
     private final List<UpdateCheckStrategy> checkers = new CopyOnWriteArrayList<>();
55 56
     /** Collection of known update retrieval strategies. */
@@ -94,27 +95,27 @@ public class UpdateManagerImpl implements UpdateManager {
94 95
 
95 96
     @Override
96 97
     public void addCheckStrategy(final UpdateCheckStrategy strategy) {
97
-        log.trace("Adding new check strategy: {}", strategy);
98
+        LOG.trace("Adding new check strategy: {}", strategy);
98 99
         this.checkers.add(strategy);
99 100
     }
100 101
 
101 102
     @Override
102 103
     public void addRetrievalStrategy(final UpdateRetrievalStrategy strategy) {
103
-        log.trace("Adding new retrieval strategy: {}", strategy);
104
+        LOG.trace("Adding new retrieval strategy: {}", strategy);
104 105
         strategy.addUpdateRetrievalListener(retrievalListener);
105 106
         this.retrievers.add(strategy);
106 107
     }
107 108
 
108 109
     @Override
109 110
     public void addInstallationStrategy(final UpdateInstallationStrategy strategy) {
110
-        log.trace("Adding new installation strategy: {}", strategy);
111
+        LOG.trace("Adding new installation strategy: {}", strategy);
111 112
         strategy.addUpdateInstallationListener(installationListener);
112 113
         this.installers.add(strategy);
113 114
     }
114 115
 
115 116
     @Override
116 117
     public void addComponent(final UpdateComponent component) {
117
-        log.trace("Adding new component: {}", component);
118
+        LOG.trace("Adding new component: {}", component);
118 119
         synchronized (componentsLock) {
119 120
             this.components.put(component.getName(), component);
120 121
         }
@@ -122,7 +123,7 @@ public class UpdateManagerImpl implements UpdateManager {
122 123
 
123 124
     @Override
124 125
     public void removeComponent(final UpdateComponent component) {
125
-        log.trace("Removing component: {}", component);
126
+        LOG.trace("Removing component: {}", component);
126 127
         synchronized (componentsLock) {
127 128
             this.components.remove(component.getName());
128 129
         }
@@ -147,10 +148,10 @@ public class UpdateManagerImpl implements UpdateManager {
147 148
     public void checkForUpdates() {
148 149
         final Collection<Map<UpdateComponent, UpdateCheckResult>> results = new ArrayList<>();
149 150
 
150
-        log.info("Checking for updates for {} components using {} strategies",
151
-                components.size(), checkers.size());
152
-        log.trace("Components: {}", components);
153
-        log.trace("Strategies: {}", checkers);
151
+        LOG.info("Checking for updates for {} components using {} strategies", components.size(),
152
+                checkers.size());
153
+        LOG.trace("Components: {}", components);
154
+        LOG.trace("Strategies: {}", checkers);
154 155
 
155 156
         final List<UpdateComponent> enabledComponents = new ArrayList<>(components.size());
156 157
         final List<UpdateComponent> disabledComponents = new ArrayList<>(components.size());
@@ -160,7 +161,7 @@ public class UpdateManagerImpl implements UpdateManager {
160 161
                 if (policy.canCheck(component)) {
161 162
                     enabledComponents.add(component);
162 163
                 } else {
163
-                    log.debug("Checking for updates for {} denied by policy", component.getName());
164
+                    LOG.debug("Checking for updates for {} denied by policy", component.getName());
164 165
                     disabledComponents.add(component);
165 166
                 }
166 167
             }
@@ -186,7 +187,7 @@ public class UpdateManagerImpl implements UpdateManager {
186 187
         for (UpdateComponent component : enabledComponents) {
187 188
             if (checkResults.containsKey(component) && checkResults.get(component).
188 189
                     isUpdateAvailable()) {
189
-                log.trace("Update is available for {}", component);
190
+                LOG.trace("Update is available for {}", component);
190 191
                 listenerList.getCallable(UpdateStatusListener.class)
191 192
                         .updateStatusChanged(component, UpdateStatus.UPDATE_PENDING, 0);
192 193
             } else {
@@ -214,7 +215,7 @@ public class UpdateManagerImpl implements UpdateManager {
214 215
         } else {
215 216
             listenerList.getCallable(UpdateStatusListener.class)
216 217
                     .updateStatusChanged(component, UpdateStatus.INSTALL_PENDING, 0);
217
-            log.debug("Scheduling install for {}", update);
218
+            LOG.debug("Scheduling install for {}", update);
218 219
             executor.execute(new InstallationTask(strategy, update));
219 220
         }
220 221
     }
@@ -232,7 +233,7 @@ public class UpdateManagerImpl implements UpdateManager {
232 233
      */
233 234
     public void retrieve(final UpdateComponent component, final boolean install) {
234 235
         if (!checkResults.containsKey(component) || !checkResults.get(component).isUpdateAvailable()) {
235
-            log.warn("Tried to retrieve component with no update: {}", component);
236
+            LOG.warn("Tried to retrieve component with no update: {}", component);
236 237
             return;
237 238
         }
238 239
 
@@ -245,7 +246,7 @@ public class UpdateManagerImpl implements UpdateManager {
245 246
         } else {
246 247
             listenerList.getCallable(UpdateStatusListener.class)
247 248
                     .updateStatusChanged(component, UpdateStatus.UPDATE_PENDING, 0);
248
-            log.debug("Scheduling retrieval for {}", update);
249
+            LOG.debug("Scheduling retrieval for {}", update);
249 250
             executor.execute(new RetrievalTask(this, strategy, update, install));
250 251
         }
251 252
     }
@@ -256,7 +257,7 @@ public class UpdateManagerImpl implements UpdateManager {
256 257
      * @param result The result retrieved from the {@link UpdateRetrievalStrategy}.
257 258
      */
258 259
     protected void setRetrievalResult(final UpdateRetrievalResult result) {
259
-        log.debug("Received retrieval result {}", result);
260
+        LOG.debug("Received retrieval result {}", result);
260 261
         retrievalResults.put(result.getCheckResult().getComponent(), result);
261 262
     }
262 263
 
@@ -269,18 +270,18 @@ public class UpdateManagerImpl implements UpdateManager {
269 270
      * @return A relevant strategy, or <code>null</code> if none are available
270 271
      */
271 272
     protected UpdateRetrievalStrategy getStrategy(final UpdateCheckResult result) {
272
-        log.debug("Trying to find retrieval strategy for {}", result);
273
+        LOG.debug("Trying to find retrieval strategy for {}", result);
273 274
 
274 275
         for (UpdateRetrievalStrategy strategy : retrievers) {
275
-            log.trace("Testing strategy {}", strategy);
276
+            LOG.trace("Testing strategy {}", strategy);
276 277
 
277 278
             if (strategy.canHandle(result)) {
278
-                log.debug("Found strategy {}", strategy);
279
+                LOG.debug("Found strategy {}", strategy);
279 280
                 return strategy;
280 281
             }
281 282
         }
282 283
 
283
-        log.warn("No strategy found to retrieve {}", result);
284
+        LOG.warn("No strategy found to retrieve {}", result);
284 285
         return null;
285 286
     }
286 287
 
@@ -293,18 +294,18 @@ public class UpdateManagerImpl implements UpdateManager {
293 294
      * @return A relevant strategy, or <code>null</code> if none are available
294 295
      */
295 296
     protected UpdateInstallationStrategy getStrategy(final UpdateRetrievalResult result) {
296
-        log.debug("Trying to find installation strategy for {}", result);
297
+        LOG.debug("Trying to find installation strategy for {}", result);
297 298
 
298 299
         for (UpdateInstallationStrategy strategy : installers) {
299
-            log.trace("Testing strategy {}", strategy);
300
+            LOG.trace("Testing strategy {}", strategy);
300 301
 
301 302
             if (strategy.canHandle(result)) {
302
-                log.debug("Found strategy {}", strategy);
303
+                LOG.debug("Found strategy {}", strategy);
303 304
                 return strategy;
304 305
             }
305 306
         }
306 307
 
307
-        log.warn("No strategy found to install {}", result);
308
+        LOG.warn("No strategy found to install {}", result);
308 309
         return null;
309 310
     }
310 311
 

+ 1
- 1
test/com/dmdirc/ServerManagerTest.java View File

@@ -198,7 +198,7 @@ public class ServerManagerTest {
198 198
 
199 199
         assertEquals(3, serverManager.getConnectionCount());
200 200
 
201
-        URI serverUri = uriCaptor.getValue();
201
+        final URI serverUri = uriCaptor.getValue();
202 202
         assertEquals("irc", serverUri.getScheme());
203 203
         assertEquals("irc.quakenet.org", serverUri.getHost());
204 204
         assertEquals("DMDirc", serverUri.getPath().substring(1));

+ 2
- 2
test/com/dmdirc/WritableFrameContainerTest.java View File

@@ -111,8 +111,8 @@ public class WritableFrameContainerTest {
111 111
 
112 112
         for (String[][] test : tests) {
113 113
             final String[] res = container10.splitLine(test[0][0]).toArray(new String[0]);
114
-            assertTrue("'" + test[0][0] + "' → "
115
-                    + Arrays.toString(res) + " (expected: " + Arrays.toString(test[1]) + ")",
114
+            assertTrue('\'' + test[0][0] + "' → "
115
+                    + Arrays.toString(res) + " (expected: " + Arrays.toString(test[1]) + ')',
116 116
                     Arrays.equals(res, test[1]));
117 117
         }
118 118
     }

+ 4
- 4
test/com/dmdirc/actions/ActionConditionTest.java View File

@@ -102,9 +102,9 @@ public class ActionConditionTest {
102 102
     public void testToString() {
103 103
         final ActionCondition ac1 = new ActionCondition("foobarbaz",
104 104
             CoreActionComparison.STRING_STARTSWITH, "foo");
105
-        assertTrue(ac1.toString().indexOf("foo") > -1);
106
-        assertTrue(ac1.toString().indexOf("foobarbaz") > -1);
107
-        assertTrue(ac1.toString().indexOf(CoreActionComparison.STRING_STARTSWITH.toString()) > -1);
105
+        assertTrue(ac1.toString().contains("foo"));
106
+        assertTrue(ac1.toString().contains("foobarbaz"));
107
+        assertTrue(ac1.toString().contains(CoreActionComparison.STRING_STARTSWITH.toString()));
108 108
     }
109 109
 
110 110
     @Test
@@ -116,7 +116,7 @@ public class ActionConditionTest {
116 116
 
117 117
         assertTrue(ac1.equals(ac2));
118 118
         assertTrue(ac2.equals(ac1));
119
-        assertFalse(ac1.equals(null));
119
+        assertFalse(ac1.equals(null)); // NOPMD
120 120
         assertFalse(ac1.equals("foo"));
121 121
         assertEquals(ac1.hashCode(), ac2.hashCode());
122 122
 

+ 18
- 18
test/com/dmdirc/actions/ActionGroupTest.java View File

@@ -33,36 +33,36 @@ public class ActionGroupTest {
33 33
 
34 34
     @Test
35 35
     public void testGetAuthor() {
36
-        ActionGroup instance = new ActionGroup("moo");
36
+        final ActionGroup instance = new ActionGroup("moo");
37 37
         instance.setAuthor("foo");
38 38
 
39
-        String expResult = "foo";
40
-        String result = instance.getAuthor();
39
+        final String expResult = "foo";
40
+        final String result = instance.getAuthor();
41 41
         assertEquals(expResult, result);
42 42
     }
43 43
 
44 44
     @Test
45 45
     public void testGetDescription() {
46
-        ActionGroup instance = new ActionGroup("bar");
46
+        final ActionGroup instance = new ActionGroup("bar");
47 47
         instance.setDescription("Tra-la-la-la-la");
48 48
 
49
-        String expResult = "Tra-la-la-la-la";
50
-        String result = instance.getDescription();
49
+        final String expResult = "Tra-la-la-la-la";
50
+        final String result = instance.getDescription();
51 51
         assertEquals(expResult, result);
52 52
     }
53 53
 
54 54
     @Test
55 55
     public void testGetName() {
56
-        ActionGroup instance = new ActionGroup("foobar");
56
+        final ActionGroup instance = new ActionGroup("foobar");
57 57
 
58
-        String expResult = "foobar";
59
-        String result = instance.getName();
58
+        final String expResult = "foobar";
59
+        final String result = instance.getName();
60 60
         assertEquals(expResult, result);
61 61
     }
62 62
 
63 63
     @Test
64 64
     public void testGetSettings() {
65
-        ActionGroup instance = new ActionGroup("foo");
65
+        final ActionGroup instance = new ActionGroup("foo");
66 66
 
67 67
         assertTrue(instance.getSettings().isEmpty());
68 68
 
@@ -72,27 +72,27 @@ public class ActionGroupTest {
72 72
 
73 73
     @Test
74 74
     public void testGetVersion() {
75
-        ActionGroup instance = new ActionGroup("vtest");
75
+        final ActionGroup instance = new ActionGroup("vtest");
76 76
         instance.setVersion(new Version(73));
77 77
 
78
-        Version expResult = new Version(73);
79
-        Version result = instance.getVersion();
78
+        final Version expResult = new Version(73);
79
+        final Version result = instance.getVersion();
80 80
         assertEquals(expResult, result);
81 81
     }
82 82
 
83 83
     @Test
84 84
     public void testGetComponent() {
85
-        ActionGroup instance = new ActionGroup("zzz");
85
+        final ActionGroup instance = new ActionGroup("zzz");
86 86
         instance.setComponent(69);
87 87
 
88
-        int expResult = 69;
89
-        int result = instance.getComponent();
88
+        final int expResult = 69;
89
+        final int result = instance.getComponent();
90 90
         assertEquals(expResult, result);
91 91
     }
92 92
 
93 93
     @Test
94 94
     public void testClear() {
95
-        ActionGroup instance = new ActionGroup("zzz");
95
+        final ActionGroup instance = new ActionGroup("zzz");
96 96
         instance.add(null);
97 97
         assertTrue(instance.iterator().hasNext());
98 98
         instance.clear();
@@ -101,7 +101,7 @@ public class ActionGroupTest {
101 101
 
102 102
     @Test
103 103
     public void testRemove() {
104
-        ActionGroup instance = new ActionGroup("zzz");
104
+        final ActionGroup instance = new ActionGroup("zzz");
105 105
         instance.add(null);
106 106
         assertTrue(instance.iterator().hasNext());
107 107
         instance.remove(null);

+ 8
- 14
test/com/dmdirc/actions/ActionModelTest.java View File

@@ -23,7 +23,6 @@
23 23
 package com.dmdirc.actions;
24 24
 
25 25
 import com.dmdirc.GlobalWindow;
26
-import com.dmdirc.commandparser.parsers.GlobalCommandParser;
27 26
 import com.dmdirc.interfaces.ActionController;
28 27
 import com.dmdirc.interfaces.CommandController;
29 28
 import com.dmdirc.interfaces.actions.ActionType;
@@ -48,7 +47,6 @@ import static org.junit.Assert.assertTrue;
48 47
 @RunWith(MockitoJUnitRunner.class)
49 48
 public class ActionModelTest {
50 49
 
51
-    @Mock private Provider<GlobalCommandParser> gcpProvider;
52 50
     @Mock private Provider<GlobalWindow> gwProvider;
53 51
     @Mock private ActionSubstitutorFactory substitutorFactory;
54 52
     @Mock private ActionController actionController;
@@ -155,12 +153,10 @@ public class ActionModelTest {
155 153
         final ActionModel model = new ActionModel(gwProvider, substitutorFactory,
156 154
                 "group", "name",
157 155
                 new ActionType[]{CoreActionType.CHANNEL_ACTION},
158
-                new String[0], Arrays.asList(new ActionCondition[]{
159
-                    new ActionCondition(2, CoreActionComponent.STRING_STRING,
160
-                            CoreActionComparison.STRING_REGEX, ".*e{5}.*"),
161
-                    new ActionCondition(2, CoreActionComponent.STRING_STRING,
162
-                            CoreActionComparison.STRING_STARTSWITH, "abc"),
163
-                }), ConditionTree.parseString("0|1"), null);
156
+                new String[0], Arrays.asList(new ActionCondition(2, CoreActionComponent.STRING_STRING,
157
+                        CoreActionComparison.STRING_REGEX, ".*e{5}.*"),
158
+                new ActionCondition(2, CoreActionComponent.STRING_STRING,
159
+                        CoreActionComparison.STRING_STARTSWITH, "abc")), ConditionTree.parseString("0|1"), null);
164 160
         final ActionSubstitutor sub = new ActionSubstitutor(actionController,
165 161
                 commandController, configProvider, CoreActionType.CHANNEL_ACTION);
166 162
 
@@ -177,12 +173,10 @@ public class ActionModelTest {
177 173
         final ActionModel model = new ActionModel(gwProvider, substitutorFactory,
178 174
                 "group", "name",
179 175
                 new ActionType[]{CoreActionType.CHANNEL_ACTION},
180
-                new String[0], Arrays.asList(new ActionCondition[]{
181
-                    new ActionCondition(2, CoreActionComponent.STRING_STRING,
182
-                            CoreActionComparison.STRING_REGEX, ".*e{5}.*"),
183
-                    new ActionCondition(2, CoreActionComponent.STRING_STRING,
184
-                            CoreActionComparison.STRING_STARTSWITH, "abc"),
185
-                }), null, null);
176
+                new String[0], Arrays.asList(new ActionCondition(2, CoreActionComponent.STRING_STRING,
177
+                        CoreActionComparison.STRING_REGEX, ".*e{5}.*"),
178
+                new ActionCondition(2, CoreActionComponent.STRING_STRING,
179
+                        CoreActionComparison.STRING_STARTSWITH, "abc")), null, null);
186 180
         final ActionSubstitutor sub = new ActionSubstitutor(actionController, commandController,
187 181
                 configProvider, CoreActionType.CHANNEL_ACTION);
188 182
 

+ 5
- 7
test/com/dmdirc/actions/ActionTest.java View File

@@ -24,7 +24,6 @@ package com.dmdirc.actions;
24 24
 
25 25
 import com.dmdirc.DMDircMBassador;
26 26
 import com.dmdirc.GlobalWindow;
27
-import com.dmdirc.commandparser.parsers.GlobalCommandParser;
28 27
 import com.dmdirc.config.prefs.PreferencesSetting;
29 28
 import com.dmdirc.config.prefs.PreferencesType;
30 29
 import com.dmdirc.interfaces.ActionController;
@@ -72,7 +71,6 @@ public class ActionTest {
72 71
     @Rule public final TemporaryFolder folder = new TemporaryFolder();
73 72
 
74 73
     @Mock private DMDircMBassador eventBus;
75
-    @Mock private Provider<GlobalCommandParser> gcpProvider;
76 74
     @Mock private Provider<GlobalWindow> gwProvider;
77 75
     @Mock private ActionSubstitutorFactory substitutorFactory;
78 76
     @Mock private ActionController actionController;
@@ -122,7 +120,7 @@ public class ActionTest {
122 120
 
123 121
     @Test
124 122
     public void testSetGroup() {
125
-        Action action = new Action(filesystem, eventBus, gwProvider,
123
+        final Action action = new Action(filesystem, eventBus, gwProvider,
126 124
                 substitutorFactory, actionController, identityController, getTempDirectory(),
127 125
                 "unit-test", "test1", new ActionType[0],
128 126
                 new String[0], new ArrayList<ActionCondition>(),
@@ -137,7 +135,7 @@ public class ActionTest {
137 135
 
138 136
     @Test
139 137
     public void testSetName() {
140
-        Action action = new Action(filesystem, eventBus, gwProvider,
138
+        final Action action = new Action(filesystem, eventBus, gwProvider,
141 139
                 substitutorFactory, actionController, identityController, getTempDirectory(),
142 140
                 "unit-test", "test1", new ActionType[0], new String[0],
143 141
                 new ArrayList<ActionCondition>(), ConditionTree.createConjunction(0), null);
@@ -151,7 +149,7 @@ public class ActionTest {
151 149
 
152 150
     @Test
153 151
     public void testDelete() {
154
-        Action action = new Action(filesystem, eventBus, gwProvider,
152
+        final Action action = new Action(filesystem, eventBus, gwProvider,
155 153
                 substitutorFactory, actionController, identityController, getTempDirectory(),
156 154
                 "unit-test", "test1", new ActionType[0],
157 155
                 new String[0], new ArrayList<ActionCondition>(),
@@ -164,7 +162,7 @@ public class ActionTest {
164 162
 
165 163
     @Test
166 164
     public void testRead() throws IOException, InvalidConfigFileException {
167
-        Action action = new Action(filesystem, eventBus, gwProvider,
165
+        final Action action = new Action(filesystem, eventBus, gwProvider,
168 166
                 substitutorFactory, actionController, identityController, getTempDirectory(),
169 167
                 "unit-test", "doesn't_exist");
170 168
         action.config = new ConfigFile(getClass().getResourceAsStream("action1"));
@@ -183,7 +181,7 @@ public class ActionTest {
183 181
 
184 182
     @Test
185 183
     public void testMultipleGroups() throws IOException, InvalidConfigFileException {
186
-        Action action = new Action(filesystem, eventBus, gwProvider,
184
+        final Action action = new Action(filesystem, eventBus, gwProvider,
187 185
                 substitutorFactory, actionController, identityController, getTempDirectory(),
188 186
                 "unit-test", "doesn't_exist");
189 187
         action.config = new ConfigFile(getClass().getResourceAsStream("action_multisettings"));

+ 1
- 1
test/com/dmdirc/actions/ConditionTreeEvaluatorTest.java View File

@@ -36,7 +36,7 @@ public class ConditionTreeEvaluatorTest {
36 36
 
37 37
     private final Boolean[] data;
38 38
 
39
-    public ConditionTreeEvaluatorTest(Boolean[] data) {
39
+    public ConditionTreeEvaluatorTest(final Boolean[] data) {
40 40
         this.data = data;
41 41
     }
42 42
 

+ 1
- 1
test/com/dmdirc/actions/ConditionTreeParserTest.java View File

@@ -36,7 +36,7 @@ public class ConditionTreeParserTest {
36 36
 
37 37
     private final String input, expected;
38 38
 
39
-    public ConditionTreeParserTest(String input, String expected) {
39
+    public ConditionTreeParserTest(final String input, final String expected) {
40 40
         this.input = input;
41 41
         this.expected = expected;
42 42
     }

+ 12
- 15
test/com/dmdirc/actions/CoreActionComparisonTest.java View File

@@ -30,7 +30,7 @@ public class CoreActionComparisonTest {
30 30
     @Test
31 31
     public void testStringRegex() {
32 32
         assertEquals(String.class, CoreActionComparison.STRING_REGEX.appliesTo());
33
-        assertTrue(CoreActionComparison.STRING_REGEX.getName().toLowerCase().indexOf("reg") > -1);
33
+        assertTrue(CoreActionComparison.STRING_REGEX.getName().toLowerCase().contains("reg"));
34 34
         assertTrue(CoreActionComparison.STRING_REGEX.test("hello", "h.*?o"));
35 35
         assertFalse(CoreActionComparison.STRING_REGEX.test("hello", "h.{8}o"));
36 36
         assertFalse(CoreActionComparison.STRING_REGEX.test("hello", "?!!?!{}"));
@@ -39,7 +39,7 @@ public class CoreActionComparisonTest {
39 39
     @Test
40 40
     public void testStringEquals() {
41 41
         assertEquals(String.class, CoreActionComparison.STRING_EQUALS.appliesTo());
42
-        assertTrue(CoreActionComparison.STRING_EQUALS.getName().toLowerCase().indexOf("equal") > -1);
42
+        assertTrue(CoreActionComparison.STRING_EQUALS.getName().toLowerCase().contains("equal"));
43 43
         assertTrue(CoreActionComparison.STRING_EQUALS.test("hello", "hello"));
44 44
         assertTrue(CoreActionComparison.STRING_EQUALS.test("hello", "HELLO"));
45 45
         assertFalse(CoreActionComparison.STRING_EQUALS.test("hello", "h.{8}o"));
@@ -49,9 +49,9 @@ public class CoreActionComparisonTest {
49 49
     @Test
50 50
     public void testStringNEquals() {
51 51
         assertEquals(String.class, CoreActionComparison.STRING_NEQUALS.appliesTo());
52
-        assertTrue(CoreActionComparison.STRING_NEQUALS.getName().toLowerCase().indexOf("equal") > -1);
53
-        assertTrue(CoreActionComparison.STRING_NEQUALS.getName().toLowerCase().indexOf("not") > -1
54
-                || CoreActionComparison.STRING_NEQUALS.getName().toLowerCase().indexOf("n't") > -1);
52
+        assertTrue(CoreActionComparison.STRING_NEQUALS.getName().toLowerCase().contains("equal"));
53
+        assertTrue(CoreActionComparison.STRING_NEQUALS.getName().toLowerCase().contains("not")
54
+                || CoreActionComparison.STRING_NEQUALS.getName().toLowerCase().contains("n't"));
55 55
         assertFalse(CoreActionComparison.STRING_NEQUALS.test("hello", "hello"));
56 56
         assertFalse(CoreActionComparison.STRING_NEQUALS.test("hello", "HELLO"));
57 57
         assertTrue(CoreActionComparison.STRING_NEQUALS.test("hello", "h.{8}o"));
@@ -61,8 +61,7 @@ public class CoreActionComparisonTest {
61 61
     @Test
62 62
     public void testStringStartsWith() {
63 63
         assertEquals(String.class, CoreActionComparison.STRING_STARTSWITH.appliesTo());
64
-        assertTrue(CoreActionComparison.STRING_STARTSWITH.getName().toLowerCase()
65
-                .indexOf("start") > -1);
64
+        assertTrue(CoreActionComparison.STRING_STARTSWITH.getName().toLowerCase().contains("start"));
66 65
         assertTrue(CoreActionComparison.STRING_STARTSWITH.test("hello", "hello"));
67 66
         assertTrue(CoreActionComparison.STRING_STARTSWITH.test("hello", "he"));
68 67
         assertFalse(CoreActionComparison.STRING_STARTSWITH.test("hello", "h.{8}o"));
@@ -72,8 +71,7 @@ public class CoreActionComparisonTest {
72 71
     @Test
73 72
     public void testStringContains() {
74 73
         assertEquals(String.class, CoreActionComparison.STRING_CONTAINS.appliesTo());
75
-        assertTrue(CoreActionComparison.STRING_CONTAINS.getName().toLowerCase()
76
-                .indexOf("contain") > -1);
74
+        assertTrue(CoreActionComparison.STRING_CONTAINS.getName().toLowerCase().contains("contain"));
77 75
         assertTrue(CoreActionComparison.STRING_CONTAINS.test("hello", "hello"));
78 76
         assertTrue(CoreActionComparison.STRING_CONTAINS.test("hello", "lo"));
79 77
         assertFalse(CoreActionComparison.STRING_CONTAINS.test("hello", "h.{8}o"));
@@ -83,10 +81,10 @@ public class CoreActionComparisonTest {
83 81
     @Test
84 82
     public void testStringNContains() {
85 83
         assertEquals(String.class, CoreActionComparison.STRING_NCONTAINS.appliesTo());
86
-        assertTrue(CoreActionComparison.STRING_NCONTAINS.getName().toLowerCase()
87
-                .indexOf("contain") > -1);
88
-        assertTrue(CoreActionComparison.STRING_NCONTAINS.getName().toLowerCase().indexOf("not") > -1
89
-                || CoreActionComparison.STRING_NCONTAINS.getName().toLowerCase().indexOf("n't") > -1);
84
+        assertTrue(
85
+                CoreActionComparison.STRING_NCONTAINS.getName().toLowerCase().contains("contain"));
86
+        assertTrue(CoreActionComparison.STRING_NCONTAINS.getName().toLowerCase().contains("not")
87
+                || CoreActionComparison.STRING_NCONTAINS.getName().toLowerCase().contains("n't"));
90 88
         assertFalse(CoreActionComparison.STRING_NCONTAINS.test("hello", "hello"));
91 89
         assertFalse(CoreActionComparison.STRING_NCONTAINS.test("hello", "lo"));
92 90
         assertTrue(CoreActionComparison.STRING_NCONTAINS.test("hello", "h.{8}o"));
@@ -96,8 +94,7 @@ public class CoreActionComparisonTest {
96 94
     @Test
97 95
     public void testBoolIs() {
98 96
         assertEquals(Boolean.class, CoreActionComparison.BOOL_IS.appliesTo());
99
-        assertTrue(CoreActionComparison.BOOL_IS.getName().toLowerCase()
100
-                .indexOf("is") > -1);
97
+        assertTrue(CoreActionComparison.BOOL_IS.getName().toLowerCase().contains("is"));
101 98
         assertTrue(CoreActionComparison.BOOL_IS.test(Boolean.TRUE, "true"));
102 99
         assertTrue(CoreActionComparison.BOOL_IS.test(Boolean.FALSE, "false"));
103 100
         assertFalse(CoreActionComparison.BOOL_IS.test(Boolean.FALSE, "true"));

+ 19
- 19
test/com/dmdirc/actions/wrappers/ProfileTest.java View File

@@ -67,7 +67,7 @@ public class ProfileTest {
67 67
      */
68 68
     @Test
69 69
     public void testEmptyConstructor() {
70
-        Profile instance = new Profile("New Profile", identityFactory);
70
+        final Profile instance = new Profile("New Profile", identityFactory);
71 71
         assertEquals("", instance.getIdent());
72 72
         assertEquals("New Profile", instance.getName());
73 73
         assertEquals(new ArrayList<>(Arrays.asList("NewProfile")), instance.getNicknames());
@@ -79,7 +79,7 @@ public class ProfileTest {
79 79
      */
80 80
     @Test
81 81
     public void testIdentityConstructor() {
82
-        Profile instance = createProfile();
82
+        final Profile instance = createProfile();
83 83
         assertEquals("ident", instance.getIdent());
84 84
         assertEquals("profile", instance.getName());
85 85
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname2", })
@@ -91,8 +91,8 @@ public class ProfileTest {
91 91
      * Test of addNickname method, of class Profile.
92 92
      */
93 93
     @Test
94
-    public void testAddNickname_String() {
95
-        Profile instance = createProfile();
94
+    public void testAddNicknameString() {
95
+        final Profile instance = createProfile();
96 96
         instance.addNickname("nickname3");
97 97
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname2",
98 98
             "nickname3"}).equals(instance.getNicknames()));
@@ -102,8 +102,8 @@ public class ProfileTest {
102 102
      * Test of addNickname method, of class Profile.
103 103
      */
104 104
     @Test
105
-    public void testAddNickname_String_Contains() {
106
-        Profile instance = createProfile();
105
+    public void testAddNicknameStringContains() {
106
+        final Profile instance = createProfile();
107 107
         instance.addNickname("nickname2");
108 108
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname2"})
109 109
                 .equals(instance.getNicknames()));
@@ -113,8 +113,8 @@ public class ProfileTest {
113 113
      * Test of addNickname method, of class Profile.
114 114
      */
115 115
     @Test
116
-    public void testAddNickname_String_int() {
117
-        Profile instance = createProfile();
116
+    public void testAddNicknameStringInt() {
117
+        final Profile instance = createProfile();
118 118
         instance.addNickname("nickname3", 0);
119 119
         assertTrue(Arrays.asList(new String[]{"nickname3", "nickname1",
120 120
             "nickname2"}).equals(instance.getNicknames()));
@@ -124,8 +124,8 @@ public class ProfileTest {
124 124
      * Test of addNickname method, of class Profile.
125 125
      */
126 126
     @Test
127
-    public void testAddNickname_String_int_Contains() {
128
-        Profile instance = createProfile();
127
+    public void testAddNicknameStringIntContains() {
128
+        final Profile instance = createProfile();
129 129
         instance.addNickname("nickname2", 0);
130 130
         assertTrue(Arrays.asList(new String[]{"nickname1","nickname2"})
131 131
                 .equals(instance.getNicknames()));
@@ -136,7 +136,7 @@ public class ProfileTest {
136 136
      */
137 137
     @Test
138 138
     public void testDelNickname() {
139
-        Profile instance = createProfile();
139
+        final Profile instance = createProfile();
140 140
         instance.delNickname("nickname2");
141 141
         assertTrue(Arrays.asList(new String[]{"nickname1"})
142 142
                 .equals(instance.getNicknames()));
@@ -157,7 +157,7 @@ public class ProfileTest {
157 157
         when(configProvider.getOption("profile", "realname")).thenReturn("realname");
158 158
         when(configProvider.getOption("profile", "ident")).thenReturn("ident");
159 159
 
160
-        Profile instance = new Profile(identityFactory, configProvider);
160
+        final Profile instance = new Profile(identityFactory, configProvider);
161 161
         instance.save();
162 162
         verify(configProvider).setOption("identity", "name", "profile");
163 163
         verify(configProvider).setOption("profile", "nicknames", nicknames);
@@ -171,7 +171,7 @@ public class ProfileTest {
171 171
 
172 172
         when(identityFactory.createProfileConfig("New Profile")).thenReturn(configProvider);
173 173
 
174
-        Profile instance = new Profile("New Profile", identityFactory);
174
+        final Profile instance = new Profile("New Profile", identityFactory);
175 175
         instance.save();
176 176
         verify(identityFactory).createProfileConfig("New Profile");
177 177
     }
@@ -181,7 +181,7 @@ public class ProfileTest {
181 181
      */
182 182
     @Test
183 183
     public void testEditNicknameOldEmpty() {
184
-        Profile instance = createProfile();
184
+        final Profile instance = createProfile();
185 185
         instance.editNickname("", "nickname3");
186 186
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname2"})
187 187
                 .equals(instance.getNicknames()));
@@ -192,7 +192,7 @@ public class ProfileTest {
192 192
      */
193 193
     @Test
194 194
     public void testEditNicknameNewEmpty() {
195
-        Profile instance = createProfile();
195
+        final Profile instance = createProfile();
196 196
         instance.editNickname("nickname2", "");
197 197
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname2"})
198 198
                 .equals(instance.getNicknames()));
@@ -203,7 +203,7 @@ public class ProfileTest {
203 203
      */
204 204
     @Test
205 205
     public void testEditNicknameSame() {
206
-        Profile instance = createProfile();
206
+        final Profile instance = createProfile();
207 207
         instance.editNickname("nickname2", "nickname2");
208 208
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname2"})
209 209
                 .equals(instance.getNicknames()));
@@ -214,7 +214,7 @@ public class ProfileTest {
214 214
      */
215 215
     @Test
216 216
     public void testEditNickname() {
217
-        Profile instance = createProfile();
217
+        final Profile instance = createProfile();
218 218
         instance.editNickname("nickname2", "nickname3");
219 219
         assertTrue(Arrays.asList(new String[]{"nickname1", "nickname3"})
220 220
                 .equals(instance.getNicknames()));
@@ -235,7 +235,7 @@ public class ProfileTest {
235 235
         when(configProvider.getOption("profile", "realname")).thenReturn("realname");
236 236
         when(configProvider.getOption("profile", "ident")).thenReturn("ident");
237 237
 
238
-        Profile instance = new Profile(identityFactory, configProvider);
238
+        final Profile instance = new Profile(identityFactory, configProvider);
239 239
         instance.delete();
240 240
         verify(configProvider).delete();
241 241
     }
@@ -245,7 +245,7 @@ public class ProfileTest {
245 245
      */
246 246
     @Test
247 247
     public void testDeleteNullIdentity() throws IOException {
248
-        Profile instance = new Profile("New Profile", null);
248
+        final Profile instance = new Profile("New Profile", null);
249 249
         instance.delete();
250 250
     }
251 251
 }

+ 2
- 2
test/com/dmdirc/commandparser/CommandArgumentsTest.java View File

@@ -103,9 +103,9 @@ public class CommandArgumentsTest {
103 103
         final char c = '/';
104 104
         final char s = '.';
105 105
 
106
-        assertTrue(new CommandArguments(controller, c + "" + s).isSilent());
106
+        assertTrue(new CommandArguments(controller, Character.toString(c) + s).isSilent());
107 107
         assertFalse(new CommandArguments(controller, "f" + s).isSilent());
108
-        assertTrue(new CommandArguments(controller, c + "" + s + "foo").isSilent());
108
+        assertTrue(new CommandArguments(controller, Character.toString(c) + s + "foo").isSilent());
109 109
         assertFalse(new CommandArguments(controller, "").isSilent());
110 110
         assertFalse(new CommandArguments(controller, "foo").isSilent());
111 111
     }

+ 23
- 23
test/com/dmdirc/commandparser/commands/flags/CommandFlagHandlerTest.java View File

@@ -39,26 +39,26 @@ import static org.mockito.Mockito.*;
39 39
 @RunWith(Parameterized.class)
40 40
 public class CommandFlagHandlerTest {
41 41
 
42
-    private static final CommandFlag noArgsFlag1 = new CommandFlag("noargs1");
43
-    private static final CommandFlag noArgsFlag2 = new CommandFlag("noargs2", false);
44
-    private static final CommandFlag noArgsFlag3 = new CommandFlag("noargs3");
45
-    private static final CommandFlag noArgsFlag4 = new CommandFlag("noargs4", false);
46
-    private static final CommandFlag immArgsFlag1 = new CommandFlag("immargs1", true, 1, 0);
47
-    private static final CommandFlag immArgsFlag2 = new CommandFlag("immargs2", true, 2, 0);
48
-    private static final CommandFlag defArgsFlag1 = new CommandFlag("defargs1", true, 0, 1);
49
-    private static final CommandFlag defArgsFlag2 = new CommandFlag("defargs2", true, 0, 2);
42
+    private static final CommandFlag NO_ARGS_FLAG_1 = new CommandFlag("noargs1");
43
+    private static final CommandFlag NO_ARGS_FLAG_2 = new CommandFlag("noargs2", false);
44
+    private static final CommandFlag NO_ARGS_FLAG_3 = new CommandFlag("noargs3");
45
+    private static final CommandFlag NO_ARGS_FLAG_4 = new CommandFlag("noargs4", false);
46
+    private static final CommandFlag IMM_ARGS_FLAG_1 = new CommandFlag("immargs1", true, 1, 0);
47
+    private static final CommandFlag IMM_ARGS_FLAG_2 = new CommandFlag("immargs2", true, 2, 0);
48
+    private static final CommandFlag DEF_ARGS_FLAG_1 = new CommandFlag("defargs1", true, 0, 1);
49
+    private static final CommandFlag DEF_ARGS_FLAG_2 = new CommandFlag("defargs2", true, 0, 2);
50 50
     private final CommandFlagHandler handler;
51 51
 
52 52
     private final String input;
53 53
     private final CommandFlag[] flags;
54 54
     private final int[] offsets;
55 55
 
56
-    public CommandFlagHandlerTest(String input, CommandFlag[] flags, int[] offsets) {
57
-        noArgsFlag3.addEnabled(noArgsFlag4);
58
-        noArgsFlag3.addDisabled(noArgsFlag1);
56
+    public CommandFlagHandlerTest(final String input, final CommandFlag[] flags, final int[] offsets) {
57
+        NO_ARGS_FLAG_3.addEnabled(NO_ARGS_FLAG_4);
58
+        NO_ARGS_FLAG_3.addDisabled(NO_ARGS_FLAG_1);
59 59
 
60
-        handler = new CommandFlagHandler(noArgsFlag1, noArgsFlag2, noArgsFlag3,
61
-                noArgsFlag4, immArgsFlag1, immArgsFlag2, defArgsFlag1, defArgsFlag2);
60
+        handler = new CommandFlagHandler(NO_ARGS_FLAG_1, NO_ARGS_FLAG_2, NO_ARGS_FLAG_3,
61
+                NO_ARGS_FLAG_4, IMM_ARGS_FLAG_1, IMM_ARGS_FLAG_2, DEF_ARGS_FLAG_1, DEF_ARGS_FLAG_2);
62 62
 
63 63
         this.input = input;
64 64
         this.flags = flags;
@@ -103,14 +103,14 @@ public class CommandFlagHandlerTest {
103 103
     public static List<Object[]> data() {
104 104
         final Object[][] tests = {
105 105
             {"/foo", new CommandFlag[0], new int[]{0}},
106
-            {"/foo --noargs1", new CommandFlag[]{noArgsFlag1}, new int[]{1, 1}},
106
+            {"/foo --noargs1", new CommandFlag[]{NO_ARGS_FLAG_1}, new int[]{1, 1}},
107 107
             {"/foo --noargs2", null, null},
108
-            {"/foo --noargs3", new CommandFlag[]{noArgsFlag3}, new int[]{1, 1}},
108
+            {"/foo --noargs3", new CommandFlag[]{NO_ARGS_FLAG_3}, new int[]{1, 1}},
109 109
             {"/foo --noargs4", null, null},
110 110
             {"/foo --noargs5", new CommandFlag[0], new int[]{0}},
111
-            {"/foo --noargs3 --noargs4", new CommandFlag[]{noArgsFlag3, noArgsFlag4}, new int[]{1, 2, 2}},
111
+            {"/foo --noargs3 --noargs4", new CommandFlag[]{NO_ARGS_FLAG_3, NO_ARGS_FLAG_4}, new int[]{1, 2, 2}},
112 112
             {"/foo --noargs3 --noargs1", null, null},
113
-            {"/foo --noargs1 --noargs3", new CommandFlag[]{noArgsFlag1, noArgsFlag3}, new int[]{1, 2, 2}},
113
+            {"/foo --noargs1 --noargs3", new CommandFlag[]{NO_ARGS_FLAG_1, NO_ARGS_FLAG_3}, new int[]{1, 2, 2}},
114 114
             {"/foo --noargs3 --noargs4 --noargs1", null, null},
115 115
             {"/foo --noargs3 --noargs4 --noargs2", null, null},
116 116
 
@@ -118,20 +118,20 @@ public class CommandFlagHandlerTest {
118 118
             {"/foo --noargs1 --immargs1", null, null},
119 119
             {"/foo --immargs2", null, null},
120 120
             {"/foo --immargs2 xxx", null, null},
121
-            {"/foo --immargs1 arg1", new CommandFlag[]{immArgsFlag1}, new int[]{1, 2}},
122
-            {"/foo --noargs1 --immargs1 arg1", new CommandFlag[]{immArgsFlag1, noArgsFlag1},
121
+            {"/foo --immargs1 arg1", new CommandFlag[]{IMM_ARGS_FLAG_1}, new int[]{1, 2}},
122
+            {"/foo --noargs1 --immargs1 arg1", new CommandFlag[]{IMM_ARGS_FLAG_1, NO_ARGS_FLAG_1},
123 123
                     new int[]{2, 1, 3}},
124
-            {"/foo --immargs1 arg1 --noargs1", new CommandFlag[]{immArgsFlag1, noArgsFlag1},
124
+            {"/foo --immargs1 arg1 --noargs1", new CommandFlag[]{IMM_ARGS_FLAG_1, NO_ARGS_FLAG_1},
125 125
                     new int[]{1, 3, 3}},
126 126
 
127 127
             {"/foo --defargs1", null, null},
128 128
             {"/foo --noargs1 --defargs1", null, null},
129 129
             {"/foo --defargs2", null, null},
130 130
             {"/foo --defargs2 xxx", null, null},
131
-            {"/foo --defargs1 arg1", new CommandFlag[]{defArgsFlag1}, new int[]{1, 2}},
132
-            {"/foo --noargs1 --defargs1 arg1", new CommandFlag[]{defArgsFlag1, noArgsFlag1},
131
+            {"/foo --defargs1 arg1", new CommandFlag[]{DEF_ARGS_FLAG_1}, new int[]{1, 2}},
132
+            {"/foo --noargs1 --defargs1 arg1", new CommandFlag[]{DEF_ARGS_FLAG_1, NO_ARGS_FLAG_1},
133 133
                     new int[]{2, 1, 3}},
134
-            {"/foo --defargs1 --noargs1 arg1", new CommandFlag[]{defArgsFlag1, noArgsFlag1},
134
+            {"/foo --defargs1 --noargs1 arg1", new CommandFlag[]{DEF_ARGS_FLAG_1, NO_ARGS_FLAG_1},
135 135
                     new int[]{2, 2, 3}},
136 136
         };
137 137
 

+ 24
- 24
test/com/dmdirc/config/ConfigTargetTest.java View File

@@ -32,7 +32,7 @@ public class ConfigTargetTest {
32 32
     public void testDefault() {
33 33
         final ConfigTarget target = new ConfigTarget();
34 34
 
35
-        assertEquals(target.getType(), ConfigTarget.TYPE.GLOBAL);
35
+        assertEquals(ConfigTarget.TYPE.GLOBAL, target.getType());
36 36
         assertTrue(target.toString().toLowerCase().matches("global.*config"));
37 37
     }
38 38
 
@@ -41,8 +41,8 @@ public class ConfigTargetTest {
41 41
         final ConfigTarget target = new ConfigTarget();
42 42
         target.setGlobal();
43 43
 
44
-        assertEquals(target.getType(), ConfigTarget.TYPE.GLOBAL);
45
-        assertEquals(target.getTypeName(), "global");
44
+        assertEquals(ConfigTarget.TYPE.GLOBAL, target.getType());
45
+        assertEquals("global", target.getTypeName());
46 46
         assertTrue(target.toString().toLowerCase().matches("global.*config"));
47 47
     }
48 48
 
@@ -51,8 +51,8 @@ public class ConfigTargetTest {
51 51
         final ConfigTarget target = new ConfigTarget();
52 52
         target.setGlobalDefault();
53 53
 
54
-        assertEquals(target.getType(), ConfigTarget.TYPE.GLOBALDEFAULT);
55
-        assertEquals(target.getTypeName(), "globaldefault");
54
+        assertEquals(ConfigTarget.TYPE.GLOBALDEFAULT, target.getType());
55
+        assertEquals("globaldefault", target.getTypeName());
56 56
         assertTrue(target.toString().toLowerCase().matches("global.*defaults"));
57 57
     }
58 58
 
@@ -61,8 +61,8 @@ public class ConfigTargetTest {
61 61
         final ConfigTarget target = new ConfigTarget();
62 62
         target.setTheme();
63 63
 
64
-        assertEquals(target.getType(), ConfigTarget.TYPE.THEME);
65
-        assertEquals(target.getTypeName(), "theme");
64
+        assertEquals(ConfigTarget.TYPE.THEME, target.getType());
65
+        assertEquals("theme", target.getTypeName());
66 66
         assertTrue(target.toString().toLowerCase().matches("theme"));
67 67
     }
68 68
 
@@ -71,8 +71,8 @@ public class ConfigTargetTest {
71 71
         final ConfigTarget target = new ConfigTarget();
72 72
         target.setCustom("profile");
73 73
 
74
-        assertEquals(target.getType(), ConfigTarget.TYPE.CUSTOM);
75
-        assertEquals(target.getTypeName(), "custom");
74
+        assertEquals(ConfigTarget.TYPE.CUSTOM, target.getType());
75
+        assertEquals("custom", target.getTypeName());
76 76
         assertEquals("profile", target.getData());
77 77
         assertEquals("custom: profile", target.toString().toLowerCase());
78 78
     }
@@ -82,9 +82,9 @@ public class ConfigTargetTest {
82 82
         final ConfigTarget target = new ConfigTarget();
83 83
         target.setProtocol("irc");
84 84
 
85
-        assertEquals(target.getType(), ConfigTarget.TYPE.PROTOCOL);
86
-        assertEquals(target.getTypeName(), "protocol");
87
-        assertEquals(target.getData(), "irc");
85
+        assertEquals(ConfigTarget.TYPE.PROTOCOL, target.getType());
86
+        assertEquals("protocol", target.getTypeName());
87
+        assertEquals("irc", target.getData());
88 88
         assertTrue(target.toString().toLowerCase().matches("protocol.*: irc"));
89 89
     }
90 90
 
@@ -93,9 +93,9 @@ public class ConfigTargetTest {
93 93
         final ConfigTarget target = new ConfigTarget();
94 94
         target.setIrcd("ircd_name");
95 95
 
96
-        assertEquals(target.getType(), ConfigTarget.TYPE.IRCD);
97
-        assertEquals(target.getTypeName(), "ircd");
98
-        assertEquals(target.getData(), "ircd_name");
96
+        assertEquals(ConfigTarget.TYPE.IRCD, target.getType());
97
+        assertEquals("ircd", target.getTypeName());
98
+        assertEquals("ircd_name", target.getData());
99 99
         assertTrue(target.toString().toLowerCase().matches("ircd.*: ircd_name"));
100 100
     }
101 101
 
@@ -104,9 +104,9 @@ public class ConfigTargetTest {
104 104
         final ConfigTarget target = new ConfigTarget();
105 105
         target.setNetwork("net_name");
106 106
 
107
-        assertEquals(target.getType(), ConfigTarget.TYPE.NETWORK);
108
-        assertEquals(target.getTypeName(), "network");
109
-        assertEquals(target.getData(), "net_name");
107
+        assertEquals(ConfigTarget.TYPE.NETWORK, target.getType());
108
+        assertEquals("network", target.getTypeName());
109
+        assertEquals("net_name", target.getData());
110 110
         assertTrue(target.toString().toLowerCase().matches("network.*: net_name"));
111 111
     }
112 112
 
@@ -115,9 +115,9 @@ public class ConfigTargetTest {
115 115
         final ConfigTarget target = new ConfigTarget();
116 116
         target.setServer("server_name");
117 117
 
118
-        assertEquals(target.getType(), ConfigTarget.TYPE.SERVER);
119
-        assertEquals(target.getTypeName(), "server");
120
-        assertEquals(target.getData(), "server_name");
118
+        assertEquals(ConfigTarget.TYPE.SERVER, target.getType());
119
+        assertEquals("server", target.getTypeName());
120
+        assertEquals("server_name", target.getData());
121 121
         assertTrue(target.toString().toLowerCase().matches("server.*: server_name"));
122 122
     }
123 123
 
@@ -126,9 +126,9 @@ public class ConfigTargetTest {
126 126
         final ConfigTarget target = new ConfigTarget();
127 127
         target.setChannel("channel_name");
128 128
 
129
-        assertEquals(target.getType(), ConfigTarget.TYPE.CHANNEL);
130
-        assertEquals(target.getTypeName(), "channel");
131
-        assertEquals(target.getData(), "channel_name");
129
+        assertEquals(ConfigTarget.TYPE.CHANNEL, target.getType());
130
+        assertEquals("channel", target.getTypeName());
131
+        assertEquals("channel_name", target.getData());
132 132
         assertTrue(target.toString().toLowerCase().matches("channel.*: channel_name"));
133 133
     }
134 134
 

+ 20
- 20
test/com/dmdirc/config/prefs/PreferencesSettingTest.java View File

@@ -52,7 +52,7 @@ public class PreferencesSettingTest {
52 52
 
53 53
     @Test
54 54
     public void testNormalConstructor() {
55
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
55
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
56 56
         when(cm.getOption("domain", "option")).thenReturn("fallback");
57 57
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT, "domain",
58 58
                 "option", "title", "helptext", cm, null);
@@ -67,7 +67,7 @@ public class PreferencesSettingTest {
67 67
 
68 68
     @Test
69 69
     public void testValidatorConstructor() {
70
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
70
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
71 71
         when(cm.getOption("domain", "option")).thenReturn("fallback");
72 72
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT,
73 73
                 new NotEmptyValidator(), "domain",
@@ -83,7 +83,7 @@ public class PreferencesSettingTest {
83 83
 
84 84
     @Test
85 85
     public void testRestartNeeded() {
86
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
86
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
87 87
         when(cm.getOption("domain", "option")).thenReturn("fallback");
88 88
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT, "domain",
89 89
                 "option", "title", "helptext", cm, null);
@@ -95,7 +95,7 @@ public class PreferencesSettingTest {
95 95
 
96 96
     @Test
97 97
     public void testMultichoiceAdding() {
98
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
98
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
99 99
         when(cm.getOption("domain", "option")).thenReturn("new");
100 100
         final Map<String, String> map = new HashMap<>();
101 101
         map.put("a", "b");
@@ -110,7 +110,7 @@ public class PreferencesSettingTest {
110 110
 
111 111
     @Test
112 112
     public void testSetValue() {
113
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
113
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
114 114
         when(cm.getOption("domain", "option")).thenReturn("fallback");
115 115
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT, "domain",
116 116
                 "option", "title", "helptext", cm, null);
@@ -120,7 +120,7 @@ public class PreferencesSettingTest {
120 120
 
121 121
     @Test
122 122
     public void testDismiss() {
123
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
123
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
124 124
         when(cm.getOption("domain", "option")).thenReturn("fallback");
125 125
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT, "domain",
126 126
                 "option", "title", "helptext", cm, null);
@@ -137,7 +137,7 @@ public class PreferencesSettingTest {
137 137
 
138 138
     @Test
139 139
     public void testListener() {
140
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
140
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
141 141
         when(cm.getOption("domain", "option")).thenReturn("fallback");
142 142
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT, "domain",
143 143
                 "option", "title", "helptext", cm, null);
@@ -152,7 +152,7 @@ public class PreferencesSettingTest {
152 152
 
153 153
     @Test
154 154
     public void testNeedsSaving() {
155
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
155
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
156 156
         when(cm.getOption("domain", "option")).thenReturn("fallback");
157 157
         when(cm.getOption("domain", "option2")).thenReturn("fallback");
158 158
         final PreferencesSetting ps = new PreferencesSetting(PreferencesType.TEXT,
@@ -173,8 +173,8 @@ public class PreferencesSettingTest {
173 173
 
174 174
     @Test
175 175
     public void testSaveUnset() {
176
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
177
-        ConfigProvider configProvider = mock(ConfigProvider.class);
176
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
177
+        final ConfigProvider configProvider = mock(ConfigProvider.class);
178 178
 
179 179
         when(cm.getOption("unit-test", "ps")).thenReturn("abc");
180 180
         when(configProvider.getOption("unit-test", "ps")).thenReturn("abc");
@@ -191,8 +191,8 @@ public class PreferencesSettingTest {
191 191
 
192 192
     @Test
193 193
     public void testSaveNormal() {
194
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
195
-        ConfigProvider configProvider = mock(ConfigProvider.class);
194
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
195
+        final ConfigProvider configProvider = mock(ConfigProvider.class);
196 196
 
197 197
         when(cm.getOption("unit-test", "ps")).thenReturn("abc");
198 198
         when(configProvider.getOption("unit-test", "ps")).thenReturn("abc");
@@ -209,8 +209,8 @@ public class PreferencesSettingTest {
209 209
 
210 210
     @Test
211 211
     public void testIsSet() {
212
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
213
-        ConfigProvider configProvider = mock(ConfigProvider.class);
212
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
213
+        final ConfigProvider configProvider = mock(ConfigProvider.class);
214 214
 
215 215
         when(cm.getOption("unit-test", "ps")).thenReturn("abc");
216 216
         when(configProvider.getOption("unit-test", "ps")).thenReturn("abc");
@@ -223,8 +223,8 @@ public class PreferencesSettingTest {
223 223
 
224 224
     @Test
225 225
     public void testIsNotSet() {
226
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
227
-        ConfigProvider identity = mock(ConfigProvider.class);
226
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
227
+        final ConfigProvider identity = mock(ConfigProvider.class);
228 228
 
229 229
         when(cm.getOption("unit-test", "ps")).thenReturn(null);
230 230
         when(identity.getOption("unit-test", "ps")).thenReturn(null);
@@ -237,8 +237,8 @@ public class PreferencesSettingTest {
237 237
 
238 238
     @Test
239 239
     public void testUnknownComboOption() {
240
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
241
-        ConfigProvider configProvider = mock(ConfigProvider.class);
240
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
241
+        final ConfigProvider configProvider = mock(ConfigProvider.class);
242 242
 
243 243
         when(cm.getOption("unit-test", "ps")).thenReturn("abc");
244 244
         when(configProvider.getOption("unit-test", "ps")).thenReturn("abc");
@@ -253,8 +253,8 @@ public class PreferencesSettingTest {
253 253
 
254 254
     @Test
255 255
     public void testKnownComboOption() {
256
-        AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
257
-        ConfigProvider configProvider = mock(ConfigProvider.class);
256
+        final AggregateConfigProvider cm = mock(AggregateConfigProvider.class);
257
+        final ConfigProvider configProvider = mock(ConfigProvider.class);
258 258
 
259 259
         when(cm.getOption("unit-test", "ps")).thenReturn("abc");
260 260
         when(configProvider.getOption("unit-test", "ps")).thenReturn("abc");

+ 8
- 8
test/com/dmdirc/harness/TestCommandParser.java View File

@@ -59,32 +59,32 @@ public class TestCommandParser extends CommandParser {
59 59
     }
60 60
 
61 61
     @Override
62
-    protected void executeCommand(@Nonnull FrameContainer origin, CommandInfo commandInfo, Command command,
63
-            CommandArguments args, CommandContext context) {
62
+    protected void executeCommand(@Nonnull final FrameContainer origin, final CommandInfo commandInfo, final Command command,
63
+            final CommandArguments args, final CommandContext context) {
64 64
         executedCommand = command;
65 65
         wasSilent = args.isSilent();
66 66
         commandArgs = args;
67 67
     }
68 68
 
69 69
     @Override
70
-    protected CommandContext getCommandContext(FrameContainer origin, CommandInfo commandInfo,
71
-            Command command, CommandArguments args) {
70
+    protected CommandContext getCommandContext(final FrameContainer origin, final CommandInfo commandInfo,
71
+            final Command command, final CommandArguments args) {
72 72
         return new CommandContext(origin, commandInfo);
73 73
     }
74 74
 
75 75
     @Override
76
-    protected void handleNonCommand(FrameContainer origin, String line) {
76
+    protected void handleNonCommand(final FrameContainer origin, final String line) {
77 77
         nonCommandLine = line;
78 78
     }
79 79
 
80 80
     @Override
81
-    protected void handleInvalidCommand(FrameContainer origin,
82
-            CommandArguments args) {
81
+    protected void handleInvalidCommand(final FrameContainer origin,
82
+            final CommandArguments args) {
83 83
         invalidCommand = args.getCommandName();
84 84
     }
85 85
 
86 86
     @Override
87
-    public void setOwner(FrameContainer owner) {
87
+    public void setOwner(final FrameContainer owner) {
88 88
         // Don't care
89 89
     }
90 90
 

+ 3
- 3
test/com/dmdirc/harness/TestConfigSource.java View File

@@ -30,17 +30,17 @@ import java.util.Map;
30 30
 public class TestConfigSource extends BaseConfigProvider {
31 31
 
32 32
     @Override
33
-    public boolean hasOption(String domain, String option, Validator<String> validator) {
33
+    public boolean hasOption(final String domain, final String option, final Validator<String> validator) {
34 34
         return Boolean.parseBoolean(domain);
35 35
     }
36 36
 
37 37
     @Override
38
-    public String getOption(String domain, String option, Validator<String> validator) {
38
+    public String getOption(final String domain, final String option, final Validator<String> validator) {
39 39
         return option;
40 40
     }
41 41
 
42 42
     @Override
43
-    public Map<String, String> getOptions(String domain) {
43
+    public Map<String, String> getOptions(final String domain) {
44 44
         throw new UnsupportedOperationException("Not supported yet.");
45 45
     }
46 46
 }

+ 2
- 2
test/com/dmdirc/logger/DMDircExceptionHandlerTest.java View File

@@ -44,14 +44,14 @@ public class DMDircExceptionHandlerTest {
44 44
 
45 45
     @Test
46 46
     public void testUncaughtException() {
47
-        final Exception exception = new Exception();
47
+        final Exception exception = new UnsupportedOperationException();
48 48
         eh.uncaughtException(null, exception);
49 49
         verify(errorManager).addError(eq(ErrorLevel.HIGH), anyString(), same(exception), eq(true));
50 50
     }
51 51
 
52 52
     @Test
53 53
     public void testUncaughtError() {
54
-        final Error error = new Error();
54
+        final Error error = new OutOfMemoryError();
55 55
         eh.uncaughtException(null, error);
56 56
         verify(errorManager).addError(eq(ErrorLevel.FATAL), anyString(), same(error), eq(true));
57 57
     }

+ 9
- 9
test/com/dmdirc/logger/ProgramErrorTest.java View File

@@ -71,20 +71,20 @@ public class ProgramErrorTest {
71 71
 
72 72
     @Test
73 73
     public void testConstructorGood() {
74
-        new ProgramError(1, ErrorLevel.HIGH, "moo", new Exception(), null, new Date());
74
+        new ProgramError(1, ErrorLevel.HIGH, "moo", new UnsupportedOperationException(), null, new Date());
75 75
     }
76 76
 
77 77
     @Test
78 78
     public void testGetLevel() {
79 79
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
80
-                new Exception(), null, new Date());
80
+                new UnsupportedOperationException(), null, new Date());
81 81
         assertEquals(ErrorLevel.HIGH, pe.getLevel());
82 82
     }
83 83
 
84 84
     @Test
85 85
     public void testGetMessage() {
86 86
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
87
-                new Exception(), null, new Date());
87
+                new UnsupportedOperationException(), null, new Date());
88 88
         assertEquals("moo", pe.getMessage());
89 89
     }
90 90
 
@@ -92,14 +92,14 @@ public class ProgramErrorTest {
92 92
     public void testGetDate() {
93 93
         final Date date = new Date();
94 94
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
95
-                new Exception(), null, date);
95
+                new UnsupportedOperationException(), null, date);
96 96
         assertEquals(date, pe.getDate());
97 97
     }
98 98
 
99 99
     @Test
100 100
     public void testReportStatus() {
101 101
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
102
-                new Exception(), null, new Date());
102
+                new UnsupportedOperationException(), null, new Date());
103 103
         assertEquals(ErrorReportStatus.WAITING, pe.getReportStatus());
104 104
         pe.setReportStatus(null);
105 105
         assertEquals(ErrorReportStatus.WAITING, pe.getReportStatus());
@@ -112,13 +112,13 @@ public class ProgramErrorTest {
112 112
     @Test
113 113
     public void testToString() {
114 114
         final ProgramError pe = new ProgramError(1, ErrorLevel.HIGH, "moo",
115
-                new Exception(), null, new Date());
116
-        assertTrue(pe.toString().indexOf("moo") > -1);
115
+                new UnsupportedOperationException(), null, new Date());
116
+        assertTrue(pe.toString().contains("moo"));
117 117
     }
118 118
 
119 119
     @Test
120 120
     public void testEquals() {
121
-        final Exception ex = new Exception();
121
+        final Exception ex = new UnsupportedOperationException();
122 122
         final ProgramError pe1 = new ProgramError(10, ErrorLevel.LOW, "moo",
123 123
                 ex, null, new Date());
124 124
         final ProgramError pe2 = new ProgramError(11, ErrorLevel.LOW, "moo",
@@ -130,7 +130,7 @@ public class ProgramErrorTest {
130 130
         final ProgramError pe5 = new ProgramError(10, ErrorLevel.LOW, "moo",
131 131
                 null, "Hello", new Date());
132 132
 
133
-        assertFalse(pe1.equals(null));
133
+        assertFalse(pe1.equals(null)); // NOPMD
134 134
         assertFalse(pe1.equals("moo"));
135 135
 
136 136
         assertTrue(pe1.equals(pe2));

+ 7
- 7
test/com/dmdirc/ui/StatusMessageTest.java View File

@@ -34,28 +34,28 @@ public class StatusMessageTest {
34 34
     @Test
35 35
     public void testGetMessageShortConstructor() {
36 36
         final AggregateConfigProvider config = mock(AggregateConfigProvider.class);
37
-        StatusMessage instance = new StatusMessage("test", config);
37
+        final StatusMessage instance = new StatusMessage("test", config);
38 38
         assertEquals("test", instance.getMessage());
39 39
     }
40 40
 
41 41
     @Test
42 42
     public void testGetMessageLongConstructor() {
43 43
         final AggregateConfigProvider config = mock(AggregateConfigProvider.class);
44
-        StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
44
+        final StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
45 45
         assertEquals("test", instance.getMessage());
46 46
     }
47 47
 
48 48
     @Test
49 49
     public void testGetIconType() {
50 50
         final AggregateConfigProvider config = mock(AggregateConfigProvider.class);
51
-        StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
51
+        final StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
52 52
         assertEquals("icon", instance.getIconType());
53 53
     }
54 54
 
55 55
     @Test
56 56
     public void testGetMessageNotifierNull() {
57 57
         final AggregateConfigProvider config = mock(AggregateConfigProvider.class);
58
-        StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
58
+        final StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
59 59
         assertNull(instance.getMessageNotifier());
60 60
     }
61 61
 
@@ -63,14 +63,14 @@ public class StatusMessageTest {
63 63
     public void testGetMessageNotifierNotNull() {
64 64
         final AggregateConfigProvider config = mock(AggregateConfigProvider.class);
65 65
         final StatusMessageNotifier smn = mock(StatusMessageNotifier.class);
66
-        StatusMessage instance = new StatusMessage("icon", "test", smn, 10, config);
66
+        final StatusMessage instance = new StatusMessage("icon", "test", smn, 10, config);
67 67
         assertEquals(smn, instance.getMessageNotifier());
68 68
     }
69 69
 
70 70
     @Test
71 71
     public void testGetTimeout() {
72 72
         final AggregateConfigProvider config = mock(AggregateConfigProvider.class);
73
-        StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
73
+        final StatusMessage instance = new StatusMessage("icon", "test", null, 10, config);
74 74
         assertEquals(10, instance.getTimeout());
75 75
     }
76 76
 
@@ -80,7 +80,7 @@ public class StatusMessageTest {
80 80
 
81 81
         when(config.getOptionInt("statusBar", "messageDisplayLength")).thenReturn(10);
82 82
 
83
-        StatusMessage instance = new StatusMessage("icon", "test", null, -1, config);
83
+        final StatusMessage instance = new StatusMessage("icon", "test", null, -1, config);
84 84
         assertEquals(10, instance.getTimeout());
85 85
     }
86 86
 }

+ 7
- 13
test/com/dmdirc/ui/WindowManagerTest.java View File

@@ -135,10 +135,8 @@ public class WindowManagerTest {
135 135
 
136 136
     @Test
137 137
     public void testAddListenerAndSync() {
138
-        when(container.getChildren()).thenReturn(Arrays.asList(
139
-                new FrameContainer[]{child, }));
140
-        when(child.getChildren()).thenReturn(Arrays.asList(
141
-                new FrameContainer[]{grandchild, }));
138
+        when(container.getChildren()).thenReturn(Arrays.asList(child));
139
+        when(child.getChildren()).thenReturn(Arrays.asList(grandchild));
142 140
 
143 141
         manager.addWindow(container);
144 142
         manager.addListenerAndSync(frameListener);
@@ -159,8 +157,7 @@ public class WindowManagerTest {
159 157
 
160 158
     @Test
161 159
     public void testRemoveWindowRootWindowWithChildren() {
162
-        when(container.getChildren()).thenReturn(Arrays.asList(
163
-                new FrameContainer[]{child, }));
160
+        when(container.getChildren()).thenReturn(Arrays.asList(child));
164 161
         when(child.getParent()).thenReturn(Optional.of(container));
165 162
 
166 163
         manager.addListener(frameListener);
@@ -173,8 +170,7 @@ public class WindowManagerTest {
173 170
 
174 171
     @Test
175 172
     public void testRemoveChildWindowNoChildren() {
176
-        when(container.getChildren()).thenReturn(Arrays.asList(
177
-                new FrameContainer[]{child, }));
173
+        when(container.getChildren()).thenReturn(Arrays.asList(child));
178 174
         when(child.getParent()).thenReturn(Optional.of(container));
179 175
 
180 176
         manager.addListener(frameListener);
@@ -187,10 +183,8 @@ public class WindowManagerTest {
187 183
 
188 184
     @Test
189 185
     public void testRemoveChildWindowWithChildren() {
190
-        when(container.getChildren()).thenReturn(Arrays.asList(
191
-                new FrameContainer[]{child, }));
192
-        when(child.getChildren()).thenReturn(Arrays.asList(
193
-                new FrameContainer[]{grandchild, }));
186
+        when(container.getChildren()).thenReturn(Arrays.asList(child));
187
+        when(child.getChildren()).thenReturn(Arrays.asList(grandchild));
194 188
         when(child.getParent()).thenReturn(Optional.of(container));
195 189
 
196 190
         manager.addListener(frameListener);
@@ -207,7 +201,7 @@ public class WindowManagerTest {
207 201
         final FrameContainer root1 = mock(FrameContainer.class);
208 202
         final FrameContainer root2 = mock(FrameContainer.class);
209 203
         final Collection<FrameContainer> rootWindows
210
-                = Arrays.asList(new FrameContainer[]{root1, root2, });
204
+                = Arrays.asList(root1, root2);
211 205
 
212 206
         manager.addWindow(root1);
213 207
         manager.addWindow(root2);

+ 15
- 15
test/com/dmdirc/ui/core/aliases/CoreAliasDialogModelTest.java View File

@@ -94,7 +94,7 @@ public class CoreAliasDialogModelTest {
94 94
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
95 95
                 commandController);
96 96
         model.loadModel();
97
-        assertEquals(model.getAliases().size(), 2);
97
+        assertEquals(2, model.getAliases().size());
98 98
     }
99 99
 
100 100
     @Test
@@ -125,9 +125,9 @@ public class CoreAliasDialogModelTest {
125 125
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
126 126
                 commandController);
127 127
         model.loadModel();
128
-        assertEquals(model.getAliases().size(), 0);
128
+        assertEquals(0, model.getAliases().size());
129 129
         model.addAlias(alias1.getName(), alias1.getMinArguments(), alias1.getSubstitution());
130
-        assertEquals(model.getAliases().size(), 1);
130
+        assertEquals(1, model.getAliases().size());
131 131
     }
132 132
 
133 133
     @Test
@@ -148,11 +148,11 @@ public class CoreAliasDialogModelTest {
148 148
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
149 149
                 commandController);
150 150
         model.loadModel();
151
-        assertEquals(model.getAliases().size(), 1);
152
-        assertEquals(model.getAlias(alias2Edited.getName()).get().getMinArguments(), 0);
151
+        assertEquals(1, model.getAliases().size());
152
+        assertEquals(0, model.getAlias(alias2Edited.getName()).get().getMinArguments());
153 153
         model.editAlias(alias1.getName(), alias2Edited.getMinArguments(), alias2Edited.
154 154
                 getSubstitution());
155
-        assertEquals(model.getAlias(alias1.getName()).get().getMinArguments(), 1);
155
+        assertEquals(1, model.getAlias(alias1.getName()).get().getMinArguments());
156 156
     }
157 157
 
158 158
     @Test
@@ -175,7 +175,7 @@ public class CoreAliasDialogModelTest {
175 175
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
176 176
                 commandController);
177 177
         model.loadModel();
178
-        assertEquals(model.getAliases().size(), 1);
178
+        assertEquals(1, model.getAliases().size());
179 179
         assertEquals(model.getAlias(alias1.getName()).get(), alias1);
180 180
         model.renameAlias(alias1.getName(), alias1Edited.getName());
181 181
         assertEquals(model.getAlias(alias1Edited.getName()).get(), alias2);
@@ -189,7 +189,7 @@ public class CoreAliasDialogModelTest {
189 189
                 commandController);
190 190
         model.loadModel();
191 191
         model.addListener(listener);
192
-        assertEquals(model.getAliases().size(), 1);
192
+        assertEquals(1, model.getAliases().size());
193 193
         assertEquals(model.getAlias(alias1.getName()).get(), alias1);
194 194
         model.renameAlias(alias1.getName(), alias1Edited.getName());
195 195
         verify(listener).aliasRenamed(alias1, alias1Edited);
@@ -203,9 +203,9 @@ public class CoreAliasDialogModelTest {
203 203
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
204 204
                 commandController);
205 205
         model.loadModel();
206
-        assertEquals(model.getAliases().size(), 2);
206
+        assertEquals(2, model.getAliases().size());
207 207
         model.removeAlias(alias1.getName());
208
-        assertEquals(model.getAliases().size(), 1);
208
+        assertEquals(1, model.getAliases().size());
209 209
         assertFalse(model.getAlias(alias1.getName()).isPresent());
210 210
     }
211 211
 
@@ -230,7 +230,7 @@ public class CoreAliasDialogModelTest {
230 230
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
231 231
                 commandController);
232 232
         model.loadModel();
233
-        assertEquals(model.getAliases().size(), 2);
233
+        assertEquals(2, model.getAliases().size());
234 234
         assertTrue(model.getSelectedAlias().isPresent());
235 235
     }
236 236
 
@@ -242,7 +242,7 @@ public class CoreAliasDialogModelTest {
242 242
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
243 243
                 commandController);
244 244
         model.loadModel();
245
-        assertEquals(model.getAliases().size(), 2);
245
+        assertEquals(2, model.getAliases().size());
246 246
         assertTrue(model.getSelectedAlias().isPresent());
247 247
         model.setSelectedAlias(Optional.fromNullable(alias2));
248 248
         assertEquals(model.getSelectedAlias().get(), alias2);
@@ -256,7 +256,7 @@ public class CoreAliasDialogModelTest {
256 256
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
257 257
                 commandController);
258 258
         model.loadModel();
259
-        assertEquals(model.getAliases().size(), 2);
259
+        assertEquals(2, model.getAliases().size());
260 260
         assertTrue(model.getSelectedAlias().isPresent());
261 261
         model.setSelectedAlias(Optional.fromNullable(alias2));
262 262
         assertEquals(model.getSelectedAlias().get(), alias2);
@@ -285,7 +285,7 @@ public class CoreAliasDialogModelTest {
285 285
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
286 286
                 commandController);
287 287
         model.loadModel();
288
-        assertEquals(model.getAliases().size(), 1);
288
+        assertEquals(1, model.getAliases().size());
289 289
         assertEquals(model.getAlias(alias1.getName()).get(), alias1);
290 290
         model.setSelectedAlias(Optional.fromNullable(alias1));
291 291
         model.setSelectedAliasName(alias1Edited.getName());
@@ -302,7 +302,7 @@ public class CoreAliasDialogModelTest {
302 302
         final CoreAliasDialogModel model = new CoreAliasDialogModel(aliasModel, aliasFactory,
303 303
                 commandController);
304 304
         model.loadModel();
305
-        assertEquals(model.getAliases().size(), 1);
305
+        assertEquals(1, model.getAliases().size());
306 306
         assertEquals(model.getAlias(alias1.getName()).get(), alias1);
307 307
         model.setSelectedAlias(Optional.fromNullable(alias1));
308 308
         model.setSelectedAliasMinimumArguments(alias2Edited.getMinArguments());

+ 6
- 6
test/com/dmdirc/ui/core/components/StatusBarManagerTest.java View File

@@ -44,7 +44,7 @@ public class StatusBarManagerTest {
44 44
     @Test
45 45
     public void testRegisterStatusBar() {
46 46
         final StatusBar sb = mock(StatusBar.class);
47
-        StatusBarManager instance = new StatusBarManager(eventBus);
47
+        final StatusBarManager instance = new StatusBarManager(eventBus);
48 48
         instance.registerStatusBar(sb);
49 49
         instance.clearMessage();
50 50
         verify(sb).clearMessage();
@@ -53,7 +53,7 @@ public class StatusBarManagerTest {
53 53
     @Test
54 54
     public void testUnregisterStatusBar() {
55 55
         final StatusBar sb = mock(StatusBar.class);
56
-        StatusBarManager instance = new StatusBarManager(eventBus);
56
+        final StatusBarManager instance = new StatusBarManager(eventBus);
57 57
         instance.registerStatusBar(sb);
58 58
         instance.unregisterStatusBar(sb);
59 59
         instance.clearMessage();
@@ -64,7 +64,7 @@ public class StatusBarManagerTest {
64 64
     public void testSetMessage() {
65 65
         final StatusMessage message = mock(StatusMessage.class);
66 66
         final StatusBar sb = mock(StatusBar.class);
67
-        StatusBarManager instance = new StatusBarManager(eventBus);
67
+        final StatusBarManager instance = new StatusBarManager(eventBus);
68 68
         instance.registerStatusBar(sb);
69 69
         instance.setMessage(message);
70 70
         verify(sb).setMessage(message);
@@ -73,7 +73,7 @@ public class StatusBarManagerTest {
73 73
     @Test
74 74
     public void testClearMessage() {
75 75
         final StatusBar sb = mock(StatusBar.class);
76
-        StatusBarManager instance = new StatusBarManager(eventBus);
76
+        final StatusBarManager instance = new StatusBarManager(eventBus);
77 77
         instance.registerStatusBar(sb);
78 78
         instance.clearMessage();
79 79
         verify(sb).clearMessage();
@@ -83,7 +83,7 @@ public class StatusBarManagerTest {
83 83
     public void testAddComponent() {
84 84
         final StatusBarComponent comp = mock(StatusBarComponent.class);
85 85
         final StatusBar sb = mock(StatusBar.class);
86
-        StatusBarManager instance = new StatusBarManager(eventBus);
86
+        final StatusBarManager instance = new StatusBarManager(eventBus);
87 87
         instance.registerStatusBar(sb);
88 88
         instance.addComponent(comp);
89 89
         verify(sb).addComponent(comp);
@@ -93,7 +93,7 @@ public class StatusBarManagerTest {
93 93
     public void testRemoveComponent() {
94 94
         final StatusBarComponent comp = mock(StatusBarComponent.class);
95 95
         final StatusBar sb = mock(StatusBar.class);
96
-        StatusBarManager instance = new StatusBarManager(eventBus);
96
+        final StatusBarManager instance = new StatusBarManager(eventBus);
97 97
         instance.registerStatusBar(sb);
98 98
         instance.removeComponent(comp);
99 99
         verify(sb).removeComponent(comp);

+ 9
- 9
test/com/dmdirc/ui/core/feedback/CoreFeedbackDialogModelTest.java View File

@@ -43,9 +43,9 @@ public class CoreFeedbackDialogModelTest {
43 43
     @Mock private ConnectionManager connectionManager;
44 44
     @Mock private FeedbackSenderFactory feedbackSenderFactory;
45 45
     @Mock private FeedbackDialogModelListener listener;
46
-    private final String name = "Bob Dole";
47
-    private final String email = "bob@dole.com";
48
-    private final String feedback = "DMDirc Rocks.";
46
+    private static final String NAME = "Bob Dole";
47
+    private static final String EMAIL = "bob@dole.com";
48
+    private static final String FEEDBACK = "DMDirc Rocks.";
49 49
 
50 50
     @Test
51 51
     public void testName() {
@@ -53,8 +53,8 @@ public class CoreFeedbackDialogModelTest {
53 53
                 connectionManager,
54 54
                 feedbackSenderFactory, "configDirectory");
55 55
         assertEquals("testName", Optional.absent(), instance.getName());
56
-        instance.setName(Optional.fromNullable(name));
57
-        assertEquals("testName", Optional.fromNullable(name), instance.getName());
56
+        instance.setName(Optional.fromNullable(NAME));
57
+        assertEquals("testName", Optional.fromNullable(NAME), instance.getName());
58 58
     }
59 59
 
60 60
     @Test
@@ -63,8 +63,8 @@ public class CoreFeedbackDialogModelTest {
63 63
                 connectionManager,
64 64
                 feedbackSenderFactory, "configDirectory");
65 65
         assertEquals("testEmail", Optional.absent(), instance.getEmail());
66
-        instance.setEmail(Optional.fromNullable(email));
67
-        assertEquals("testEmail", Optional.fromNullable(email), instance.getEmail());
66
+        instance.setEmail(Optional.fromNullable(EMAIL));
67
+        assertEquals("testEmail", Optional.fromNullable(EMAIL), instance.getEmail());
68 68
     }
69 69
 
70 70
     @Test
@@ -73,8 +73,8 @@ public class CoreFeedbackDialogModelTest {
73 73
                 connectionManager,
74 74
                 feedbackSenderFactory, "configDirectory");
75 75
         assertEquals("testFeedback", Optional.absent(), instance.getFeedback());
76
-        instance.setFeedback(Optional.fromNullable(feedback));
77
-        assertEquals("testFeedback", Optional.fromNullable(feedback), instance.getFeedback());
76
+        instance.setFeedback(Optional.fromNullable(FEEDBACK));
77
+        assertEquals("testFeedback", Optional.fromNullable(FEEDBACK), instance.getFeedback());
78 78
     }
79 79
 
80 80
     @Test

+ 35
- 35
test/com/dmdirc/ui/core/newserver/CoreNewServerDialogModelTest.java View File

@@ -71,7 +71,7 @@ public class CoreNewServerDialogModelTest {
71 71
 
72 72
     @Test
73 73
     public void testGetProfiles() {
74
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
74
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
75 75
                 controller, connectionManager);
76 76
         instance.loadModel();
77 77
         assertEquals("loadModel: ", Lists.newArrayList(profile1, profile2), instance.
@@ -80,7 +80,7 @@ public class CoreNewServerDialogModelTest {
80 80
 
81 81
     @Test
82 82
     public void testSelectedProfile() {
83
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
83
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
84 84
                 controller, connectionManager);
85 85
         instance.loadModel();
86 86
         assertEquals("testSelectedProfile: ", Optional.absent(), instance.getSelectedProfile());
@@ -93,7 +93,7 @@ public class CoreNewServerDialogModelTest {
93 93
     public void testProfileValidatorEmpty() {
94 94
         when(controller.getProvidersByType("profile")).thenReturn(
95 95
                 Lists.<ConfigProvider>newArrayList());
96
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
96
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
97 97
                 controller, connectionManager);
98 98
         instance.loadModel();
99 99
         assertFalse("testProfileValidatorEmpty: ", instance.isProfileListValid());
@@ -103,7 +103,7 @@ public class CoreNewServerDialogModelTest {
103 103
     public void testProfileValidatorNotEmpty() {
104 104
         when(controller.getProvidersByType("profile")).thenReturn(
105 105
                 Lists.newArrayList(profile1, profile2));
106
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
106
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
107 107
                 controller, connectionManager);
108 108
         instance.loadModel();
109 109
         assertTrue("testProfileValidatorNotEmpty: ", instance.isProfileListValid());
@@ -111,7 +111,7 @@ public class CoreNewServerDialogModelTest {
111 111
 
112 112
     @Test
113 113
     public void testHostname() {
114
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
114
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
115 115
                 controller, connectionManager);
116 116
         instance.loadModel();
117 117
         assertEquals("testHostname: ", Optional.fromNullable("hostname"), instance.getHostname());
@@ -122,7 +122,7 @@ public class CoreNewServerDialogModelTest {
122 122
     @Test
123 123
     public void testHostnameValidatorValid() {
124 124
         when(globalConfig.getOption("newserver", "hostname")).thenReturn("hostname");
125
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
125
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
126 126
                 controller, connectionManager);
127 127
         instance.loadModel();
128 128
         assertTrue("testHostnameValidatorValid: ", instance.isHostnameValid());
@@ -131,7 +131,7 @@ public class CoreNewServerDialogModelTest {
131 131
     @Test
132 132
     public void testHostnameValidatorInvalid() {
133 133
         when(globalConfig.getOption("newserver", "hostname")).thenReturn("~!£$^£$%^&");
134
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
134
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
135 135
                 controller, connectionManager);
136 136
         instance.loadModel();
137 137
         assertFalse("testHostnameValidatorInvalid: ", instance.isHostnameValid());
@@ -139,7 +139,7 @@ public class CoreNewServerDialogModelTest {
139 139
 
140 140
     @Test
141 141
     public void testPort() {
142
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
142
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
143 143
                 controller, connectionManager);
144 144
         instance.loadModel();
145 145
         assertEquals("testPort: ", Optional.fromNullable(1111), instance.getPort());
@@ -150,7 +150,7 @@ public class CoreNewServerDialogModelTest {
150 150
     @Test
151 151
     public void testPortValidatorValid() {
152 152
         when(globalConfig.getOptionInt("newserver", "port")).thenReturn(1111);
153
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
153
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
154 154
                 controller, connectionManager);
155 155
         instance.loadModel();
156 156
         assertTrue("testPortValidatorValid: ", instance.isPortValid());
@@ -159,7 +159,7 @@ public class CoreNewServerDialogModelTest {
159 159
     @Test
160 160
     public void testPortValidatorTooLow() {
161 161
         when(globalConfig.getOptionInt("newserver", "port")).thenReturn(-1);
162
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
162
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
163 163
                 controller, connectionManager);
164 164
         instance.loadModel();
165 165
         assertFalse("testPortValidatorTooLow: ", instance.isPortValid());
@@ -168,7 +168,7 @@ public class CoreNewServerDialogModelTest {
168 168
     @Test
169 169
     public void testPortValidatorTooHigh() {
170 170
         when(globalConfig.getOptionInt("newserver", "port")).thenReturn(65536);
171
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
171
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
172 172
                 controller, connectionManager);
173 173
         instance.loadModel();
174 174
         assertFalse("testPortValidatorTooHigh: ", instance.isPortValid());
@@ -176,7 +176,7 @@ public class CoreNewServerDialogModelTest {
176 176
 
177 177
     @Test
178 178
     public void testPassword() {
179
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
179
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
180 180
                 controller, connectionManager);
181 181
         instance.loadModel();
182 182
         assertEquals("testPassword: ", Optional.fromNullable("password"), instance.getPassword());
@@ -187,7 +187,7 @@ public class CoreNewServerDialogModelTest {
187 187
     @Test
188 188
     public void testPasswordValidatorValid() {
189 189
         when(globalConfig.getOption("newserver", "password")).thenReturn("password");
190
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
190
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
191 191
                 controller, connectionManager);
192 192
         instance.loadModel();
193 193
         assertTrue("testPasswordValidatorValid: ", instance.isPortValid());
@@ -195,7 +195,7 @@ public class CoreNewServerDialogModelTest {
195 195
 
196 196
     @Test
197 197
     public void testSSL() {
198
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
198
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
199 199
                 controller, connectionManager);
200 200
         instance.loadModel();
201 201
         assertTrue("testSSL: ", instance.getSSL());
@@ -205,7 +205,7 @@ public class CoreNewServerDialogModelTest {
205 205
 
206 206
     @Test
207 207
     public void testSaveAsDefault() {
208
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
208
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
209 209
                 controller, connectionManager);
210 210
         instance.loadModel();
211 211
         assertFalse("testSaveAsDefault:", instance.getSaveAsDefault());
@@ -216,7 +216,7 @@ public class CoreNewServerDialogModelTest {
216 216
     @Test
217 217
     public void testIsSaveAllowedValid() {
218 218
         when(globalConfig.getOption("newserver", "hostname")).thenReturn("hostname");
219
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
219
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
220 220
                 controller, connectionManager);
221 221
         instance.loadModel();
222 222
         assertTrue("testIsSaveAllowedValid: ", instance.isSaveAllowed());
@@ -225,7 +225,7 @@ public class CoreNewServerDialogModelTest {
225 225
     @Test
226 226
     public void testIsSaveAllowedInvalidHostname() {
227 227
         when(globalConfig.getOption("newserver", "hostname")).thenReturn("~!£$^£$%^&");
228
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
228
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
229 229
                 controller, connectionManager);
230 230
         instance.loadModel();
231 231
         assertFalse("testIsSaveAllowedInvalidHostname: ", instance.isSaveAllowed());
@@ -234,7 +234,7 @@ public class CoreNewServerDialogModelTest {
234 234
     @Test
235 235
     public void testIsSaveAllowedInvalidPort() {
236 236
         when(globalConfig.getOption("newserver", "hostname")).thenReturn("-1");
237
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
237
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
238 238
                 controller, connectionManager);
239 239
         instance.loadModel();
240 240
         assertFalse("testIsSaveAllowedInvalidPort: ", instance.isSaveAllowed());
@@ -242,7 +242,7 @@ public class CoreNewServerDialogModelTest {
242 242
 
243 243
     @Test
244 244
     public void testSaveSaveDefaults() {
245
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
245
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
246 246
                 controller, connectionManager);
247 247
         instance.loadModel();
248 248
         instance.setSaveAsDefault(true);
@@ -255,7 +255,7 @@ public class CoreNewServerDialogModelTest {
255 255
 
256 256
     @Test
257 257
     public void testSaveNotDefaults() {
258
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
258
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
259 259
                 controller, connectionManager);
260 260
         instance.loadModel();
261 261
         instance.setSaveAsDefault(false);
@@ -268,7 +268,7 @@ public class CoreNewServerDialogModelTest {
268 268
 
269 269
     @Test
270 270
     public void testSaveConnectWithoutProfile() throws URISyntaxException {
271
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
271
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
272 272
                 controller, connectionManager);
273 273
         instance.loadModel();
274 274
         instance.save();
@@ -278,7 +278,7 @@ public class CoreNewServerDialogModelTest {
278 278
 
279 279
     @Test
280 280
     public void testSaveConnectWithProfile() throws URISyntaxException {
281
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
281
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
282 282
                 controller, connectionManager);
283 283
         instance.loadModel();
284 284
         instance.setSelectedProfile(Optional.fromNullable(profile1));
@@ -290,7 +290,7 @@ public class CoreNewServerDialogModelTest {
290 290
     @Test
291 291
     public void testAddConfigProvider() {
292 292
         when(controller.getProvidersByType("profile")).thenReturn(Lists.newArrayList(profile1));
293
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
293
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
294 294
                 controller, connectionManager);
295 295
         instance.loadModel();
296 296
         assertEquals("testAddConfigProvider:", Lists.newArrayList(profile1),
@@ -304,7 +304,7 @@ public class CoreNewServerDialogModelTest {
304 304
     public void testRemoveConfigProvider() {
305 305
         when(controller.getProvidersByType("profile")).thenReturn(
306 306
                 Lists.newArrayList(profile1, profile2));
307
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
307
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
308 308
                 controller, connectionManager);
309 309
         instance.loadModel();
310 310
         assertEquals("testRemoveConfigProvider:", Lists.newArrayList(profile1, profile2),
@@ -318,7 +318,7 @@ public class CoreNewServerDialogModelTest {
318 318
     public void testRemoveConfigProviderSelectedProfile() {
319 319
         when(controller.getProvidersByType("profile")).thenReturn(
320 320
                 Lists.newArrayList(profile1, profile2));
321
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
321
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
322 322
                 controller, connectionManager);
323 323
         instance.loadModel();
324 324
         instance.setSelectedProfile(Optional.fromNullable(profile2));
@@ -336,7 +336,7 @@ public class CoreNewServerDialogModelTest {
336 336
 
337 337
     @Test
338 338
     public void testListenerSelectedProfileChanged() {
339
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
339
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
340 340
                 controller, connectionManager);
341 341
         instance.loadModel();
342 342
         assertEquals("testListenerSelectedProfileChanged: ", Optional.<ConfigProvider>absent(),
@@ -351,7 +351,7 @@ public class CoreNewServerDialogModelTest {
351 351
 
352 352
     @Test
353 353
     public void testListenerProfileListChangedRemoved() {
354
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
354
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
355 355
                 controller, connectionManager);
356 356
         instance.loadModel();
357 357
         instance.addListener(listener);
@@ -367,7 +367,7 @@ public class CoreNewServerDialogModelTest {
367 367
     public void testListenerProfileListChangedAdded() {
368 368
         when(controller.getProvidersByType("profile"))
369 369
                 .thenReturn(Lists.newArrayList(profile1));
370
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
370
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
371 371
                 controller, connectionManager);
372 372
         instance.loadModel();
373 373
         instance.addListener(listener);
@@ -381,7 +381,7 @@ public class CoreNewServerDialogModelTest {
381 381
 
382 382
     @Test
383 383
     public void testListenerServerDetailsChangedPort() {
384
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
384
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
385 385
                 controller, connectionManager);
386 386
         instance.loadModel();
387 387
         instance.addListener(listener);
@@ -392,7 +392,7 @@ public class CoreNewServerDialogModelTest {
392 392
 
393 393
     @Test
394 394
     public void testListenerServerDetailsChangedPassword() {
395
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
395
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
396 396
                 controller, connectionManager);
397 397
         instance.loadModel();
398 398
         instance.addListener(listener);
@@ -403,7 +403,7 @@ public class CoreNewServerDialogModelTest {
403 403
 
404 404
     @Test
405 405
     public void testListenerServerDetailsChangedSSL() {
406
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
406
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
407 407
                 controller, connectionManager);
408 408
         instance.loadModel();
409 409
         instance.addListener(listener);
@@ -414,7 +414,7 @@ public class CoreNewServerDialogModelTest {
414 414
 
415 415
     @Test
416 416
     public void testListenerServerDetailsChangedSaveAsDefault() {
417
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
417
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
418 418
                 controller, connectionManager);
419 419
         instance.loadModel();
420 420
         instance.addListener(listener);
@@ -425,7 +425,7 @@ public class CoreNewServerDialogModelTest {
425 425
 
426 426
     @Test
427 427
     public void testRemoveListener() {
428
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
428
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
429 429
                 controller, connectionManager);
430 430
         instance.loadModel();
431 431
         instance.addListener(listener);
@@ -440,7 +440,7 @@ public class CoreNewServerDialogModelTest {
440 440
 
441 441
     @Test
442 442
     public void testSaveDefaults() throws URISyntaxException {
443
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
443
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
444 444
                 controller, connectionManager);
445 445
         instance.loadModel();
446 446
         instance.setSelectedProfile(Optional.fromNullable(profile1));
@@ -454,7 +454,7 @@ public class CoreNewServerDialogModelTest {
454 454
 
455 455
     @Test
456 456
     public void testNoSaveDefaults() throws URISyntaxException {
457
-        CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
457
+        final CoreNewServerDialogModel instance = new CoreNewServerDialogModel(globalConfig, userConfig,
458 458
                 controller, connectionManager);
459 459
         instance.loadModel();
460 460
         instance.setSelectedProfile(Optional.fromNullable(profile1));

+ 1
- 1
test/com/dmdirc/ui/core/util/URLHandlerTest.java View File

@@ -50,7 +50,7 @@ public class URLHandlerTest {
50 50
             final String result = URLHandler.substituteParams((URI) test[0],
51 51
                     (String) test[1]);
52 52
             assertEquals(test[0].toString() + " + " + test[1].toString() + " ==> " + result,
53
-                    (String) test[2], result);
53
+                    test[2], result);
54 54
         }
55 55
     }
56 56
 }

+ 20
- 20
test/com/dmdirc/ui/messages/ColourManagerTest.java View File

@@ -61,73 +61,73 @@ public class ColourManagerTest {
61 61
 
62 62
     @Test
63 63
     public void testGetColourInt() {
64
-        int spec = 4;
64
+        final int spec = 4;
65 65
 
66
-        Colour expResult = Colour.RED;
67
-        Colour result = manager.getColourFromIrcCode(spec);
66
+        final Colour expResult = Colour.RED;
67
+        final Colour result = manager.getColourFromIrcCode(spec);
68 68
         assertEquals(expResult, result);
69 69
     }
70 70
 
71 71
     @Test
72 72
     public void testGetColourOOB() {
73
-        Colour result = manager.getColourFromIrcCode(20);
73
+        final Colour result = manager.getColourFromIrcCode(20);
74 74
         assertEquals(Colour.WHITE, result);
75 75
     }
76 76
 
77 77
     @Test
78 78
     public void testGetColourHexInvalid() {
79
-        String spec = "FFZZFF";
79
+        final String spec = "FFZZFF";
80 80
 
81
-        Colour result = manager.getColourFromHex(spec);
81
+        final Colour result = manager.getColourFromHex(spec);
82 82
         assertEquals(Colour.WHITE, result);
83 83
     }
84 84
 
85 85
     @Test
86 86
     public void testGetColourHex() {
87
-        String spec = "FFFFFF";
87
+        final String spec = "FFFFFF";
88 88
 
89
-        Colour expResult = Colour.WHITE;
90
-        Colour result = manager.getColourFromHex(spec);
89
+        final Colour expResult = Colour.WHITE;
90
+        final Colour result = manager.getColourFromHex(spec);
91 91
         assertEquals(expResult, result);
92 92
     }
93 93
 
94 94
     @Test
95 95
     public void testParseColourNull() {
96
-        Colour fallback = Colour.RED;
97
-        Colour result = manager.getColourFromString(null, fallback);
96
+        final Colour fallback = Colour.RED;
97
+        final Colour result = manager.getColourFromString(null, fallback);
98 98
 
99 99
         assertEquals(fallback, result);
100 100
     }
101 101
 
102 102
     @Test
103 103
     public void testParseColourInvalidNumber() {
104
-        Colour fallback = Colour.RED;
105
-        Colour result = manager.getColourFromString("zz", fallback);
104
+        final Colour fallback = Colour.RED;
105
+        final Colour result = manager.getColourFromString("zz", fallback);
106 106
 
107 107
         assertEquals(fallback, result);
108 108
     }
109 109
 
110 110
     @Test
111 111
     public void testParseColourOOBNumber() {
112
-        Colour fallback = Colour.RED;
113
-        Colour result = manager.getColourFromString("20", fallback);
112
+        final Colour fallback = Colour.RED;
113
+        final Colour result = manager.getColourFromString("20", fallback);
114 114
 
115 115
         assertEquals(fallback, result);
116 116
     }
117 117
 
118 118
     @Test
119 119
     public void testParseColourShortNumber() {
120
-        Colour fallback = Colour.RED;
121
-        Colour result = manager.getColourFromString("1234", fallback);
120
+        final Colour fallback = Colour.RED;
121
+        final Colour result = manager.getColourFromString("1234", fallback);
122 122
 
123 123
         assertEquals(fallback, result);
124 124
     }
125 125
 
126 126
     @Test
127 127
     public void testColourCache() {
128
-        Colour result1 = manager.getColourFromString("ff0f0f", Colour.WHITE);
129
-        Colour result2 = manager.getColourFromString("ff0f0f", Colour.WHITE);
130
-        Colour result3 = manager.getColourFromHex("ff0f0f");
128
+        final Colour result1 = manager.getColourFromString("ff0f0f", Colour.WHITE);
129
+        final Colour result2 = manager.getColourFromString("ff0f0f", Colour.WHITE);
130
+        final Colour result3 = manager.getColourFromHex("ff0f0f");
131 131
 
132 132
         assertSame(result1, result2);
133 133
         assertSame(result2, result3);

+ 6
- 6
test/com/dmdirc/ui/messages/FormatterTest.java View File

@@ -56,12 +56,12 @@ public class FormatterTest {
56 56
     public void testBasicFormats() {
57 57
         assertEquals("Hello!", Formatter.formatMessage(configProvider, "1%1$s", "Hello!"));
58 58
         assertEquals("Hello!", Formatter.formatMessage(configProvider, "1%1$s", "Hello!", "Moo!", "Bar!"));
59
-        assertTrue(Formatter.formatMessage(configProvider, "0%1$s", "Hello!")
60
-                .toLowerCase().indexOf("no format string") > -1);
61
-        assertTrue(Formatter.formatMessage(configProvider, "1%5$s", "Hello!")
62
-                .toLowerCase().indexOf("invalid format string") > -1);
63
-        assertTrue(Formatter.formatMessage(configProvider, "1%1$Z", "Hello!")
64
-                .toLowerCase().indexOf("invalid format string") > -1);
59
+        assertTrue(Formatter.formatMessage(configProvider, "0%1$s", "Hello!").toLowerCase()
60
+                .contains("no format string"));
61
+        assertTrue(Formatter.formatMessage(configProvider, "1%5$s", "Hello!").toLowerCase()
62
+                .contains("invalid format string"));
63
+        assertTrue(Formatter.formatMessage(configProvider, "1%1$Z", "Hello!").toLowerCase()
64
+                .contains("invalid format string"));
65 65
     }
66 66
 
67 67
     @Test

+ 1
- 1
test/com/dmdirc/ui/messages/IntelligentLinkingTest.java View File

@@ -41,7 +41,7 @@ public class IntelligentLinkingTest {
41 41
     private final String input, expected;
42 42
     private final Styliser styliser;
43 43
 
44
-    public IntelligentLinkingTest(String input, String expected) {
44
+    public IntelligentLinkingTest(final String input, final String expected) {
45 45
         this.input = input;
46 46
         this.expected = expected;
47 47
 

+ 1
- 1
test/com/dmdirc/ui/messages/StyliserIndicesTest.java View File

@@ -37,7 +37,7 @@ public class StyliserIndicesTest {
37 37
     protected String input, output;
38 38
     protected int start, end;
39 39
 
40
-    public StyliserIndicesTest(String input, int start, int end, String output) {
40
+    public StyliserIndicesTest(final String input, final int start, final int end, final String output) {
41 41
         this.input = input;
42 42
         this.start = start;
43 43
         this.end = end;

+ 3
- 3
test/com/dmdirc/ui/messages/StyliserStylesTest.java View File

@@ -49,7 +49,7 @@ public class StyliserStylesTest {
49 49
 
50 50
     protected String input, output;
51 51
 
52
-    public StyliserStylesTest(String input, String output) {
52
+    public StyliserStylesTest(final String input, final String output) {
53 53
         this.input = input;
54 54
         this.output = output;
55 55
     }
@@ -92,7 +92,7 @@ public class StyliserStylesTest {
92 92
             final StringBuilder builder) {
93 93
         builder.append('<');
94 94
 
95
-        String[] entries = new String[9];
95
+        final String[] entries = new String[9];
96 96
 
97 97
         for (Map.Entry<AttributedCharacterIterator.Attribute, Object> entry : map.entrySet()) {
98 98
 
@@ -136,7 +136,7 @@ public class StyliserStylesTest {
136 136
     protected static String toColour(final Object object) {
137 137
         final Color colour = (Color) object;
138 138
 
139
-        return colour.getRed() + "," + colour.getGreen() + ","
139
+        return colour.getRed() + "," + colour.getGreen() + ','
140 140
                 + colour.getBlue();
141 141
     }
142 142
 

+ 15
- 15
test/com/dmdirc/ui/messages/StyliserTest.java View File

@@ -37,43 +37,43 @@ public class StyliserTest {
37 37
 
38 38
     @Test
39 39
     public void testStripControlCodes1() {
40
-        String input = "This"+((char) 2)+" is "+((char) 17)+"a test";
40
+        final String input = "This"+((char) 2)+" is "+((char) 17)+"a test";
41 41
 
42
-        String expResult = "This is a test";
43
-        String result = Styliser.stipControlCodes(input);
42
+        final String expResult = "This is a test";
43
+        final String result = Styliser.stipControlCodes(input);
44 44
         assertEquals(expResult, result);
45 45
     }
46 46
 
47 47
     @Test
48 48
     public void testStripControlCodes2() {
49
-        String input = "This is "+((char) 3)+"5a "+((char) 4)+"FF0000test";
49
+        final String input = "This is "+((char) 3)+"5a "+((char) 4)+"FF0000test";
50 50
 
51
-        String expResult = "This is a test";
52
-        String result = Styliser.stipControlCodes(input);
51
+        final String expResult = "This is a test";
52
+        final String result = Styliser.stipControlCodes(input);
53 53
         assertEquals(expResult, result);
54 54
     }
55 55
 
56 56
     @Test
57 57
     public void testReadUntilControl1() {
58
-        String input = "This"+((char) 2)+" is "+((char) 17)+"a test";
59
-        String expResult = "This";
60
-        String result = Styliser.readUntilControl(input);
58
+        final String input = "This"+((char) 2)+" is "+((char) 17)+"a test";
59
+        final String expResult = "This";
60
+        final String result = Styliser.readUntilControl(input);
61 61
         assertEquals(expResult, result);
62 62
     }
63 63
 
64 64
     @Test
65 65
     public void testReadUntilControl2() {
66
-        String input = "This"+((char) 17)+" is "+((char) 17)+"a test";
67
-        String expResult = "This";
68
-        String result = Styliser.readUntilControl(input);
66
+        final String input = "This"+((char) 17)+" is "+((char) 17)+"a test";
67
+        final String expResult = "This";
68
+        final String result = Styliser.readUntilControl(input);
69 69
         assertEquals(expResult, result);
70 70
     }
71 71
 
72 72
     @Test
73 73
     public void testReadUntilControl3() {
74
-        String input = ((char) 31)+" is "+((char) 17)+"a test";
75
-        String expResult = "";
76
-        String result = Styliser.readUntilControl(input);
74
+        final String input = ((char) 31)+" is "+((char) 17)+"a test";
75
+        final String expResult = "";
76
+        final String result = Styliser.readUntilControl(input);
77 77
         assertEquals(expResult, result);
78 78
     }
79 79
 

+ 3
- 4
test/com/dmdirc/updater/installing/LegacyInstallationStrategyTest.java View File

@@ -31,7 +31,6 @@ import java.io.IOException;
31 31
 import org.junit.Before;
32 32
 import org.junit.Test;
33 33
 
34
-import static org.mockito.Matchers.*;
35 34
 import static org.mockito.Mockito.*;
36 35
 
37 36
 public class LegacyInstallationStrategyTest {
@@ -53,7 +52,7 @@ public class LegacyInstallationStrategyTest {
53 52
     }
54 53
 
55 54
     @Test
56
-    public void testCallsInstallWithCorrectPath() throws Exception {
55
+    public void testCallsInstallWithCorrectPath() throws Exception { // NOPMD
57 56
         final File file = mock(File.class);
58 57
         when(file.getAbsolutePath()).thenReturn("/my/path");
59 58
         when(result.getFile()).thenReturn(file);
@@ -62,7 +61,7 @@ public class LegacyInstallationStrategyTest {
62 61
     }
63 62
 
64 63
     @Test
65
-    public void testRaisesCompletedEvent() throws Exception {
64
+    public void testRaisesCompletedEvent() throws Exception { // NOPMD
66 65
         final File file = mock(File.class);
67 66
         when(result.getFile()).thenReturn(file);
68 67
         strategy.addUpdateInstallationListener(listener);
@@ -71,7 +70,7 @@ public class LegacyInstallationStrategyTest {
71 70
     }
72 71
 
73 72
     @Test
74
-    public void testRaisesFailedEvent() throws Exception {
73
+    public void testRaisesFailedEvent() throws Exception { // NOPMD
75 74
         final File file = mock(File.class);
76 75
         when(result.getFile()).thenReturn(file);
77 76
         when(component.doInstall(anyString())).thenThrow(new IOException());

+ 1
- 1
test/com/dmdirc/util/URIParserTextParameterizedTest.java View File

@@ -36,7 +36,7 @@ public class URIParserTextParameterizedTest {
36 36
 
37 37
     private final String input, expected;
38 38
 
39
-    public URIParserTextParameterizedTest(String input, String expected) {
39
+    public URIParserTextParameterizedTest(final String input, final String expected) {
40 40
         this.input = input;
41 41
         this.expected = expected;
42 42
     }

+ 1
- 1
test/com/dmdirc/util/URIParserURIParameterizedTest.java View File

@@ -36,7 +36,7 @@ public class URIParserURIParameterizedTest {
36 36
 
37 37
     private final String input, expected;
38 38
 
39
-    public URIParserURIParameterizedTest(String input, String expected) {
39
+    public URIParserURIParameterizedTest(final String input, final String expected) {
40 40
         this.input = input;
41 41
         this.expected = expected;
42 42
     }

+ 24
- 24
test/com/dmdirc/util/URLBuilderTest.java View File

@@ -66,158 +66,158 @@ public class URLBuilderTest {
66 66
 
67 67
     @Test
68 68
     public void testGetUrlForFileWithoutFilePrefix() throws MalformedURLException {
69
-        URLBuilder urlBuilder
69
+        final URLBuilder urlBuilder
70 70
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
71 71
         Assert.assertEquals(new URL("file://test"), urlBuilder.getUrlForFile("test"));
72 72
     }
73 73
 
74 74
     @Test
75 75
     public void testGetUrlForFileWithFilePrefix() throws MalformedURLException {
76
-        URLBuilder urlBuilder
76
+        final URLBuilder urlBuilder
77 77
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
78 78
         Assert.assertEquals(new URL("file://test"), urlBuilder.getUrlForFile("file://test"));
79 79
     }
80 80
 
81 81
     @Test
82 82
     public void testGetUrlInvalid() throws MalformedURLException {
83
-        URLBuilder urlBuilder
83
+        final URLBuilder urlBuilder
84 84
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
85 85
         Assert.assertNull(urlBuilder.getUrlForFile("file://[test"));
86 86
     }
87 87
 
88 88
     @Test
89 89
     public void testGetUrlForJarFile() throws MalformedURLException {
90
-        URLBuilder urlBuilder
90
+        final URLBuilder urlBuilder
91 91
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
92 92
         Assert.assertEquals(new URL("jar:file:/jarFile!/test"), urlBuilder.getUrlForJarFile("jarFile", "test"));
93 93
     }
94 94
 
95 95
     @Test
96 96
     public void testGetUrlForJarFileInvalud() throws MalformedURLException {
97
-        URLBuilder urlBuilder
97
+        final URLBuilder urlBuilder
98 98
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
99 99
         Assert.assertNull(urlBuilder.getUrlForJarFile("[jarFile", "test"));
100 100
     }
101 101
 
102 102
     @Test
103 103
     public void testGetUrlForDMDircResourceNonExistant() {
104
-        URLBuilder urlBuilder
104
+        final URLBuilder urlBuilder
105 105
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
106 106
         Assert.assertNull(urlBuilder.getUrlForDMDircResource("test12345678"));
107 107
     }
108 108
 
109 109
     @Test
110 110
     public void testGetUrlForDMDircResource() throws MalformedURLException {
111
-        URLBuilder urlBuilder
111
+        final URLBuilder urlBuilder
112 112
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
113
-        URL url = urlBuilder.getUrlForDMDircResource("com/dmdirc/Main.class");
113
+        final URL url = urlBuilder.getUrlForDMDircResource("com/dmdirc/Main.class");
114 114
         Assert.assertEquals("file", url.getProtocol());
115 115
         Assert.assertTrue(url.getFile().endsWith("com/dmdirc/Main.class"));
116 116
     }
117 117
 
118 118
     @Test
119 119
     public void testGetUrlForThemeResource() throws MalformedURLException {
120
-        URLBuilder urlBuilder
120
+        final URLBuilder urlBuilder
121 121
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
122 122
         Assert.assertEquals(new URL("jar:file:/themes/testTheme.zip!/testFile"), urlBuilder.getUrlForThemeResource("testTheme", "testFile"));
123 123
     }
124 124
 
125 125
     @Test
126 126
     public void testGetUrlForPluginResource() throws MalformedURLException {
127
-        URLBuilder urlBuilder
127
+        final URLBuilder urlBuilder
128 128
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
129 129
         Assert.assertEquals(new URL("jar:file:/testPlugin!/testFile"), urlBuilder.getUrlForPluginResource("testPlugin", "testFile"));
130 130
     }
131 131
 
132 132
     @Test
133 133
     public void testGetUrlDMDirc() {
134
-        URLBuilder urlBuilder
134
+        final URLBuilder urlBuilder
135 135
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
136
-        URL url = urlBuilder.getUrl("dmdirc://com/dmdirc/Main.class");
136
+        final URL url = urlBuilder.getUrl("dmdirc://com/dmdirc/Main.class");
137 137
         Assert.assertEquals("file", url.getProtocol());
138 138
         Assert.assertTrue(url.getFile().endsWith("com/dmdirc/Main.class"));
139 139
     }
140 140
 
141 141
     @Test
142 142
     public void testGetUrlJar() throws MalformedURLException {
143
-        URLBuilder urlBuilder
143
+        final URLBuilder urlBuilder
144 144
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
145 145
         Assert.assertEquals(new URL("jar:file:/jarFile!/testFile"), urlBuilder.getUrl("jar://jarFile:testFile"));
146 146
     }
147 147
 
148 148
     @Test
149 149
     public void testGetUrlJarWithoutFile() throws MalformedURLException {
150
-        URLBuilder urlBuilder
150
+        final URLBuilder urlBuilder
151 151
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
152 152
         Assert.assertNull(urlBuilder.getUrl("jar://jarFile"));
153 153
     }
154 154
 
155 155
     @Test
156 156
     public void testGetUrlZip() throws MalformedURLException {
157
-        URLBuilder urlBuilder
157
+        final URLBuilder urlBuilder
158 158
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
159 159
         Assert.assertEquals(new URL("jar:file:/zipFile!/testFile"), urlBuilder.getUrl("zip://zipFile:testFile"));
160 160
     }
161 161
 
162 162
     @Test
163 163
     public void testGetUrlZipWithoutFile() throws MalformedURLException {
164
-        URLBuilder urlBuilder
164
+        final URLBuilder urlBuilder
165 165
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
166 166
         Assert.assertNull(urlBuilder.getUrl("zip://zipFile"));
167 167
     }
168 168
 
169 169
     @Test
170 170
     public void testGetUrlPlugin() throws MalformedURLException {
171
-        URLBuilder urlBuilder
171
+        final URLBuilder urlBuilder
172 172
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
173 173
         Assert.assertEquals(new URL("jar:file:/testPlugin!/testFile"), urlBuilder.getUrl("plugin://pluginFile:testFile"));
174 174
     }
175 175
 
176 176
     @Test
177 177
     public void testGetUrlPluginWithoutFile() throws MalformedURLException {
178
-        URLBuilder urlBuilder
178
+        final URLBuilder urlBuilder
179 179
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
180 180
         Assert.assertNull(urlBuilder.getUrl("plugin://pluginFile"));
181 181
     }
182 182
 
183 183
     @Test
184 184
     public void testGetUrlTheme() throws MalformedURLException {
185
-        URLBuilder urlBuilder
185
+        final URLBuilder urlBuilder
186 186
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
187 187
         Assert.assertEquals(new URL("jar:file:/themes/themeFile.zip!/testFile"), urlBuilder.getUrl("theme://themeFile:testFile"));
188 188
     }
189 189
 
190 190
     @Test
191 191
     public void testGetUrlThemeWithoutFile() throws MalformedURLException {
192
-        URLBuilder urlBuilder
192
+        final URLBuilder urlBuilder
193 193
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
194 194
         Assert.assertNull(urlBuilder.getUrl("theme://themeFile"));
195 195
     }
196 196
 
197 197
     @Test
198 198
     public void testGetUrlHTTP() throws MalformedURLException {
199
-        URLBuilder urlBuilder
199
+        final URLBuilder urlBuilder
200 200
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
201 201
         Assert.assertEquals(new URL("http://testDomain"), urlBuilder.getUrl("http://testDomain"));
202 202
     }
203 203
 
204 204
     @Test
205 205
     public void testGetUrlHTTPInvalid() throws MalformedURLException {
206
-        URLBuilder urlBuilder
206
+        final URLBuilder urlBuilder
207 207
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
208 208
         Assert.assertNull(urlBuilder.getUrl("http://[testDomain"));
209 209
     }
210 210
 
211 211
     @Test
212 212
     public void testGetUrlFileWithPrefix() throws MalformedURLException {
213
-        URLBuilder urlBuilder
213
+        final URLBuilder urlBuilder
214 214
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
215 215
         Assert.assertEquals(new URL("file://testFile"), urlBuilder.getUrl("file://testFile"));
216 216
     }
217 217
 
218 218
     @Test
219 219
     public void testGetUrlFileWithoutPrefix() throws MalformedURLException {
220
-        URLBuilder urlBuilder
220
+        final URLBuilder urlBuilder
221 221
                 = new URLBuilder(pluginManagerProvider, themeManagerProvider, eventBus);
222 222
         Assert.assertEquals(new URL("file://testFile"), urlBuilder.getUrl("testFile"));
223 223
     }

Loading…
Cancel
Save