Skip to content

Commit 1c1f6dc

Browse files
committed
Added comments and renamed methods
1 parent 3d5fe3c commit 1c1f6dc

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

utbot-sample/src/main/java/guava/examples/math/Stats.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class Stats implements Serializable {
2727
private final double max;
2828

2929
/**
30-
* Internal constructor. Users should use {@link #of} or {@link StatsAccumulator#snapshot}.
30+
* Internal constructor. Users should use {@link #ofIterable} or {@link StatsAccumulator#snapshot}.
3131
*
3232
* <p>To ensure that the created instance obeys its contract, the parameters should satisfy the
3333
* following constraints. This is the callers responsibility and is not enforced here.
@@ -54,7 +54,7 @@ public final class Stats implements Serializable {
5454
* @param values a series of values, which will be converted to {@code double} values (this may
5555
* cause loss of precision)
5656
*/
57-
public static Stats of(Iterable<? extends Number> values) {
57+
public static Stats ofIterable(Iterable<? extends Number> values) {
5858
StatsAccumulator accumulator = new StatsAccumulator();
5959
accumulator.addAll(values);
6060
return accumulator.snapshot();
@@ -66,7 +66,7 @@ public static Stats of(Iterable<? extends Number> values) {
6666
* @param values a series of values, which will be converted to {@code double} values (this may
6767
* cause loss of precision)
6868
*/
69-
public static Stats of5(Iterator<? extends Number> values) {
69+
public static Stats ofIterator(Iterator<? extends Number> values) {
7070
StatsAccumulator accumulator = new StatsAccumulator();
7171
accumulator.addAll(values);
7272
return accumulator.snapshot();
@@ -77,7 +77,7 @@ public static Stats of5(Iterator<? extends Number> values) {
7777
*
7878
* @param values a series of values
7979
*/
80-
public static Stats of1(double... values) {
80+
public static Stats ofDoubles(double... values) {
8181
StatsAccumulator acummulator = new StatsAccumulator();
8282
acummulator.addAll(values);
8383
return acummulator.snapshot();
@@ -88,7 +88,7 @@ public static Stats of1(double... values) {
8888
*
8989
* @param values a series of values
9090
*/
91-
public static Stats of2(int... values) {
91+
public static Stats ofInts(int... values) {
9292
StatsAccumulator acummulator = new StatsAccumulator();
9393
acummulator.addAll(values);
9494
return acummulator.snapshot();
@@ -100,7 +100,7 @@ public static Stats of2(int... values) {
100100
* @param values a series of values, which will be converted to {@code double} values (this may
101101
* cause loss of precision for longs of magnitude over 2^53 (slightly over 9e15))
102102
*/
103-
public static Stats of3(long... values) {
103+
public static Stats ofLongs(long... values) {
104104
StatsAccumulator acummulator = new StatsAccumulator();
105105
acummulator.addAll(values);
106106
return acummulator.snapshot();

utbot-summary-tests/src/test/kotlin/math/SummaryOfMath.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import org.junit.jupiter.api.Test
66
import org.utbot.examples.DoNotCalculate
77
import org.utbot.framework.plugin.api.MockStrategyApi
88

9+
/**
10+
* It runs test generation for the poor analogue of the Stats.of method ported from the guava-26.0 framework
11+
* and validates generated docs, display names and test method names.
12+
*
13+
* @see <a href="https://github.com/UnitTestBot/UTBotJava/issues/198">Related issue</a>
14+
*/
915
class SummaryOfMath : SummaryTestCaseGeneratorTest(
1016
Stats::class,
1117
) {
@@ -43,7 +49,7 @@ class SummaryOfMath : SummaryTestCaseGeneratorTest(
4349
val displayName3 = "addAll -> return new Stats(count, mean, sumOfSquaresOfDeltas, min, max)"
4450
val displayName4 = "addAll -> return new Stats(count, mean, sumOfSquaresOfDeltas, min, max)"
4551

46-
val method = Stats::of2
52+
val method = Stats::ofInts
4753
val mockStrategy = MockStrategyApi.NO_MOCKS
4854
val coverage = DoNotCalculate
4955

0 commit comments

Comments
 (0)