GeezerVison is showing github.com — Added the wrapper for static methods of java.util.List by Damtev · Pull Request #400 · UnitTestBot/UTBotJava
Added the wrapper for static methods of java.util.List
#400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.java
(2)
.kt
(1)
All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
@@ -0,0 +1,72 @@
package org.utbot.engine.overrides.collections;
import org.utbot.api.annotation.UtClassMock;
import java.util.Collection;
@UtClassMock(target = java.util.List.class, internalUsage = true)
public interface List<E> extends java.util.List<E> {
static <E> java.util.List<E> of() {
return new UtArrayList<>();
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1) {
return new UtArrayList<>((E[]) new Object[]{e1});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2) {
return new UtArrayList<>((E[]) new Object[]{e1, e2});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4, e5});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4, e5, e6});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4, e5, e6, e7});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4, e5, e6, e7, e8});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4, e5, e6, e7, e8, e9});
}
@SuppressWarnings("unchecked")
static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
return new UtArrayList<>((E[]) new Object[]{e1, e2, e3, e4, e5, e6, e7, e8, e9, e10});
}
@SafeVarargs
@SuppressWarnings("varargs")
static <E> java.util.List<E> of(E... elements) {
return new UtArrayList<>(elements);
}
static <E> java.util.List<E> copyOf(Collection<? extends E> collection) {
return new UtArrayList<>(collection);
}
}
Original file line number
Diff line number
Diff line change
Expand Up
@@ -63,6 +63,14 @@ public UtArrayList(Collection<? extends E> c) {
addAll(c);
}
public UtArrayList(E[] data) {
visit(this);
int length = data.length;
elementData = new RangeModifiableUnlimitedArray<>();
elementData.setRange(0, data, 0, length);
elementData.end = length;
}
/**
* Precondition check is called only once by object,
* if it was passed as parameter to method under test.
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -26,6 +26,7 @@ import org.utbot.engine.overrides.collections.UtHashSet
import org.utbot.engine.overrides.collections.UtLinkedList
import org.utbot.engine.overrides.UtOverrideMock
import org.utbot.engine.overrides.collections.Collection
import org.utbot.engine.overrides.collections.List
import org.utbot.engine.overrides.collections.UtGenericStorage
import org.utbot.engine.overrides.collections.UtOptional
import org.utbot.engine.overrides.collections.UtOptionalDouble
Expand Down
Expand Up
@@ -133,6 +134,7 @@ private val classesToLoad = arrayOf(
UtStringBuffer::class,
Stream::class,
Collection::class,
List::class,
UtStream::class,
UtStream.UtStreamIterator::class
)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.