id
int64
1
889
project_id
stringclasses
17 values
bug_id
stringclasses
163 values
class
dict
method
dict
tests
listlengths
1
84
801
Math
81
{ "fields": [ { "modifier": "", "original_string": "private static final double TOLERANCE = 100 * MathUtils.EPSILON;", "type": "double", "var_name": "TOLERANCE" }, { "modifier": "", "original_string": "private static final double TOLERANCE_2 = TOLERANCE * TOLERANCE;", ...
{ "body": "private void computeShiftIncrement(final int start, final int end, final int deflated) {\n\n final double cnst1 = 0.563;\n final double cnst2 = 1.010;\n final double cnst3 = 1.05;\n\n // a negative dMin forces the shift to take that absolute value\n // tType records the t...
[ { "covered_lines": 55, "line_coverage": 0.3548, "name": "org.apache.commons.math.linear.EigenDecompositionImplTest::testMath308", "total_lines": 155 } ]
802
Math
81
{ "fields": [ { "modifier": "", "original_string": "private static final double TOLERANCE = 100 * MathUtils.EPSILON;", "type": "double", "var_name": "TOLERANCE" }, { "modifier": "", "original_string": "private static final double TOLERANCE_2 = TOLERANCE * TOLERANCE;", ...
{ "body": "private void processGeneralBlock(final int n)\n throws InvalidMatrixException {\n\n // check decomposed matrix data range\n double sumOffDiag = 0;\n for (int i = 0; i < n - 1; ++i) {\n final int fourI = 4 * i;\n final double ei = work[fourI + 2];\n ...
[ { "covered_lines": 41, "line_coverage": 0.6406, "name": "org.apache.commons.math.linear.EigenDecompositionImplTest::testMath308", "total_lines": 64 } ]
803
Math
82
{ "fields": [ { "modifier": "", "original_string": "private static final double DEFAULT_EPSILON = 1.0e-6;", "type": "double", "var_name": "DEFAULT_EPSILON" }, { "modifier": "", "original_string": "protected final double epsilon;", "type": "double", "var_name...
{ "body": "private Integer getPivotRow(final int col, final SimplexTableau tableau) {\n double minRatio = Double.MAX_VALUE;\n Integer minRatioPos = null;\n for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) {\n final double rhs = tableau.getEntry(i, tableau....
[ { "covered_lines": 11, "line_coverage": 1, "name": "org.apache.commons.math.optimization.linear.SimplexSolverTest::testMath288", "total_lines": 11 } ]
804
Math
84
{ "fields": [ { "modifier": "", "original_string": "private final double khi;", "type": "double", "var_name": "khi" }, { "modifier": "", "original_string": "private final double gamma;", "type": "double", "var_name": "gamma" } ], "file": "src/main/ja...
{ "body": "@Override\n protected void iterateSimplex(final Comparator<RealPointValuePair> comparator)\n throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {\n\n final RealConvergenceChecker checker = getConvergenceChecker();\n while (true) {\n\n incr...
[ { "covered_lines": 14, "line_coverage": 1, "name": "org.apache.commons.math.optimization.direct.MultiDirectionalTest::testMinimizeMaximize", "total_lines": 14 }, { "covered_lines": 8, "line_coverage": 0.5714, "name": "org.apache.commons.math.optimization.direct.MultiDirectionalTest::...
805
Math
85
{ "fields": [], "file": "src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java", "identifier": "UnivariateRealSolverUtils", "interfaces": "", "superclass": "" }
{ "body": "public static double[] bracket(UnivariateRealFunction function,\n double initial, double lowerBound, double upperBound, \n int maximumIterations) throws ConvergenceException, \n FunctionEvaluationException {\n \n if (function == null) {\n throw Math...
[ { "covered_lines": 16, "line_coverage": 0.7273, "name": "org.apache.commons.math.distribution.NormalDistributionTest::testMath280", "total_lines": 22 } ]
806
Math
89
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -3845586908418844111L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final TreeMap freqTable;", "type": "TreeMap", ...
{ "body": "@Deprecated\n public void addValue(Object v) {\n if (v instanceof Comparable<?>){\n addValue((Comparable<?>) v); \n } else {\n throw new IllegalArgumentException(\"Object must implement Comparable\");\n }\n }", "class_method_signature": "Frequen...
[ { "covered_lines": 1, "line_coverage": 0.5, "name": "org.apache.commons.math.stat.FrequencyTest::testAddNonComparable", "total_lines": 2 } ]
807
Math
90
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -3845586908418844111L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final TreeMap freqTable;", "type": "TreeMap", ...
{ "body": "public void addValue(Comparable<?>v){\n Object obj = v;\n if (v instanceof Integer) {\n obj = Long.valueOf(((Integer) v).longValue());\n }\n try {\n Long count = (Long) freqTable.get(obj);\n if (count == null) {\n freqTable.put(obj,...
[ { "covered_lines": 5, "line_coverage": 0.4545, "name": "org.apache.commons.math.stat.FrequencyTest::testAddNonComparable", "total_lines": 11 } ]
808
Math
90
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -3845586908418844111L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final TreeMap freqTable;", "type": "TreeMap", ...
{ "body": "@Deprecated\n public void addValue(Object v) {\n addValue((Comparable<?>) v);\n }", "class_method_signature": "Frequency.addValue(Object v)", "constructor": false, "full_signature": "@Deprecated\n public void addValue(Object v)", "identifier": "addValue", "invocations": [ "add...
[ { "covered_lines": 5, "line_coverage": 0.4545, "name": "org.apache.commons.math.stat.FrequencyTest::testAddNonComparable", "total_lines": 11 } ]
809
Math
91
{ "fields": [ { "modifier": "", "original_string": "public static final Fraction TWO = new Fraction(2, 1);", "type": "Fraction", "var_name": "TWO" }, { "modifier": "", "original_string": "public static final Fraction ONE = new Fraction(1, 1);", "type": "Fraction",...
{ "body": "public int compareTo(Fraction object) {\n long nOd = ((long) numerator) * object.denominator;\n long dOn = ((long) denominator) * object.numerator;\n return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 0);\n }", "class_method_signature": "Fraction.compareTo(Fraction object)", "constru...
[ { "covered_lines": 3, "line_coverage": 1, "name": "org.apache.commons.math.fraction.FractionTest::testCompareTo", "total_lines": 3 } ]
810
Math
92
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static long binomialCoefficient(final int n, final int k) {\n if (n < k) {\n throw new IllegalArgumentException(\n \"must have n >= k for binomial coefficient (n,k)\");\n }\n if (n < 0) {\n throw new IllegalArgumentException(\n ...
[ { "covered_lines": 9, "line_coverage": 0.75, "name": "org.apache.commons.math.util.MathUtilsTest::testBinomialCoefficientLarge", "total_lines": 12 } ]
811
Math
92
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static double binomialCoefficientDouble(final int n, final int k) {\n if (n < k) {\n throw new IllegalArgumentException(\n \"must have n >= k for binomial coefficient (n,k)\");\n }\n if (n < 0) {\n throw new IllegalArgumentException(\n ...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.apache.commons.math.util.MathUtilsTest::testBinomialCoefficientLarge", "total_lines": 1 } ]
812
Math
92
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static double binomialCoefficientLog(final int n, final int k) {\n if (n < k) {\n throw new IllegalArgumentException(\n \"must have n >= k for binomial coefficient (n,k)\");\n }\n if (n < 0) {\n throw new IllegalArgumentException(\n ...
[ { "covered_lines": 10, "line_coverage": 0.7143, "name": "org.apache.commons.math.util.MathUtilsTest::testBinomialCoefficientLarge", "total_lines": 14 } ]
813
Math
93
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static long factorial(final int n) {\n if (n < 0) {\n throw new IllegalArgumentException(\"must have n >= 0 for n!\");\n }\n if (n > 20) {\n throw new ArithmeticException(\n \"factorial value is too large to fit in a long\");\n }\n...
[ { "covered_lines": 3, "line_coverage": 0.75, "name": "org.apache.commons.math.util.MathUtilsTest::testFactorial", "total_lines": 4 } ]
814
Math
93
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static double factorialDouble(final int n) {\n if (n < 0) {\n throw new IllegalArgumentException(\"must have n >= 0 for n!\");\n }\n if (n < 21) {\n return factorial(n);\n }\n return Math.floor(Math.exp(factorialLog(n)) + 0.5);\n }", "cla...
[ { "covered_lines": 2, "line_coverage": 0.6667, "name": "org.apache.commons.math.util.MathUtilsTest::testFactorial", "total_lines": 3 } ]
815
Math
93
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static double factorialLog(final int n) {\n if (n < 0) {\n throw new IllegalArgumentException(\"must have n > 0 for n!\");\n }\n if (n < 21) {\n return Math.log(factorial(n));\n }\n double logSum = 0;\n for (int i = 2; i <= n; i++) {\n ...
[ { "covered_lines": 5, "line_coverage": 0.8333, "name": "org.apache.commons.math.util.MathUtilsTest::testFactorial", "total_lines": 6 } ]
816
Math
94
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static int gcd(int u, int v) {\n if ((u == 0) || (v == 0)) {\n return (Math.abs(u) + Math.abs(v));\n }\n // keep u and v negative, as negative integers range down to\n // -2^31, while positive numbers can only be as large as 2^31-1\n // (i.e. we can't ne...
[ { "covered_lines": 21, "line_coverage": 0.9545, "name": "org.apache.commons.math.util.MathUtilsTest::testGcd", "total_lines": 22 } ]
817
Math
95
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -8516354193418641566L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private double numeratorDegreesOfFreedom;", "type": "d...
{ "body": "protected double getInitialDomain(double p) {\n double ret = 1.0;\n double d = getDenominatorDegreesOfFreedom();\n if (d > 2.0) {\n // use mean\n ret = d / (d - 2.0);\n }\n return ret;\n }", "class_method_signature": "FDistributionImpl.getInitia...
[ { "covered_lines": 3, "line_coverage": 1, "name": "org.apache.commons.math.distribution.FDistributionTest::testSmallDegreesOfFreedom", "total_lines": 3 } ]
818
Math
96
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -6530173849413811929L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final Complex I = new Complex(0.0, 1.0);", ...
{ "body": "public boolean equals(Object other) {\n boolean ret;\n \n if (this == other) { \n ret = true;\n } else if (other == null) {\n ret = false;\n } else {\n try {\n Complex rhs = (Complex)other;\n if (rhs.isNaN())...
[ { "covered_lines": 7, "line_coverage": 0.5833, "name": "org.apache.commons.math.complex.ComplexTest::testMath221", "total_lines": 12 } ]
819
Math
97
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -2136672307739067002L;", "type": "long", "var_name": "serialVersionUID" } ], "file": "src/java/org/apache/commons/math/analysis/BrentSolver.java", "identifier": "BrentSolver", "inte...
{ "body": "public double solve(double min, double max) throws MaxIterationsExceededException, \n FunctionEvaluationException {\n \n clearResult();\n verifyInterval(min, max);\n \n double ret = Double.NaN;\n \n double yMin = f.value(min);\n double yMax = f...
[ { "covered_lines": 14, "line_coverage": 0.2414, "name": "org.apache.commons.math.analysis.BrentSolverTest::testRootEndpoints", "total_lines": 58 } ]
820
Math
98
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -1011428905656140431L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "protected BigDecimal data[][] = null;", "type": "BigDe...
{ "body": "public BigDecimal[] operate(BigDecimal[] v) throws IllegalArgumentException {\n if (v.length != this.getColumnDimension()) {\n throw new IllegalArgumentException(\"vector has wrong length\");\n }\n final int nRows = this.getRowDimension();\n final int nCols = this.get...
[ { "covered_lines": 9, "line_coverage": 0.8182, "name": "org.apache.commons.math.linear.BigMatrixImplTest::testMath209", "total_lines": 11 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.apache.commons.math.linear.RealMatrixImplTest::testMath209", "total_lines": 11 } ]
821
Math
98
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -4828886979278117018L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "protected double data[][] = null;", "type": "double", ...
{ "body": "public double[] operate(double[] v) throws IllegalArgumentException {\n final int nRows = this.getRowDimension();\n final int nCols = this.getColumnDimension();\n if (v.length != nCols) {\n throw new IllegalArgumentException(\"vector has wrong length\");\n }\n ...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.apache.commons.math.linear.BigMatrixImplTest::testMath209", "total_lines": 12 }, { "covered_lines": 10, "line_coverage": 0.8333, "name": "org.apache.commons.math.linear.RealMatrixImplTest::testMath209", "total_lines": 12 } ...
822
Math
99
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static int gcd(final int p, final int q) {\n int u = p;\n int v = q;\n if ((u == 0) || (v == 0)) {\n if ((u == Integer.MIN_VALUE) || (v == Integer.MIN_VALUE)) {\n throw MathRuntimeException.createArithmeticException(\n \"overflow:...
[ { "covered_lines": 23, "line_coverage": 0.92, "name": "org.apache.commons.math.util.MathUtilsTest::testGcd", "total_lines": 25 }, { "covered_lines": 22, "line_coverage": 0.88, "name": "org.apache.commons.math.util.MathUtilsTest::testLcm", "total_lines": 25 } ]
823
Math
99
{ "fields": [ { "modifier": "", "original_string": "public static final double EPSILON = 0x1.0p-53;", "type": "double", "var_name": "EPSILON" }, { "modifier": "", "original_string": "public static final double SAFE_MIN = 0x1.0p-1022;", "type": "double", "var...
{ "body": "public static int lcm(int a, int b) {\n if (a==0 || b==0){\n return 0;\n }\n int lcm = Math.abs(mulAndCheck(a / gcd(a, b), b));\n if (lcm == Integer.MIN_VALUE){\n throw new ArithmeticException(\"overflow: lcm is 2^31\");\n }\n return lcm;\n ...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.apache.commons.math.util.MathUtilsTest::testGcd", "total_lines": 4 }, { "covered_lines": 4, "line_coverage": 1, "name": "org.apache.commons.math.util.MathUtilsTest::testLcm", "total_lines": 4 } ]
824
Math
100
{ "fields": [ { "modifier": "", "original_string": "protected WeightedMeasurement[] measurements;", "type": "WeightedMeasurement[]", "var_name": "measurements" }, { "modifier": "", "original_string": "protected EstimatedParameter[] parameters;", "type": "Estimated...
{ "body": "public double[][] getCovariances(EstimationProblem problem)\n throws EstimationException {\n \n // set up the jacobian\n updateJacobian();\n\n // compute transpose(J).J, avoiding building big intermediate matrices\n final int rows = problem.getMeasurements().length;\n ...
[ { "covered_lines": 10, "line_coverage": 0.6667, "name": "org.apache.commons.math.estimation.GaussNewtonEstimatorTest::testBoundParameters", "total_lines": 15 } ]
825
Math
101
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -6337346779577272306L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final String DEFAULT_IMAGINARY_CHARACTER = \"...
{ "body": "public Complex parse(String source, ParsePosition pos) {\n int initialIndex = pos.getIndex();\n\n // parse whitespace\n parseAndIgnoreWhitespace(source, pos);\n\n // parse real\n Number re = parseNumber(source, getRealFormat(), pos);\n if (re == null) {\n ...
[ { "covered_lines": 18, "line_coverage": 0.5294, "name": "org.apache.commons.math.complex.ComplexFormatTest::testForgottenImaginaryCharacter", "total_lines": 34 }, { "covered_lines": 18, "line_coverage": 0.5294, "name": "org.apache.commons.math.complex.FrenchComplexFormatTest::testFor...
826
Math
103
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 8589540077390120676L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private double mean = 0;", "type": "double", "var...
{ "body": "public double cumulativeProbability(double x) throws MathException {\n try {\n return 0.5 * (1.0 + Erf.erf((x - mean) /\n (standardDeviation * Math.sqrt(2.0))));\n } catch (MaxIterationsExceededException ex) {\n if (x < (mean - 20 * standardDeviation))...
[ { "covered_lines": 2, "line_coverage": 1, "name": "org.apache.commons.math.distribution.NormalDistributionTest::testExtremeValues", "total_lines": 2 } ]
827
Math
105
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -3004689053607543335L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private double sumX = 0d;", "type": "double", "v...
{ "body": "public double getSumSquaredErrors() {\n return Math.max(0d, sumYY - sumXY * sumXY / sumXX);\n }", "class_method_signature": "SimpleRegression.getSumSquaredErrors()", "constructor": false, "full_signature": "public double getSumSquaredErrors()", "identifier": "getSumSquaredErrors", "invo...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.apache.commons.math.stat.regression.SimpleRegressionTest::testSSENonNegative", "total_lines": 1 } ]
828
Math
106
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -6337346779577272307L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private NumberFormat wholeFormat;", "type": "NumberFor...
{ "body": "public Fraction parse(String source, ParsePosition pos) {\r\n // try to parse improper fraction\r\n Fraction ret = super.parse(source, pos);\r\n if (ret != null) {\r\n return ret;\r\n }\r\n \r\n int initialIndex = pos.getIndex();\r\n\r\n // parse ...
[ { "covered_lines": 20, "line_coverage": 0.6452, "name": "org.apache.commons.math.fraction.FractionFormatTest::testParseProperInvalidMinus", "total_lines": 31 } ]
829
Mockito
12
{ "fields": [], "file": "src/org/mockito/internal/util/reflection/GenericMaster.java", "identifier": "GenericMaster", "interfaces": "", "superclass": "" }
{ "body": "public Class getGenericType(Field field) { \r\n Type generic = field.getGenericType();\r\n if (generic != null && generic instanceof ParameterizedType) {\r\n Type actual = ((ParameterizedType) generic).getActualTypeArguments()[0];\r\n if (actual instanceof Class) ...
[ { "covered_lines": 4, "line_coverage": 0.8, "name": "org.mockito.internal.util.reflection.GenericMasterTest::shouldDealWithNestedGenerics", "total_lines": 5 }, { "covered_lines": 5, "line_coverage": 1, "name": "org.mockitousage.annotation.CaptorAnnotationBasicTest::shouldUseAnnotated...
830
Mockito
13
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -2917871070982574165L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "InvocationContainerImpl invocationContainerImpl;", "ty...
{ "body": "public Object handle(Invocation invocation) throws Throwable {\r\n if (invocationContainerImpl.hasAnswersForStubbing()) {\r\n // stubbing voids with stubVoid() or doAnswer() style\r\n InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(mockingProgress\r\n ...
[ { "covered_lines": 16, "line_coverage": 0.6957, "name": "org.mockitousage.bugs.VerifyingWithAnExtraCallToADifferentMockTest::shouldAllowVerifyingWhenOtherMockCallIsInTheSameLine", "total_lines": 23 } ]
831
Mockito
14
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -2917871070982574165L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "InvocationContainerImpl invocationContainerImpl;", "ty...
{ "body": "public Object handle(Invocation invocation) throws Throwable {\r\n if (invocationContainerImpl.hasAnswersForStubbing()) {\r\n // stubbing voids with stubVoid() or doAnswer() style\r\n InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(mockingProgress\r\n ...
[ { "covered_lines": 15, "line_coverage": 0.6818, "name": "org.mockitousage.bugs.VerifyingWithAnExtraCallToADifferentMockTest::shouldAllowVerifyingWhenOtherMockCallIsInTheSameLine", "total_lines": 22 } ]
832
Mockito
14
{ "fields": [ { "modifier": "", "original_string": "private final Reporter reporter = new Reporter();", "type": "Reporter", "var_name": "reporter" }, { "modifier": "", "original_string": "private final MockUtil mockUtil = new MockUtil();", "type": "MockUtil", ...
{ "body": "public <T> T verify(T mock, VerificationMode mode) {\r\n if (mock == null) {\r\n reporter.nullPassedToVerify();\r\n } else if (!mockUtil.isMock(mock)) {\r\n reporter.notAMockPassedToVerify();\r\n }\r\n mockingProgress.verificationStarted(new MockAwareVerifi...
[ { "covered_lines": 4, "line_coverage": 0.6667, "name": "org.mockitousage.bugs.VerifyingWithAnExtraCallToADifferentMockTest::shouldAllowVerifyingWhenOtherMockCallIsInTheSameLine", "total_lines": 6 } ]
833
Mockito
15
{ "fields": [], "file": "src/org/mockito/internal/configuration/injection/FinalMockCandidateFilter.java", "identifier": "FinalMockCandidateFilter", "interfaces": "MockCandidateFilter", "superclass": "" }
{ "body": "public OngoingInjecter filterCandidate(final Collection<Object> mocks, final Field field, final Object fieldInstance) {\r\n if(mocks.size() == 1) {\r\n final Object matchingMock = mocks.iterator().next();\r\n\r\n return new OngoingInjecter() {\r\n public boolean ...
[ { "covered_lines": 4, "line_coverage": 1, "name": "org.mockitousage.bugs.InjectMocksShouldTryPropertySettersFirstBeforeFieldAccessTest::shouldInjectUsingPropertySetterIfAvailable", "total_lines": 4 } ]
834
Mockito
16
{ "fields": [ { "modifier": "", "original_string": "private static final MockitoCore MOCKITO_CORE = new MockitoCore();", "type": "MockitoCore", "var_name": "MOCKITO_CORE" }, { "modifier": "", "original_string": "public static final Answer<Object> RETURNS_DEFAULTS = new ...
{ "body": "public static <T> T mock(Class<T> classToMock, MockSettings mockSettings) {\r\n return MOCKITO_CORE.mock(classToMock, mockSettings, true);\r\n }", "class_method_signature": "Mockito.mock(Class<T> classToMock, MockSettings mockSettings)", "constructor": false, "full_signature": "public stati...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.bugs.StubbingMocksThatAreConfiguredToReturnMocksTest::shouldAllowStubbingMocksConfiguredWithRETURNS_MOCKS", "total_lines": 1 } ]
835
Mockito
16
{ "fields": [ { "modifier": "", "original_string": "private final Reporter reporter = new Reporter();", "type": "Reporter", "var_name": "reporter" }, { "modifier": "", "original_string": "private final MockUtil mockUtil = new MockUtil();", "type": "MockUtil", ...
{ "body": "public <T> T mock(Class<T> classToMock, MockSettings mockSettings, boolean shouldResetOngoingStubbing) {\r\n mockingProgress.validateState();\r\n if (shouldResetOngoingStubbing) {\r\n mockingProgress.resetOngoingStubbing();\r\n }\r\n return mockUtil.createMock(classTo...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.bugs.StubbingMocksThatAreConfiguredToReturnMocksTest::shouldAllowStubbingMocksConfiguredWithRETURNS_MOCKS", "total_lines": 1 } ]
836
Mockito
17
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 4475297236197939568L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private Class<?>[] extraInterfaces;", "type": "Class<?>...
{ "body": "public MockSettings serializable() {\r\n this.serializable = true;\r\n return this;\r\n }", "class_method_signature": "MockSettingsImpl.serializable()", "constructor": false, "full_signature": "public MockSettings serializable()", "identifier": "serializable", "invocations": [], ...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.basicapi.MocksSerializationTest::shouldBeSerializeAndHaveExtraInterfaces", "total_lines": 1 } ]
837
Mockito
17
{ "fields": [ { "modifier": "", "original_string": "private final CreationValidator creationValidator;", "type": "CreationValidator", "var_name": "creationValidator" } ], "file": "src/org/mockito/internal/util/MockUtil.java", "identifier": "MockUtil", "interfaces": "", "super...
{ "body": "public <T> T createMock(Class<T> classToMock, MockSettingsImpl settings) {\r\n creationValidator.validateType(classToMock);\r\n creationValidator.validateExtraInterfaces(classToMock, settings.getExtraInterfaces());\r\n creationValidator.validateMockedType(classToMock, settings.getSpied...
[ { "covered_lines": 12, "line_coverage": 0.9231, "name": "org.mockitousage.basicapi.MocksSerializationTest::shouldBeSerializeAndHaveExtraInterfaces", "total_lines": 13 } ]
838
Mockito
22
{ "fields": [], "file": "src/org/mockito/internal/matchers/Equality.java", "identifier": "Equality", "interfaces": "", "superclass": "" }
{ "body": "public static boolean areEqual(Object o1, Object o2) {\r\n if (o1 == o2 ) {\r\n return true;\r\n\t} else if (o1 == null || o2 == null) {\r\n return o1 == null && o2 == null;\r\n } else if (isArray(o1)) {\r\n return isArray(o2) && areArraysEqual(o1, o2);\r\n ...
[ { "covered_lines": 5, "line_coverage": 1, "name": "org.mockito.internal.matchers.EqualityTest::shouldKnowIfObjectsAreEqual", "total_lines": 5 } ]
839
Mockito
23
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private transient MockitoCore mockitoCore;", "type": "...
{ "body": "public Object answer(InvocationOnMock invocation) throws Throwable {\r\n return mock;\r\n }", "class_method_signature": "ReturnsDeepStubs.answer(InvocationOnMock invocation)", "constructor": false, "full_signature": "public Object answer(InvocationOnMock invocation) throws T...
[ { "covered_lines": 6, "line_coverage": 1, "name": "org.mockitousage.stubbing.DeepStubsSerializableTest::should_serialize_and_deserialize_mock_created_by_deep_stubs", "total_lines": 6 } ]
840
Mockito
23
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private transient MockitoCore mockitoCore;", "type": "...
{ "body": "public Object answer(InvocationOnMock invocation) throws Throwable {\r\n GenericMetadataSupport returnTypeGenericMetadata =\r\n actualParameterizedType(invocation.getMock()).resolveGenericReturnType(invocation.getMethod());\r\n\r\n Class<?> rawType = returnTypeGenericMetadata.r...
[ { "covered_lines": 6, "line_coverage": 1, "name": "org.mockitousage.stubbing.DeepStubsSerializableTest::should_serialize_and_deserialize_mock_created_by_deep_stubs", "total_lines": 6 } ]
841
Mockito
23
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private transient MockitoCore mockitoCore;", "type": "...
{ "body": "private Object recordDeepStubMock(final Object mock, InvocationContainerImpl container) throws Throwable {\r\n\r\n container.addAnswer(new SerializableAnswer() {\r\n public Object answer(InvocationOnMock invocation) throws Throwable {\r\n return mock;\r\n }\r\n ...
[ { "covered_lines": 2, "line_coverage": 1, "name": "org.mockitousage.stubbing.DeepStubsSerializableTest::should_serialize_and_deserialize_mock_created_by_deep_stubs", "total_lines": 2 } ]
842
Mockito
23
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private transient MockitoCore mockitoCore;", "type": "...
{ "body": "private MockSettings withSettingsUsing(GenericMetadataSupport returnTypeGenericMetadata) {\r\n MockSettings mockSettings =\r\n returnTypeGenericMetadata.rawExtraInterfaces().length > 0 ?\r\n withSettings().extraInterfaces(returnTypeGenericMetadata.rawExtraInterfaces())\...
[ { "covered_lines": 4, "line_coverage": 0.8, "name": "org.mockitousage.stubbing.DeepStubsSerializableTest::should_serialize_and_deserialize_mock_created_by_deep_stubs", "total_lines": 5 } ]
843
Mockito
24
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 1998191268711234347L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "ObjectMethodsGuru methodsGuru = new ObjectMethodsGuru();", ...
{ "body": "public Object answer(InvocationOnMock invocation) {\n if (methodsGuru.isToString(invocation.getMethod())) {\n Object mock = invocation.getMock();\n MockName name = mockUtil.getMockName(mock);\n if (name.isDefault()) {\n return \"Mock for \" + mockUtil....
[ { "covered_lines": 3, "line_coverage": 0.3, "name": "org.mockito.internal.stubbing.defaultanswers.ReturnsEmptyValuesTest::should_return_zero_if_mock_is_compared_to_itself", "total_lines": 10 }, { "covered_lines": 3, "line_coverage": 0.3, "name": "org.mockitousage.bugs.ShouldMocksComp...
844
Mockito
25
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ReturnsEmptyValues delegate = new ReturnsEmptyValues...
{ "body": "@Override\r\n protected GenericMetadataSupport actualParameterizedType(Object mock) {\r\n return returnTypeGenericMetadata;\r\n }", "class_method_signature": "ReturnsDeepStubs.actualParameterizedType(Object mock)", "constructor": false, "full_signature": "@Overrid...
[ { "covered_lines": 2, "line_coverage": 1, "name": "org.mockito.internal.stubbing.defaultanswers.ReturnsGenericDeepStubsTest::will_return_default_value_on_non_mockable_nested_generic", "total_lines": 2 }, { "covered_lines": 2, "line_coverage": 1, "name": "org.mockito.internal.stubbing...
845
Mockito
25
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ReturnsEmptyValues delegate = new ReturnsEmptyValues...
{ "body": "public Object answer(InvocationOnMock invocation) throws Throwable {\r\n GenericMetadataSupport returnTypeGenericMetadata =\r\n actualParameterizedType(invocation.getMock()).resolveGenericReturnType(invocation.getMethod());\r\n\r\n Class<?> rawType = returnTypeGenericMetadata.r...
[ { "covered_lines": 5, "line_coverage": 0.8333, "name": "org.mockito.internal.stubbing.defaultanswers.ReturnsGenericDeepStubsTest::will_return_default_value_on_non_mockable_nested_generic", "total_lines": 6 }, { "covered_lines": 5, "line_coverage": 0.8333, "name": "org.mockito.interna...
846
Mockito
25
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ReturnsEmptyValues delegate = new ReturnsEmptyValues...
{ "body": "private Object getMock(InvocationOnMock invocation, GenericMetadataSupport returnTypeGenericMetadata) throws Throwable {\r\n \tInternalMockHandler<Object> handler = new MockUtil().getMockHandler(invocation.getMock());\r\n \tInvocationContainerImpl container = (InvocationContainerImpl) handler.getInvo...
[ { "covered_lines": 4, "line_coverage": 0.5714, "name": "org.mockito.internal.stubbing.defaultanswers.ReturnsGenericDeepStubsTest::will_return_default_value_on_non_mockable_nested_generic", "total_lines": 7 }, { "covered_lines": 4, "line_coverage": 0.5714, "name": "org.mockito.interna...
847
Mockito
25
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -7105341425736035847L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private ReturnsEmptyValues delegate = new ReturnsEmptyValues...
{ "body": "private Object recordDeepStubMock(final Object mock, InvocationContainerImpl container) throws Throwable {\r\n\r\n container.addAnswer(new Answer<Object>() {\r\n public Object answer(InvocationOnMock invocation) throws Throwable {\r\n return mock;\r\n }\r\n ...
[ { "covered_lines": 4, "line_coverage": 1, "name": "org.mockito.internal.stubbing.defaultanswers.ReturnsGenericDeepStubsTest::will_return_default_value_on_non_mockable_nested_generic", "total_lines": 4 }, { "covered_lines": 4, "line_coverage": 1, "name": "org.mockito.internal.stubbing...
848
Mockito
27
{ "fields": [ { "modifier": "", "original_string": "private final MockCreationValidator creationValidator;", "type": "MockCreationValidator", "var_name": "creationValidator" } ], "file": "src/org/mockito/internal/util/MockUtil.java", "identifier": "MockUtil", "interfaces": "", ...
{ "body": "public <T> void resetMock(T mock) {\r\n MockHandlerInterface<T> oldMockHandler = getMockHandler(mock);\r\n MethodInterceptorFilter newFilter = newMethodInterceptorFilter(oldMockHandler.getMockSettings());\r\n ((Factory) mock).setCallback(0, newFilter);\r\n }", "class_method_signat...
[ { "covered_lines": 5, "line_coverage": 1, "name": "org.mockitousage.bugs.ListenersLostOnResetMockTest::listener", "total_lines": 5 } ]
849
Mockito
28
{ "fields": [ { "modifier": "", "original_string": "private final MockCandidateFilter mockCandidateFilter = new TypeBasedCandidateFilter(new NameBasedCandidateFilter(new FinalMockCandidateFilter()));", "type": "MockCandidateFilter", "var_name": "mockCandidateFilter" }, { "mod...
{ "body": "private void injectMockCandidate(Class<?> awaitingInjectionClazz, Set<Object> mocks, Object fieldInstance) {\r\n for(Field field : orderedInstanceFieldsFrom(awaitingInjectionClazz)) {\r\n Object injected = mockCandidateFilter.filterCandidate(mocks, field, fieldInstance).thenInject();\r\n ...
[ { "covered_lines": 3, "line_coverage": 1, "name": "org.mockitousage.bugs.InjectionByTypeShouldFirstLookForExactTypeThenAncestorTest::mock_should_be_injected_once_and_in_the_best_matching_type", "total_lines": 3 } ]
850
Mockito
29
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -1226959355938572597L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final Object wanted;", "type": "Object", ...
{ "body": "public void describeTo(Description description) {\n description.appendText(\"same(\");\n appendQuoting(description);\n description.appendText(wanted == null ? \"null\" : wanted.toString());\n appendQuoting(description);\n description.appendText(\")\");\n }", "class_m...
[ { "covered_lines": 3, "line_coverage": 0.5, "name": "org.mockitousage.bugs.NPEWithCertainMatchersTest::shouldNotThrowNPEWhenNullPassedToSame", "total_lines": 6 } ]
851
Mockito
30
{ "fields": [], "file": "src/org/mockito/exceptions/Reporter.java", "identifier": "Reporter", "interfaces": "", "superclass": "" }
{ "body": "public void smartNullPointerException(Object obj, Location location) {\n throw new SmartNullPointerException(join(\n \"You have a NullPointerException here:\",\n new Location(),\n obj,\n \"Because this method was *not* stubbed correctly:\",...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockito.internal.stubbing.defaultanswers.ReturnsSmartNullsTest::shouldPrintTheParametersOnSmartNullPointerExceptionMessage", "total_lines": 1 } ]
852
Mockito
32
{ "fields": [], "file": "src/org/mockito/internal/configuration/SpyAnnotationEngine.java", "identifier": "SpyAnnotationEngine", "interfaces": "AnnotationEngine", "superclass": "" }
{ "body": "@SuppressWarnings(\"deprecation\")\r\n public void process(Class<?> context, Object testClass) {\r\n Field[] fields = context.getDeclaredFields();\r\n for (Field field : fields) {\r\n if (field.isAnnotationPresent(Spy.class)) {\r\n assertNoAnnotations(Spy.class, f...
[ { "covered_lines": 13, "line_coverage": 0.7647, "name": "org.mockitousage.bugs.SpyShouldHaveNiceNameTest::shouldPrintNiceName", "total_lines": 17 } ]
853
Mockito
33
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -3047126096857467610L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final Invocation invocation;", "type": "Invoca...
{ "body": "public boolean hasSameMethod(Invocation candidate) { \n //not using method.equals() for 1 good reason:\n //sometimes java generates forwarding methods when generics are in play see JavaGenericsForwardingMethodsTest\n Method m1 = invocation.getMethod();\n Method m2 = candi...
[ { "covered_lines": 3, "line_coverage": 1, "name": "org.mockitousage.bugs.InheritedGenericsPolimorphicCallTest::shouldStubbingWork", "total_lines": 3 }, { "covered_lines": 3, "line_coverage": 1, "name": "org.mockitousage.bugs.InheritedGenericsPolimorphicCallTest::shouldVerificationWor...
854
Mockito
34
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -3047126096857467610L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final Invocation invocation;", "type": "Invoca...
{ "body": "public void captureArgumentsFrom(Invocation i) {\n int k = 0;\n for (Matcher m : matchers) {\n if (m instanceof CapturesArguments && i.getArguments().length > k) {\n ((CapturesArguments) m).captureFrom(i.getArguments()[k]);\n }\n k++;\n }...
[ { "covered_lines": 4, "line_coverage": 0.5714, "name": "org.mockito.internal.invocation.InvocationMatcherTest::shouldMatchCaptureArgumentsWhenArgsCountDoesNOTMatch", "total_lines": 7 }, { "covered_lines": 4, "line_coverage": 0.5714, "name": "org.mockitousage.basicapi.UsingVarargsTest...
855
Mockito
35
{ "fields": [ { "modifier": "", "original_string": "private static MockingProgress mockingProgress = new ThreadSafeMockingProgress();", "type": "MockingProgress", "var_name": "mockingProgress" } ], "file": "src/org/mockito/Matchers.java", "identifier": "Matchers", "interfaces":...
{ "body": "public static <T> T isA(Class<T> clazz) {\r\n return reportMatcher(new InstanceOf(clazz)).<T>returnFor(clazz);\r\n }", "class_method_signature": "Matchers.isA(Class<T> clazz)", "constructor": false, "full_signature": "public static <T> T isA(Class<T> clazz)", "identifier": "isA", "invoc...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.bugs.NPEWithCertainMatchersTest::shouldNotThrowNPEWhenIntPassed", "total_lines": 1 }, { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.bugs.NPEWithCertainMatchersTest::shouldNotThrowNPEWhenIntegerP...
856
Mockito
35
{ "fields": [ { "modifier": "", "original_string": "private static MockingProgress mockingProgress = new ThreadSafeMockingProgress();", "type": "MockingProgress", "var_name": "mockingProgress" } ], "file": "src/org/mockito/Matchers.java", "identifier": "Matchers", "interfaces":...
{ "body": "public static <T> T same(T value) {\r\n return (T) reportMatcher(new Same(value)).<T>returnFor((Class) value.getClass());\r\n }", "class_method_signature": "Matchers.same(T value)", "constructor": false, "full_signature": "public static <T> T same(T value)", "identifier": "same", "invoc...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.mockitousage.bugs.NPEWithCertainMatchersTest::shouldNotThrowNPEWhenIntPassed", "total_lines": 1 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.mockitousage.bugs.NPEWithCertainMatchersTest::shouldNotThrowNPEWhenIntegerP...
857
Mockito
36
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 8240069639250980199L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int MAX_LINE_LENGTH = 45;", "type"...
{ "body": "public Object callRealMethod() throws Throwable {\n if (this.getMethod().getDeclaringClass().isInterface()) {\n new Reporter().cannotCallRealMethodOnInterface();\n }\n return realMethod.invoke(mock, rawArguments);\n }", "class_method_signature": "Invocation.callRealMeth...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockito.internal.invocation.InvocationTest::shouldScreamWhenCallingRealMethodOnInterface", "total_lines": 1 }, { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.spies.SpyingOnInterfacesTest::shouldFailInRuntimeW...
858
Mockito
37
{ "fields": [ { "modifier": "", "original_string": "private Reporter reporter = new Reporter();", "type": "Reporter", "var_name": "reporter" } ], "file": "src/org/mockito/internal/stubbing/answers/AnswersValidator.java", "identifier": "AnswersValidator", "interfaces": "", "su...
{ "body": "public void validate(Answer<?> answer, Invocation invocation) {\r\n if (answer instanceof ThrowsException) {\r\n validateException((ThrowsException) answer, invocation);\r\n }\r\n \r\n if (answer instanceof Returns) {\r\n validateReturnValue((Returns) answe...
[ { "covered_lines": 4, "line_coverage": 0.5714, "name": "org.mockito.internal.stubbing.answers.AnswersValidatorTest::shouldFailWhenCallingRealMethodOnIterface", "total_lines": 7 }, { "covered_lines": 4, "line_coverage": 0.5714, "name": "org.mockitousage.spies.SpyingOnInterfacesTest::s...
859
Mockito
38
{ "fields": [], "file": "src/org/mockito/internal/verification/argumentmatching/ArgumentMatchingTool.java", "identifier": "ArgumentMatchingTool", "interfaces": "", "superclass": "" }
{ "body": "private boolean toStringEquals(Matcher m, Object arg) {\r\n return StringDescription.toString(m).equals(arg == null? \"null\" : arg.toString());\r\n }", "class_method_signature": "ArgumentMatchingTool.toStringEquals(Matcher m, Object arg)", "constructor": false, "full_signature": "private b...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.mockito.internal.verification.argumentmatching.ArgumentMatchingToolTest::shouldWorkFineWhenGivenArgIsNull", "total_lines": 1 }, { "covered_lines": 1, "line_coverage": 1, "name": "org.mockitousage.bugs.ActualInvocationHasNullArgum...
860
Time
1
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -6390301302770925357L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static HashMap<DurationFieldType, UnsupportedDuratio...
{ "body": "public int compareTo(DurationField durationField) {\n return 0;\n }", "class_method_signature": "UnsupportedDurationField.compareTo(DurationField durationField)", "constructor": false, "full_signature": "public int compareTo(DurationField durationField)", "identifier": "compareTo", "inv...
[ { "covered_lines": 2, "line_coverage": 0.6667, "name": "org.joda.time.TestPartial_Constructors::testConstructorEx7_TypeArray_intArray", "total_lines": 3 } ]
861
Time
2
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 12324121189002L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final Chronology iChronology;", "type": "Chronology"...
{ "body": "public Partial with(DateTimeFieldType fieldType, int value) {\n if (fieldType == null) {\n throw new IllegalArgumentException(\"The field type must not be null\");\n }\n int index = indexOf(fieldType);\n if (index == -1) {\n DateTimeFieldType[] newTypes = n...
[ { "covered_lines": 15, "line_coverage": 0.4286, "name": "org.joda.time.TestPartial_Basics::testWith_baseAndArgHaveNoRange", "total_lines": 35 } ]
862
Time
2
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -6390301302770925357L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static HashMap<DurationFieldType, UnsupportedDuratio...
{ "body": "public int compareTo(DurationField durationField) {\n if (durationField.isSupported()) {\n return 1;\n }\n return 0;\n }", "class_method_signature": "UnsupportedDurationField.compareTo(DurationField durationField)", "constructor": false, "full_signature": "public in...
[ { "covered_lines": 1, "line_coverage": 1, "name": "org.joda.time.TestPartial_Basics::testWith_baseAndArgHaveNoRange", "total_lines": 1 } ]
863
Time
3
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 2852608688135209575L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final int ROUND_NONE = 0;", "type": "int"...
{ "body": "public void addDays(final int days) {\n if (days != 0) {\n setMillis(getChronology().days().add(getMillis(), days));\n }\n }", "class_method_signature": "MutableDateTime.addDays(final int days)", "constructor": false, "full_signature": "public void addDays(final int days)"...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestMutableDateTime_Adds::testAddYears_int_dstOverlapWinter_addZero", "total_lines": 2 }, { "covered_lines": 2, "line_coverage": 1, "name": "org.joda.time.TestMutableDateTime_Adds::testAddDays_int_dstOverlapWinter_addZe...
864
Time
3
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 2852608688135209575L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final int ROUND_NONE = 0;", "type": "int"...
{ "body": "public void addHours(final int hours) {\n if (hours != 0) {\n setMillis(getChronology().hours().add(getMillis(), hours));\n }\n }", "class_method_signature": "MutableDateTime.addHours(final int hours)", "constructor": false, "full_signature": "public void addHours(final in...
[ { "covered_lines": 2, "line_coverage": 1, "name": "org.joda.time.TestMutableDateTime_Adds::testAddYears_int_dstOverlapWinter_addZero", "total_lines": 2 }, { "covered_lines": 2, "line_coverage": 1, "name": "org.joda.time.TestMutableDateTime_Adds::testAddDays_int_dstOverlapWinter_addZe...
865
Time
3
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 2852608688135209575L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final int ROUND_NONE = 0;", "type": "int"...
{ "body": "public void addMonths(final int months) {\n if (months != 0) {\n setMillis(getChronology().months().add(getMillis(), months));\n }\n }", "class_method_signature": "MutableDateTime.addMonths(final int months)", "constructor": false, "full_signature": "public void addMonths(...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestMutableDateTime_Adds::testAddYears_int_dstOverlapWinter_addZero", "total_lines": 2 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestMutableDateTime_Adds::testAddDays_int_dstOverlapWinter_addZe...
866
Time
3
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 2852608688135209575L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final int ROUND_NONE = 0;", "type": "int"...
{ "body": "public void addWeeks(final int weeks) {\n if (weeks != 0) {\n setMillis(getChronology().weeks().add(getMillis(), weeks));\n }\n }", "class_method_signature": "MutableDateTime.addWeeks(final int weeks)", "constructor": false, "full_signature": "public void addWeeks(final in...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestMutableDateTime_Adds::testAddYears_int_dstOverlapWinter_addZero", "total_lines": 2 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestMutableDateTime_Adds::testAddDays_int_dstOverlapWinter_addZe...
867
Time
3
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 2852608688135209575L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final int ROUND_NONE = 0;", "type": "int"...
{ "body": "public void addYears(final int years) {\n if (years != 0) {\n setMillis(getChronology().years().add(getMillis(), years));\n }\n }", "class_method_signature": "MutableDateTime.addYears(final int years)", "constructor": false, "full_signature": "public void addYears(final in...
[ { "covered_lines": 2, "line_coverage": 1, "name": "org.joda.time.TestMutableDateTime_Adds::testAddYears_int_dstOverlapWinter_addZero", "total_lines": 2 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestMutableDateTime_Adds::testAddDays_int_dstOverlapWinter_addZe...
868
Time
4
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 12324121189002L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private final Chronology iChronology;", "type": "Chronology"...
{ "body": "public Partial with(DateTimeFieldType fieldType, int value) {\n if (fieldType == null) {\n throw new IllegalArgumentException(\"The field type must not be null\");\n }\n int index = indexOf(fieldType);\n if (index == -1) {\n DateTimeFieldType[] newTypes = n...
[ { "covered_lines": 28, "line_coverage": 0.8, "name": "org.joda.time.TestPartial_Basics::testWith3", "total_lines": 35 } ]
869
Time
5
{ "fields": [ { "modifier": "", "original_string": "public static final Period ZERO = new Period();", "type": "Period", "var_name": "ZERO" }, { "modifier": "", "original_string": "private static final long serialVersionUID = 741052353876488155L;", "type": "long", ...
{ "body": "public Period normalizedStandard(PeriodType type) {\n type = DateTimeUtils.getPeriodType(type);\n long millis = getMillis(); // no overflow can happen, even with Integer.MAX_VALUEs\n millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND));\n millis += (...
[ { "covered_lines": 15, "line_coverage": 0.8333, "name": "org.joda.time.TestPeriod_Basics::testNormalizedStandard_periodType_months1", "total_lines": 18 }, { "covered_lines": 15, "line_coverage": 0.8333, "name": "org.joda.time.TestPeriod_Basics::testNormalizedStandard_periodType_month...
870
Time
6
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -2545574827706931671L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "static final Instant DEFAULT_CUTOVER = new Instant(-12219292...
{ "body": "public static synchronized GJChronology getInstance(\n DateTimeZone zone,\n ReadableInstant gregorianCutover,\n int minDaysInFirstWeek) {\n \n zone = DateTimeUtils.getZone(zone);\n Instant cutoverInstant;\n if (gregorianCutover == null) {\n ...
[ { "covered_lines": 19, "line_coverage": 0.7917, "name": "org.joda.time.chrono.TestGJDate::test_cutoverPreZero", "total_lines": 24 }, { "covered_lines": 15, "line_coverage": 0.625, "name": "org.joda.time.chrono.TestGJDate::test_plusWeekyears_positiveToNegative_crossCutover", "tota...
871
Time
7
{ "fields": [ { "modifier": "", "original_string": "private final DateTimePrinter iPrinter;", "type": "DateTimePrinter", "var_name": "iPrinter" }, { "modifier": "", "original_string": "private final DateTimeParser iParser;", "type": "DateTimeParser", "var_na...
{ "body": "public int parseInto(ReadWritableInstant instant, String text, int position) {\n DateTimeParser parser = requireParser();\n if (instant == null) {\n throw new IllegalArgumentException(\"Instant must not be null\");\n }\n \n long instantMillis = instant.getMilli...
[ { "covered_lines": 10, "line_coverage": 0.4762, "name": "org.joda.time.format.TestDateTimeFormatter::testParseInto_monthDay_feb29_newYork_startOfYear", "total_lines": 21 }, { "covered_lines": 10, "line_coverage": 0.4762, "name": "org.joda.time.format.TestDateTimeFormatter::testParseI...
872
Time
8
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public static DateTimeZone forOffsetHoursMinutes(int hoursOffset, int minutesOffset) throws IllegalArgumentException {\n if (hoursOffset == 0 && minutesOffset == 0) {\n return DateTimeZone.UTC;\n }\n if (hoursOffset < -23 || hoursOffset > 23) {\n throw new Illegal...
[ { "covered_lines": 12, "line_coverage": 0.75, "name": "org.joda.time.TestDateTimeZone::testForOffsetHoursMinutes_int_int", "total_lines": 16 } ]
873
Time
9
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public static DateTimeZone forOffsetHoursMinutes(int hoursOffset, int minutesOffset) throws IllegalArgumentException {\n if (hoursOffset == 0 && minutesOffset == 0) {\n return DateTimeZone.UTC;\n }\n if (hoursOffset < -23 || hoursOffset > 23) {\n throw new Illegal...
[ { "covered_lines": 12, "line_coverage": 0.8571, "name": "org.joda.time.TestDateTimeZone::testForOffsetHoursMinutes_int_int", "total_lines": 14 } ]
874
Time
9
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public static DateTimeZone forOffsetMillis(int millisOffset) {\n if (millisOffset < -MAX_MILLIS || millisOffset > MAX_MILLIS) {\n throw new IllegalArgumentException(\"Millis out of range: \" + millisOffset);\n }\n String id = printOffset(millisOffset);\n return fixedO...
[ { "covered_lines": 2, "line_coverage": 1, "name": "org.joda.time.TestDateTimeZone::testForOffsetHoursMinutes_int_int", "total_lines": 2 } ]
875
Time
10
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 9386874258972L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final long START_1972 = 2L * 365L * 86400L * 1000L;"...
{ "body": "protected static int between(ReadablePartial start, ReadablePartial end, ReadablePeriod zeroInstance) {\n if (start == null || end == null) {\n throw new IllegalArgumentException(\"ReadablePartial objects must not be null\");\n }\n if (start.size() != end.size()) {\n ...
[ { "covered_lines": 8, "line_coverage": 0.6667, "name": "org.joda.time.TestDays::testFactory_daysBetween_RPartial_MonthDay", "total_lines": 12 }, { "covered_lines": 8, "line_coverage": 0.6667, "name": "org.joda.time.TestMonths::testFactory_monthsBetween_RPartial_MonthDay", "total_...
876
Time
12
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -8775358157899L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int YEAR = 0;", "type": "int", "v...
{ "body": "public static LocalDate fromCalendarFields(Calendar calendar) {\n if (calendar == null) {\n throw new IllegalArgumentException(\"The calendar must not be null\");\n }\n int era = calendar.get(Calendar.ERA);\n int yearOfEra = calendar.get(Calendar.YEAR);\n retur...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateFields_beforeYearZero1", "total_lines": 6 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateField...
877
Time
12
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -8775358157899L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int YEAR = 0;", "type": "int", "v...
{ "body": "@SuppressWarnings(\"deprecation\")\n public static LocalDate fromDateFields(Date date) {\n if (date == null) {\n throw new IllegalArgumentException(\"The date must not be null\");\n }\n if (date.getTime() < 0) {\n // handle years in era BC\n Gregoria...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateFields_beforeYearZero1", "total_lines": 6 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateField...
878
Time
12
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -268716875315837168L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int YEAR = 0;", "type": "int", ...
{ "body": "public static LocalDateTime fromCalendarFields(Calendar calendar) {\n if (calendar == null) {\n throw new IllegalArgumentException(\"The calendar must not be null\");\n }\n int era = calendar.get(Calendar.ERA);\n int yearOfEra = calendar.get(Calendar.YEAR);\n r...
[ { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateFields_beforeYearZero1", "total_lines": 10 }, { "covered_lines": 0, "line_coverage": 0, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateFiel...
879
Time
12
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -268716875315837168L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int YEAR = 0;", "type": "int", ...
{ "body": "@SuppressWarnings(\"deprecation\")\n public static LocalDateTime fromDateFields(Date date) {\n if (date == null) {\n throw new IllegalArgumentException(\"The date must not be null\");\n }\n if (date.getTime() < 0) {\n // handle years in era BC\n Greg...
[ { "covered_lines": 9, "line_coverage": 0.9, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDateFields_beforeYearZero1", "total_lines": 10 }, { "covered_lines": 9, "line_coverage": 0.9, "name": "org.joda.time.TestLocalDateTime_Constructors::testFactory_fromDate...
880
Time
14
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -8258715387168736L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "private static final int MIN = DateTimeConstants.JANUARY;", ...
{ "body": "public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) {\n // overridden as superclass algorithm can't handle\n // 2004-02-29 + 48 months -> 2008-02-29 type dates\n if (valueToAdd == 0) {\n return values;\n }\n if (partial.size(...
[ { "covered_lines": 5, "line_coverage": 0.5556, "name": "org.joda.time.TestMonthDay_Basics::testPlusMonths_int_negativeFromLeap", "total_lines": 9 }, { "covered_lines": 5, "line_coverage": 0.5556, "name": "org.joda.time.TestMonthDay_Basics::testMinusDays_int_negativeFromLeap", "to...
881
Time
16
{ "fields": [ { "modifier": "", "original_string": "private final DateTimePrinter iPrinter;", "type": "DateTimePrinter", "var_name": "iPrinter" }, { "modifier": "", "original_string": "private final DateTimeParser iParser;", "type": "DateTimeParser", "var_na...
{ "body": "public int parseInto(ReadWritableInstant instant, String text, int position) {\n DateTimeParser parser = requireParser();\n if (instant == null) {\n throw new IllegalArgumentException(\"Instant must not be null\");\n }\n \n long instantMillis = instant.getMilli...
[ { "covered_lines": 14, "line_coverage": 0.7, "name": "org.joda.time.format.TestDateTimeFormatter::testParseInto_monthOnly_baseStartYear", "total_lines": 20 }, { "covered_lines": 14, "line_coverage": 0.7, "name": "org.joda.time.format.TestDateTimeFormatter::testParseInto_monthOnly_par...
882
Time
17
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public long adjustOffset(long instant, boolean earlierOrLater) {\n // a bit messy, but will work in all non-pathological cases\n \n // evaluate 3 hours before and after to work out if anything is happening\n long instantBefore = instant - 3 * DateTimeConstants.MILLIS_PER_HOUR;\n...
[ { "covered_lines": 5, "line_coverage": 0.8333, "name": "org.joda.time.TestDateTimeZoneCutover::testBug3476684_adjustOffset", "total_lines": 6 } ]
883
Time
18
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = -2545574827706931671L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "static final Instant DEFAULT_CUTOVER = new Instant(-12219292...
{ "body": "public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth,\n int hourOfDay, int minuteOfHour,\n int secondOfMinute, int millisOfSecond)\n throws IllegalArgumentException\n {\n Chronology base;\n if ((bas...
[ { "covered_lines": 3, "line_coverage": 0.2727, "name": "org.joda.time.chrono.TestGJChronology::testLeapYearRulesConstruction", "total_lines": 11 } ]
884
Time
19
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public int getOffsetFromLocal(long instantLocal) {\n // get the offset at instantLocal (first estimate)\n final int offsetLocal = getOffset(instantLocal);\n // adjust instantLocal using the estimate and recalc the offset\n final long instantAdjusted = instantLocal - offsetLocal;...
[ { "covered_lines": 6, "line_coverage": 0.3333, "name": "org.joda.time.TestDateTimeZoneCutover::testDateTimeCreation_london", "total_lines": 18 } ]
885
Time
23
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "private static synchronized String getConvertedId(String id) {\n Map<String, String> map = cZoneIdConversion;\n if (map == null) {\n // Backwards compatibility with TimeZone.\n map = new HashMap<String, String>();\n map.put(\"GMT\", \"UTC\");\n map....
[ { "covered_lines": 37, "line_coverage": 1, "name": "org.joda.time.TestDateTimeZone::testForID_String_old", "total_lines": 37 } ]
886
Time
24
{ "fields": [ { "modifier": "", "original_string": "private final Chronology iChrono;", "type": "Chronology", "var_name": "iChrono" }, { "modifier": "", "original_string": "private final long iMillis;", "type": "long", "var_name": "iMillis" }, { ...
{ "body": "public long computeMillis(boolean resetFields, String text) {\n SavedField[] savedFields = iSavedFields;\n int count = iSavedFieldsCount;\n if (iSavedFieldsShared) {\n iSavedFields = savedFields = (SavedField[])iSavedFields.clone();\n iSavedFieldsShared = false;\n...
[ { "covered_lines": 16, "line_coverage": 0.5161, "name": "org.joda.time.format.TestDateTimeFormatter::testParseLocalDate_weekyear_month_week_2010", "total_lines": 31 }, { "covered_lines": 16, "line_coverage": 0.5161, "name": "org.joda.time.format.TestDateTimeFormatter::testParseLocalD...
887
Time
25
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public int getOffsetFromLocal(long instantLocal) {\n // get the offset at instantLocal (first estimate)\n final int offsetLocal = getOffset(instantLocal);\n // adjust instantLocal using the estimate and recalc the offset\n final long instantAdjusted = instantLocal - offsetLocal;...
[ { "covered_lines": 5, "line_coverage": 0.5, "name": "org.joda.time.TestDateTimeZoneCutover::test_DateTime_constructor_Moscow_Autumn", "total_lines": 10 }, { "covered_lines": 5, "line_coverage": 0.5, "name": "org.joda.time.TestDateTimeZoneCutover::test_getOffsetFromLocal_Moscow_Autumn...
888
Time
26
{ "fields": [ { "modifier": "", "original_string": "private static final long serialVersionUID = 5546345482340108586L;", "type": "long", "var_name": "serialVersionUID" }, { "modifier": "", "original_string": "public static final DateTimeZone UTC = new FixedDateTimeZone(...
{ "body": "public long convertLocalToUTC(long instantLocal, boolean strict, long originalInstantUTC) {\n int offsetOriginal = getOffset(originalInstantUTC);\n long instantUTC = instantLocal - offsetOriginal;\n int offsetLocalFromOriginal = getOffset(instantUTC);\n if (offsetLocalFromOrigin...
[ { "covered_lines": 6, "line_coverage": 0.3, "name": "org.joda.time.TestDateTimeZoneCutover::testWithSecondOfMinuteInDstChange", "total_lines": 20 }, { "covered_lines": 6, "line_coverage": 0.3, "name": "org.joda.time.TestDateTimeZoneCutover::testWithMinuteOfHourInDstChange", "tota...
889
Time
27
{ "fields": [ { "modifier": "", "original_string": "private static final int PRINT_ZERO_RARELY_FIRST = 1;", "type": "int", "var_name": "PRINT_ZERO_RARELY_FIRST" }, { "modifier": "", "original_string": "private static final int PRINT_ZERO_RARELY_LAST = 2;", "type":...
{ "body": "private static PeriodFormatter toFormatter(List<Object> elementPairs, boolean notPrinter, boolean notParser) {\n if (notPrinter && notParser) {\n throw new IllegalStateException(\"Builder has created neither a printer nor a parser\");\n }\n int size = elementPairs.size();\n ...
[ { "covered_lines": 11, "line_coverage": 0.7857, "name": "org.joda.time.format.TestPeriodFormatterBuilder::testBug2495455", "total_lines": 14 } ]