Java Doc for StatisticalRuleTest.java in  » Code-Analyzer » pmd-4.2rc1 » test » net » sourceforge » pmd » stat » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Code Analyzer » pmd 4.2rc1 » test.net.sourceforge.pmd.stat 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   test.net.sourceforge.pmd.stat.StatisticalRuleTest

StatisticalRuleTest
public class StatisticalRuleTest (Code)
This class tests the Statistical Rules in PMD.

The idea is, that we fill up 999 datapoints into the Stat Rule, and then throw random parameters at it.

The three parameters which are checked are: sigma - # Sigmas over the mean. topscore - Only the top 5 or so items. minimum - Only things of score 10 or better

When more than one parameter is lumped together, then we expect the one which would return the fewest to determine what gets sent back.

So, we throw each collection of parameters, where each one is a different order into the system. We check the results off of what the smallest value should be.

If you are going to work with StatisticalRule any, please bump the "NUM_TESTS" number up to something like 128. That way you are more likely to identify problems. It is set low now to make building and running tests easier (when we aren't touching the file.)

Note also, that when verifying the Sigma, I wasn't quite able to determine how many results it would return (it would vary from -2 to 2 of what I expected.) That is what the delta parameter on the verify method takes. If you can figure it out exactly, (without stealing code from the StatRule) then feel free to change it and tighten the deltas.



Field Summary
final public static  doubleDELTA
    
final public static  doubleMAX_MINIMUM
    
final public static  doubleMAX_SIGMA
    
final public static  doubleMEAN
    
final public static  intMIN_TOPSCORE
    
final public static  doubleNO_MINIMUM
    
final public static  doubleNO_SIGMA
    
final public static  intNO_TOPSCORE
    
final public static  intNUM_TESTS
    
final public static  doubleSIGMA
    


Method Summary
public  intexpectedMinimum(double minimum)
     This returns the expected number of reports.

If the Minimum comes in at 521.569 then we expect 522, 523, ...

public  intexpectedSigma(double sigma)
     This returns the expected number of results when the Sigma rating is the smallest.
public  intexpectedTopScore(int target)
     This will return the expected number of results with the given Top Score.
public  ReportmakeReport(Rule IUT)
    
public  doublerandomMinimum()
     This generates a random minimum value for testing.
public  doublerandomMinimum(int minimum)
     This generates a random minimum value for which fewer results would be returned.
public  doublerandomSigma()
     This returns a Random value for Sigma which will return some values.
public  doublerandomSigma(int minimum)
     This returns a Random value for Sigma which value is greater than the parameter.
public  intrandomTopScore()
     This returns a random value for Top Score.
public  intrandomTopScore(double target)
     This will return a random value for the Top Score which will return more than the minimum provided.
public  voidsetUp()
    
public static  junit.framework.Testsuite()
    
public  voidtestExpectedMinimum()
    
public  voidtestM()
    
public  voidtestM1()
    
public  voidtestM2()
    
public  voidtestM3()
    
public  voidtestM4()
    
public  voidtestM5()
    
public  voidtestMS()
    
public  voidtestMS1()
    
public  voidtestMS2()
    
public  voidtestMS3()
    
public  voidtestMS4()
    
public  voidtestMS5()
    
public  voidtestMT()
    
public  voidtestMT1()
    
public  voidtestMT2()
    
public  voidtestMT3()
    
public  voidtestMT4()
    
public  voidtestMT5()
    
public  voidtestMetrics()
     This test verifies that the Stat rule creates a Metric, with the proper values.
public  voidtestS()
    
public  voidtestS1()
    
public  voidtestS2()
    
public  voidtestS3()
    
public  voidtestS4()
    
public  voidtestS5()
    
public  voidtestSM()
    
public  voidtestSM1()
    
public  voidtestSM2()
    
public  voidtestSM3()
    
public  voidtestSM4()
    
public  voidtestSM5()
    
public  voidtestSMT()
    
public  voidtestSMT1()
    
public  voidtestSMT2()
    
public  voidtestSMT3()
    
public  voidtestSMT4()
    
public  voidtestSMT5()
    
public  voidtestST()
    
public  voidtestST1()
    
public  voidtestST2()
    
public  voidtestST3()
    
public  voidtestST4()
    
public  voidtestST5()
    
public  voidtestSTM()
    
public  voidtestSTM1()
    
public  voidtestSTM2()
    
public  voidtestSTM3()
    
public  voidtestSTM4()
    
public  voidtestSTM5()
    
public  voidtestSingleDatapoint()
    
public  voidtestT()
    
public  voidtestT1()
    
public  voidtestT2()
    
public  voidtestT3()
    
public  voidtestT4()
    
public  voidtestT5()
    
public  voidtestTM()
    
public  voidtestTM1()
    
public  voidtestTM2()
    
public  voidtestTM3()
    
public  voidtestTM4()
    
public  voidtestTM5()
    
public  voidtestTMS()
    
public  voidtestTMS1()
    
public  voidtestTMS2()
    
public  voidtestTMS3()
    
public  voidtestTMS4()
    
public  voidtestTMS5()
    
public  voidtestTS()
    
public  voidtestTS1()
    
public  voidtestTS2()
    
public  voidtestTS3()
    
public  voidtestTS4()
    
public  voidtestTS5()
    
public  voidtestTSM()
    
public  voidtestTSM1()
    
public  voidtestTSM2()
    
public  voidtestTSM3()
    
public  voidtestTSM4()
    
public  voidtestTSM5()
    
public  voidverifyResults(double sigma, double minimum, int topScore, int expected, int delta)
     Verifies what happens when you pass these parameters into the thing.

Field Detail
DELTA
final public static double DELTA(Code)



MAX_MINIMUM
final public static double MAX_MINIMUM(Code)



MAX_SIGMA
final public static double MAX_SIGMA(Code)



MEAN
final public static double MEAN(Code)



MIN_TOPSCORE
final public static int MIN_TOPSCORE(Code)



NO_MINIMUM
final public static double NO_MINIMUM(Code)



NO_SIGMA
final public static double NO_SIGMA(Code)



NO_TOPSCORE
final public static int NO_TOPSCORE(Code)



NUM_TESTS
final public static int NUM_TESTS(Code)



SIGMA
final public static double SIGMA(Code)





Method Detail
expectedMinimum
public int expectedMinimum(double minimum)(Code)
This returns the expected number of reports.

If the Minimum comes in at 521.569 then we expect 522, 523, ... 999 will pass.




expectedSigma
public int expectedSigma(double sigma)(Code)
This returns the expected number of results when the Sigma rating is the smallest.



expectedTopScore
public int expectedTopScore(int target)(Code)
This will return the expected number of results with the given Top Score.



makeReport
public Report makeReport(Rule IUT)(Code)



randomMinimum
public double randomMinimum()(Code)
This generates a random minimum value for testing.



randomMinimum
public double randomMinimum(int minimum)(Code)
This generates a random minimum value for which fewer results would be returned.



randomSigma
public double randomSigma()(Code)
This returns a Random value for Sigma which will return some values.



randomSigma
public double randomSigma(int minimum)(Code)
This returns a Random value for Sigma which value is greater than the parameter.



randomTopScore
public int randomTopScore()(Code)
This returns a random value for Top Score.



randomTopScore
public int randomTopScore(double target)(Code)
This will return a random value for the Top Score which will return more than the minimum provided.



setUp
public void setUp()(Code)



suite
public static junit.framework.Test suite()(Code)



testExpectedMinimum
public void testExpectedMinimum()(Code)



testM
public void testM() throws Throwable(Code)



testM1
public void testM1() throws Throwable(Code)



testM2
public void testM2() throws Throwable(Code)



testM3
public void testM3() throws Throwable(Code)



testM4
public void testM4() throws Throwable(Code)



testM5
public void testM5() throws Throwable(Code)



testMS
public void testMS() throws Throwable(Code)



testMS1
public void testMS1() throws Throwable(Code)



testMS2
public void testMS2() throws Throwable(Code)



testMS3
public void testMS3() throws Throwable(Code)



testMS4
public void testMS4() throws Throwable(Code)



testMS5
public void testMS5() throws Throwable(Code)



testMT
public void testMT() throws Throwable(Code)



testMT1
public void testMT1() throws Throwable(Code)



testMT2
public void testMT2() throws Throwable(Code)



testMT3
public void testMT3() throws Throwable(Code)



testMT4
public void testMT4() throws Throwable(Code)



testMT5
public void testMT5() throws Throwable(Code)



testMetrics
public void testMetrics() throws Throwable(Code)
This test verifies that the Stat rule creates a Metric, with the proper values.



testS
public void testS() throws Throwable(Code)



testS1
public void testS1() throws Throwable(Code)



testS2
public void testS2() throws Throwable(Code)



testS3
public void testS3() throws Throwable(Code)



testS4
public void testS4() throws Throwable(Code)



testS5
public void testS5() throws Throwable(Code)



testSM
public void testSM() throws Throwable(Code)



testSM1
public void testSM1() throws Throwable(Code)



testSM2
public void testSM2() throws Throwable(Code)



testSM3
public void testSM3() throws Throwable(Code)



testSM4
public void testSM4() throws Throwable(Code)



testSM5
public void testSM5() throws Throwable(Code)



testSMT
public void testSMT() throws Throwable(Code)



testSMT1
public void testSMT1() throws Throwable(Code)



testSMT2
public void testSMT2() throws Throwable(Code)



testSMT3
public void testSMT3() throws Throwable(Code)



testSMT4
public void testSMT4() throws Throwable(Code)



testSMT5
public void testSMT5() throws Throwable(Code)



testST
public void testST() throws Throwable(Code)



testST1
public void testST1() throws Throwable(Code)



testST2
public void testST2() throws Throwable(Code)



testST3
public void testST3() throws Throwable(Code)



testST4
public void testST4() throws Throwable(Code)



testST5
public void testST5() throws Throwable(Code)



testSTM
public void testSTM() throws Throwable(Code)



testSTM1
public void testSTM1() throws Throwable(Code)



testSTM2
public void testSTM2() throws Throwable(Code)



testSTM3
public void testSTM3() throws Throwable(Code)



testSTM4
public void testSTM4() throws Throwable(Code)



testSTM5
public void testSTM5() throws Throwable(Code)



testSingleDatapoint
public void testSingleDatapoint()(Code)



testT
public void testT() throws Throwable(Code)



testT1
public void testT1() throws Throwable(Code)



testT2
public void testT2() throws Throwable(Code)



testT3
public void testT3() throws Throwable(Code)



testT4
public void testT4() throws Throwable(Code)



testT5
public void testT5() throws Throwable(Code)



testTM
public void testTM() throws Throwable(Code)



testTM1
public void testTM1() throws Throwable(Code)



testTM2
public void testTM2() throws Throwable(Code)



testTM3
public void testTM3() throws Throwable(Code)



testTM4
public void testTM4() throws Throwable(Code)



testTM5
public void testTM5() throws Throwable(Code)



testTMS
public void testTMS() throws Throwable(Code)



testTMS1
public void testTMS1() throws Throwable(Code)



testTMS2
public void testTMS2() throws Throwable(Code)



testTMS3
public void testTMS3() throws Throwable(Code)



testTMS4
public void testTMS4() throws Throwable(Code)



testTMS5
public void testTMS5() throws Throwable(Code)



testTS
public void testTS() throws Throwable(Code)



testTS1
public void testTS1() throws Throwable(Code)



testTS2
public void testTS2() throws Throwable(Code)



testTS3
public void testTS3() throws Throwable(Code)



testTS4
public void testTS4() throws Throwable(Code)



testTS5
public void testTS5() throws Throwable(Code)



testTSM
public void testTSM() throws Throwable(Code)



testTSM1
public void testTSM1() throws Throwable(Code)



testTSM2
public void testTSM2() throws Throwable(Code)



testTSM3
public void testTSM3() throws Throwable(Code)



testTSM4
public void testTSM4() throws Throwable(Code)



testTSM5
public void testTSM5() throws Throwable(Code)



verifyResults
public void verifyResults(double sigma, double minimum, int topScore, int expected, int delta)(Code)
Verifies what happens when you pass these parameters into the thing. DELTA is the amount of error allowed. Usually DELTA is only used for Sigma, as we really can't calculate it exactly.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.