Sample

Schnappinger/junit4/junit.extensions.TestDecorator

Human rating uses the original dataset scale.

Human3.97
Lines42

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett0.2570–1; higher is more readable
75.6Δ 7.1
Scalabrino0.8970–1; higher is more readable
88.4Δ 5.7
Dorn0.8360–1; higher is more readable
91.1Δ 8.4
Mi0.860–1; higher is more readable
99.0Δ 16.3
LLOC13Logical lines; fewer is more readable
68.2Δ 14.5
DeepSeek V4 Pro17.670–20; mean of three runs
83.0Δ 0.3
GPT-6.1 Sol190–20; mean of three runs
92.6Δ 9.9
BTTF0.7170–1; higher is more readable
85.1Δ 2.5
Human3.971–4; original rating
82.7

Views

Source code

package junit.extensions; import junit.framework.Assert; import junit.framework.Test; import junit.framework.TestResult; /** * A Decorator for Tests. Use TestDecorator as the base class for defining new * test decorators. Test decorator subclasses can be introduced to add behaviour * before or after a test is run. */ public class TestDecorator extends Assert implements Test { protected Test fTest; public TestDecorator(Test test) { fTest = test; } /** * The basic run behaviour. */ public void basicRun(TestResult result) { fTest.run(result); } public int countTestCases() { return fTest.countTestCases(); } public void run(TestResult result) { basicRun(result); } @Override public String toString() { return fTest.toString(); } public Test getTest() { return fTest; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.610.496−20.146
Source linesThe number of non-empty source lines.42+16.8
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.391−6.586

Intercept 8.87 + feature contributions = -1.063 (log-odds).
Score = sigmoid(-1.063) = 0.257.

Score0.897

Feature contributions

FeatureValueContribution
(log-odds)
Indentation frequencyHow rapidly indentation changes from line to line.36+0.508
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.42−0.451
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.72.429+0.364
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.066+0.304
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.79.976+0.278
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.40.704+0.159

Intercept 0.07 + feature contributions = 1.63 (log-odds).
Score = sigmoid(1.63) = 0.836.

Score0.86
Score13
Run 1

The code is highly readable and well-structured. It has a clear, single responsibility as a base decorator for tests. The class structure is logical, with fields, constructor, and methods arranged in a natural order. Nesting is minimal—no deeply nested blocks or conditionals. Each method is concise and performs one action per line, with clear intent revealed by method names like basicRun, countTestCases, and getTest. The use of Javadoc comments on the class and basicRun helps clarify purpose. The only minor drawbacks are the protected field fTest (which relies on naming convention for clarity) and slight ambiguity in why basicRun is separate from run, though the comment mitigates this. Overall, the code demonstrates strong readability with a clean flow from construction to execution to introspection.

Run 2

The code is highly readable with clear structure, minimal nesting, and concise methods. Each method has a single responsibility and follows a natural reading flow. The class hierarchy and intent are well-documented. Minor deductions for slightly redundant comments and older naming conventions (fTest prefix).

Run 3

The code is highly readable. It has a clear, logical structure with a well-defined class purpose as a test decorator. It is completely flat with no nesting. Each method performs a single, clear action and delegates to the wrapped Test object, making the intent obvious. Method names like basicRun, countTestCases, and getTest are self-documenting. The code is concise without being too terse. The only minor drawback is the protected field 'fTest' using a legacy prefix, which slightly affects modern readability conventions, but it is still clear given the constructor and getter.

Run 1

Code Structure: The class is logically organized around a wrapped Test, with small delegation methods. Nesting: There is no nested control flow, making every method easy to follow. Clarity of intent: The class documentation clearly explains the decorator role, and method names communicate their purposes; the legacy field name fTest is slightly less descriptive than wrappedTest. Code length: The implementation is concise without unnecessary logic. Action granularity: Each statement performs one clear action. Reading flow: The constructor followed by simple execution, counting, representation, and access methods creates a straightforward reading experience. Minor improvements include grouping basicRun and run together and documenting basicRun as an extension hook.

Run 2

Code Structure: The class is logically organized around a single decorator responsibility, with small delegation methods. Nesting: Methods are flat, with no conditional or loop nesting. Clarity of intent: The class documentation clearly explains its purpose, and method names communicate their roles; the legacy name fTest is slightly less descriptive than wrappedTest. Code length: The implementation is concise, with no unnecessary logic. Action granularity: Each statement performs one action, and each method has a focused responsibility. Reading flow: Consistent formatting and straightforward delegation make the code easy to follow. The relationship between run and basicRun is understandable, though documenting basicRun as a subclass extension point would improve clarity.

Run 3

Code Structure: A clearly organized decorator class with short, cohesive delegation methods. Nesting: Entirely flat, with no conditional or loop nesting. Clarity of intent: The class documentation and method names clearly communicate its purpose; the legacy field name fTest is slightly less descriptive than wrappedTest. Code length: Concise, with no unnecessary implementation detail; basicRun provides an intentional extension point rather than needless duplication. Action granularity: Each statement performs a single action, making behavior easy to scan. Reading flow: Constructor followed by execution, counting, representation, and access methods creates a straightforward flow. Minor inconsistencies in override annotations and sparse method documentation slightly reduce polish but do not impede understanding.