Sample

Schnappinger/junit4/org.junit.runners.parameterized.TestWithParameters

Human rating uses the original dataset scale.

Human3.97
Lines82

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
48.5Δ 35.3
Scalabrino0.7670–1; higher is more readable
53.8Δ 30.1
Dorn0.590–1; higher is more readable
67.3Δ 16.5
Mi0.6250–1; higher is more readable
66.7Δ 17.2
LLOC35Logical lines; fewer is more readable
47.0Δ 36.8
DeepSeek V4 Pro17.670–20; mean of three runs
83.0Δ 0.8
GPT-6.1 Sol190–20; mean of three runs
92.6Δ 8.7
BTTF0.3660–1; higher is more readable
30.0Δ 53.8
Human3.971–4; original rating
83.8

Views

Source code

package org.junit.runners.parameterized; import static java.util.Collections.unmodifiableList; import java.util.ArrayList; import java.util.List; import org.junit.runners.model.TestClass; /** * A {@code TestWithParameters} keeps the data together that are needed for * creating a runner for a single data set of a parameterized test. It has a * name, the test class and a list of parameters. * * @since 4.12 */ public class TestWithParameters { private final String fName; private final TestClass fTestClass; private final List<Object> fParameters; public TestWithParameters(String name, TestClass testClass, List<Object> parameters) { notNull(name, "The name is missing."); notNull(testClass, "The test class is missing."); notNull(parameters, "The parameters are missing."); fName = name; fTestClass = testClass; fParameters = unmodifiableList(new ArrayList<Object>(parameters)); } public String getName() { return fName; } public TestClass getTestClass() { return fTestClass; } public List<Object> getParameters() { return fParameters; } @Override public int hashCode() { int prime = 14747; int result = prime + fName.hashCode(); result = prime * result + fTestClass.hashCode(); return prime * result + fParameters.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TestWithParameters other = (TestWithParameters) obj; return fName.equals(other.fName) && fParameters.equals(other.fParameters) && fTestClass.equals(other.fTestClass); } @Override public String toString() { return fTestClass.getName() + " '" + fName + "' with parameters " + fParameters; } private static void notNull(Object value, String message) { if (value == null) { throw new NullPointerException(message); } } }

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.2143.039−70.72
Source linesThe number of non-empty source lines.82+32.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.463−6.695

Intercept 8.87 + feature contributions = -35.745 (log-odds).
Score = sigmoid(-35.745) = 0.

Score0.767

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.83−1.902
Indentation frequencyHow rapidly indentation changes from line to line.76+1.892
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.76−1.323
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.81.87+0.735
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.75.976+0.447
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.69.627+0.319
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.084+0.128

Intercept 0.07 + feature contributions = 0.365 (log-odds).
Score = sigmoid(0.365) = 0.59.

Score0.625
Score35
Run 1

This code is highly readable due to its clear structure and logical organization. The class has a single responsibility, with fields, constructor, getters, and standard overrides well-separated. Nesting is minimal, limited to simple guard clauses in equals and notNull. Intent is clear from descriptive method names and consistent Javadoc-style comments. The code is concise, with no unnecessary duplication or verbose logic. Action granularity is good, with one main action per line in most methods. Reading flow follows a natural progression from fields to construction to accessors to overrides. Minor improvements could include using Objects.requireNonNull instead of a custom notNull method, and the hashCode implementation, while correct, uses an unusual prime constant that slightly obscures the standard pattern.

Run 2

The code is well-structured and highly readable. It follows a clear logical organization: fields, constructor, getters, equals/hashCode/toString, and a private helper. Nesting is minimal, with only simple null checks in equals and notNull. Intent is clear from descriptive names (fName, fTestClass, fParameters) and concise Javadoc. The code is appropriately concise and avoids unnecessary verbosity. Action granularity is good: the constructor performs null checks then assigns fields, and equals uses early returns for readability. Reading flow is natural, with methods arranged in a conventional order. Minor deductions: the deprecated field prefix 'f' is slightly dated, and the hashCode prime constant could be more descriptive, but these are trivial. Overall, this is exemplary, maintainable Java code.

Run 3

The code is highly readable with clear structure and intent. It follows a logical organization: fields, constructor, getters, then standard methods (hashCode, equals, toString), and a helper. Nesting is minimal—the only nested blocks are simple null checks and equals comparisons. Each method has a single, obvious purpose, and actions are well granularized. Variable names are descriptive (though f-prefix is slightly dated), and the constructor defensively copies and validates inputs. The equals/hashCode implementations are straightforward and correct. Minor deductions: the line-wrapping in equals slightly interrupts flow, and 'notNull' could be a reusable utility rather than private. Overall this is clean, maintainable, production-quality code.

Run 1

Code Structure: Clearly organized into fields, construction, getters, standard overrides, and a validation helper. Nesting: Minimal; guard clauses keep equals flat and easy to follow. Clarity of intent: Class documentation, descriptive method names, and explicit validation messages explain its purpose well. The f-prefixed fields and unexplained hash multiplier are minor distractions. Code length: Concise for a value-object class, with little unnecessary code. Action granularity: Statements generally perform one action per line; the defensive copy and unmodifiable wrapper combine related operations clearly. Reading flow: Consistent formatting and conventional method ordering make the class straightforward to read.

Run 2

Code Structure: Logically organized into fields, constructor, accessors, standard overrides, and a validation helper. Nesting: Minimal; guard clauses keep equals flat and easy to follow. Clarity of intent: Documentation, descriptive method names, and explicit validation make the immutable data container's purpose clear. The f-prefixed fields and unexplained hash prime slightly reduce clarity. Code length: Concise, with little unnecessary code; accessor and equality boilerplate is appropriate. Action granularity: Each statement performs one clear action, while wrapped expressions remain readable. Reading flow: Consistent formatting and conventional method ordering support a natural top-to-bottom reading flow.

Run 3

Code Structure: Well-organized value object with fields, constructor, accessors, standard overrides, and a validation helper. Nesting: Minimal; guard clauses keep equals flat, and conditionals are shallow. Clarity of intent: Documentation, descriptive method names, and explicit validation make the purpose clear. The f-prefixed fields and unexplained hash prime are minor distractions. Code length: Concise for its responsibilities, with little unnecessary code. Action granularity: Statements generally perform one action per line; the defensive-copy expression combines related operations clearly. Reading flow: Natural progression from initialization to access and object behavior, supported by consistent formatting and spacing.