text stringlengths 171 29.4k |
|---|
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
protected VectorialPointValuePair doOptimize()
throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {
// arrays ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public RealMatrix getCorrelationPValues() throws MathException {
TDistribution tDistribution = new TDistributionImpl(nObs - 2);
int nVars = correlationMatrix.... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected double acceptStep(final AbstractStepInterpolator interpolator,
final double[] y, final double[] yDot, final double tEnd)
thr... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double solve(final UnivariateRealFunction f, double min, double max, double initial)
throws MaxIterationsExceededException, FunctionEvaluationException {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double integrate(final FirstOrderDifferentialEquations equations,
final double t0, final double[] y0,
final double t,... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public double integrate(final FirstOrderDifferentialEquations equations,
final double t0, final double[] y0,
fin... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double solve(final UnivariateRealFunction f,
final double min, final double max, final double initial)
throws MaxIterationsExceededExce... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double solve(final UnivariateRealFunction f,
final double min, final double max, final double initial)
throws MaxIterationsExceededExce... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double integrate(final FirstOrderDifferentialEquations equations,
final double t0, final double[] y0,
final double t,... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double getPct(Object v) {
return getCumPct((Comparable<?>) v);
}
// Test Case
[/INST]
public void testPcts() {
f.addValue(oneL);
f.add... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public RealMatrix getU()
throws InvalidMatrixException {
if (cachedU == null) {
final int p = singularValues.length;
if (m >= n) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double getLInfNorm() {
double max = 0;
Iterator iter = entries.iterator();
while (iter.hasNext()) {
iter.advance();
max... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public double getLInfNorm() {
double max = 0;
for (double a : data) {
max += Math.max(max, Math.abs(a));
}
return ma... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean evaluateStep(final StepInterpolator interpolator)
throws DerivativeException, EventException, ConvergenceException {
try {
forwar... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static double distance(int[] p1, int[] p2) {
int sum = 0;
for (int i = 0; i < p1.length; i++) {
final int dp = p1[i] - p2[i];
sum += dp... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public T[] sample(int sampleSize) throws NotStrictlyPositiveException {
if (sampleSize <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.NUM... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean flipIfWarranted(final int n, final int step) {
if (1.5 * work[pingPong] < work[4 * (n - 1) + pingPong]) {
// flip array
int j ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void computeGershgorinCircles() {
final int m = main.length;
final int lowerStart = 4 * m;
final int upperStart = 5 * m;
lowerSpe... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Integer getPivotRow(final int col, final SimplexTableau tableau) {
double minRatio = Double.MAX_VALUE;
Integer minRatioPos = null;
for (int i ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Integer getBasicRow(final int col, boolean ignoreObjectiveRows) {
Integer row = null;
int start = getNumObjectiveFunctions();
for (int i = sta... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected RealPointValuePair getSolution() {
double[] coefficients = new double[getOriginalNumDecisionVariables()];
Integer negativeVarBasicRow = getBasicRow(getN... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected void iterateSimplex(final Comparator<RealPointValuePair> comparator)
throws FunctionEvaluationException, OptimizationException, IllegalArgumentException {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static double[] bracket(UnivariateRealFunction function,
double initial, double lowerBound, double upperBound,
int maximumIterations) throws C... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public CholeskyDecompositionImpl(final RealMatrix matrix,
final double relativeSymmetryThreshold,
fi... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Integer getBasicRow(final int col) {
Integer row = null;
for (int i = getNumObjectiveFunctions(); i < getHeight(); i++) {
if (!MathUtils.e... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected RealPointValuePair getSolution() {
double[] coefficients = new double[getOriginalNumDecisionVariables()];
Integer basicRow =
getBasicRow... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void addValue(Object v) {
addValue((Comparable<?>) v);
}
// Test Case
[/INST]
public void testAddNonComparable(){
try {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Line revert() {
final Line reverted = new Line(zero, zero.subtract(direction));
return reverted;
}
// Test Case
[/INST]
@Test
public void ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void addValue(Object v) {
/**
* Adds 1 to the frequency count for v.
* <p>
* If other objects have already been added to this Frequency, v must... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public int compareTo(Fraction object) {
double nOd = doubleValue();
double dOn = object.doubleValue();
return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 0... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static long binomialCoefficient(final int n, final int k) {
if (n < k) {
throw new IllegalArgumentException(
"must have n >= k for ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static long factorial(final int n) {
long result = Math.round(factorialDouble(n));
if (result == Long.MAX_VALUE) {
throw new ArithmeticExce... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static int gcd(int u, int v) {
if (u * v == 0) {
return (Math.abs(u) + Math.abs(v));
}
// keep u and v negative, as negative intege... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected double getInitialDomain(double p) {
double ret;
double d = getDenominatorDegreesOfFreedom();
// use mean
ret = d / (d - 2.0)... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean equals(Object other) {
boolean ret;
if (this == other) {
ret = true;
} else if (other == null) {
ret ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double solve(double min, double max) throws MaxIterationsExceededException,
FunctionEvaluationException {
clearResult();
verifyInterv... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public double[] operate(double[] v) throws IllegalArgumentException {
final int nRows = this.getRowDimension();
final int nCols = this.getColumnDimension();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public BigDecimal[] operate(BigDecimal[] v) throws IllegalArgumentException {
if (v.length != this.getColumnDimension()) {
throw new IllegalArgumentExcept... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static int gcd(final int p, final int q) {
int u = p;
int v = q;
if ((u == 0) || (v == 0)) {
return (Math.abs(u) + Math.abs(v));
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static int lcm(int a, int b) {
if (a==0 || b==0){
return 0;
}
int lcm = Math.abs(mulAndCheck(a / gcd(a, b), b));
return lcm... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void captureArgumentsFrom(Invocation invocation) {
if (invocation.getMethod().isVarArgs()) {
int indexOfVararg = invocation.getRawArguments().lengt... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Object deepStub(InvocationOnMock invocation, GenericMetadataSupport returnTypeGenericMetadata) throws Throwable {
InternalMockHandler<Object> handler = new Mo... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Object newDeepStubMock(GenericMetadataSupport returnTypeGenericMetadata) {
return mockitoCore().mock(
returnTypeGenericMetadata.rawType(),
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private MockSettings withSettingsUsing(GenericMetadataSupport returnTypeGenericMetadata) {
MockSettings mockSettings = returnTypeGenericMetadata.hasRawExtraInterfaces... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public boolean equals(Object o) {
return method.equals(o);
}
// Test Case
[/INST]
@Test
public void equals_should_return_true_when_equa... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@Override
public int hashCode() {
return 1;
}
// Test Case
[/INST]
@Test
public void equals_should_return_true_when_equal() throws Exception {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Class getGenericType(Field field) {
Type generic = field.getGenericType();
if (generic != null && generic instanceof ParameterizedType) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object handle(Invocation invocation) throws Throwable {
if (invocationContainerImpl.hasAnswersForStubbing()) {
// stubbing voids with stubVoid() or... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object handle(Invocation invocation) throws Throwable {
if (invocationContainerImpl.hasAnswersForStubbing()) {
// stubbing voids with stubVoid() or... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> T verify(T mock, VerificationMode mode) {
if (mock == null) {
reporter.nullPassedToVerify();
} else if (!mockUtil.isMock(mock)) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public OngoingInjecter filterCandidate(final Collection<Object> mocks, final Field field, final Object fieldInstance) {
if(mocks.size() == 1) {
final Obje... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> T mock(Class<T> classToMock, MockSettings mockSettings, boolean shouldResetOngoingStubbing) { return mock(classToMock, mockSettings); }
// Test Case
[/INST]
@... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> T mock(Class<T> classToMock, MockSettings mockSettings) {
mockingProgress.validateState();
mockingProgress.resetOngoingStubbing();
retu... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static <T> T mock(Class<T> classToMock, MockSettings mockSettings) {
return MOCKITO_CORE.mock(classToMock, mockSettings);
}
// Test Case
[/INST]
@Test... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static <T> T spy(T object) {
return MOCKITO_CORE.mock((Class<T>) object.getClass(), withSettings()
.spiedInstance(object)
.defa... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public MockSettings serializable() {
return this.extraInterfaces(java.io.Serializable.class);
}
// Test Case
[/INST]
@Test
public void shouldBeSerializeA... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> T createMock(Class<T> classToMock, MockSettingsImpl settings) {
creationValidator.validateType(classToMock);
creationValidator.validateExtraInterfa... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean isSerializable() {
return extraInterfaces != null && java.util.Arrays.asList(extraInterfaces).contains(java.io.Serializable.class);
}
// Test Case... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
Object returnValueFor(Class<?> type) {
if (Primitives.isPrimitiveOrWrapper(type)) {
return Primitives.defaultValueForPrimitiveOrWrapper(type);
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
OngoingInjecter filterCandidate(
Collection<Object> mocks,
Field fieldToBeInjected,
Object fieldInstance
);
// Test Case
[/INST]
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public OngoingInjecter filterCandidate(Collection<Object> mocks, Field field, Object fieldInstance) {
List<Object> mockTypeMatches = new ArrayList<Object>();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public OngoingInjecter filterCandidate(Collection<Object> mocks,
Field field, Object fieldInstance) {
List<Object> mockNameMatches = new ArrayList<Object>();
if (mocks.si... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public OngoingInjecter filterCandidate(final Collection<Object> mocks, final Field field, final Object fieldInstance) {
if(mocks.size() == 1) {
final Obje... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean injectMockCandidatesOnFields(Set<Object> mocks, Object instance, boolean injectionOccurred, List<Field> orderedInstanceFields) {
for (Iterator<Field> ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Timer(long durationMillis) {
this.durationMillis = durationMillis;
}
// Test Case
[/INST]
@Test
public void should_throw_friendly_reminder_excepti... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> T createMock(MockCreationSettings<T> settings, MockHandler handler) {
if (settings.getSerializableMode() == SerializableMode.ACROSS_CLASSLOADERS) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> T newInstance(Class<T> cls) {
if (outerClassInstance == null) {
return noArgConstructor(cls);
}
return withOuterClass(cls);
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private <T> T withOuterClass(Class<T> cls) {
try {
//this is kind of overengineered because we don't need to support more params
//however, I ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static boolean areEqual(Object o1, Object o2) {
if (o1 == null || o2 == null) {
return o1 == null && o2 == null;
} else if (isArray(o1)) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object answer(InvocationOnMock invocation) throws Throwable {
GenericMetadataSupport returnTypeGenericMetadata =
actualParameterizedType(invoca... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private MockSettings withSettingsUsing(GenericMetadataSupport returnTypeGenericMetadata) {
MockSettings mockSettings =
returnTypeGenericMetadata.rawEx... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Object recordDeepStubMock(final Object mock, InvocationContainerImpl container) throws Throwable {
container.addAnswer(new Answer<Object>() {
pub... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object answer(InvocationOnMock invocation) {
if (methodsGuru.isToString(invocation.getMethod())) {
Object mock = invocation.getMock();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object answer(InvocationOnMock invocation) throws Throwable {
GenericMetadataSupport returnTypeGenericMetadata =
actualParameterizedType(invoca... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Object getMock(InvocationOnMock invocation) throws Throwable {
InternalMockHandler<Object> handler = new MockUtil().getMockHandler(invocation.getMock());
In... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private Object recordDeepStubMock(InvocationOnMock invocation, InvocationContainerImpl container) {
Class<?> clz = invocation.getMethod().getReturnType();
fin... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
X
// Test Case
[/INST]
@Test
public void should_throw_friendly_reminder_exception_when_duration_is_negative() {
try {
new Timer(-1);
Asse... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public <T> void resetMock(T mock) {
MockHandlerInterface<T> oldMockHandler = getMockHandler(mock);
MockHandler<T> newMockHandler = new MockHandler<T>(oldMockH... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void injectMockCandidate(Class<?> awaitingInjectionClazz, Set<Object> mocks, Object fieldInstance) {
for(Field field : orderedInstanceFieldsFrom(awaitingInjec... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void describeTo(Description description) {
description.appendText("same(");
appendQuoting(description);
description.appendText(wanted.toString(... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void captureArgumentsFrom(Invocation invocation) {
if (invocation.getMethod().isVarArgs()) {
int indexOfVararg = invocation.getRawArguments().lengt... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
if (new ObjectMethodsGuru().isToString(method)) {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void smartNullPointerException(Location location) {
throw new SmartNullPointerException(join(
"You have a NullPointerException here:",
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private String formatMethodCall() {
return invocation.getMethod().getName() + "()";
}
// Test Case
[/INST]
@Test
public void shouldPrintTheParametersWhenCallingAM... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
@SuppressWarnings("deprecation")
public void process(Class<?> context, Object testClass) {
Field[] fields = context.getDeclaredFields();
for (Field field ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public boolean hasSameMethod(Invocation candidate) {
//not using method.equals() for 1 good reason:
//sometimes java generates forwarding methods when... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void captureArgumentsFrom(Invocation i) {
int k = 0;
for (Matcher m : matchers) {
if (m instanceof CapturesArguments) {
((C... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static <T> T isA(Class<T> clazz) {
return reportMatcher(new InstanceOf(clazz)).<T>returnNull();
}
// Test Case
[/INST]
@Test
public void shouldNot... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static <T> T eq(T value) {
return reportMatcher(new Equals(value)).<T>returnNull();
}
// Test Case
[/INST]
@Test
public void shouldNotThrowNPEWh... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static <T> T same(T value) {
return reportMatcher(new Same(value)).<T>returnNull();
}
// Test Case
[/INST]
@Test
public void shouldNotThrowNPEWhen... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Object callRealMethod() throws Throwable {
return realMethod.invoke(mock, rawArguments);
}
// Test Case
[/INST]
@Test
public void shouldScreamWhen... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void validate(Answer<?> answer, Invocation invocation) {
if (answer instanceof ThrowsException) {
validateException((ThrowsException) answer, invoc... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private boolean toStringEquals(Matcher m, Object arg) {
return StringDescription.toString(m).equals(arg.toString());
}
// Test Case
[/INST]
@Test
public ... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void noMoreInteractionsWanted(Invocation undesired, List<VerificationAwareInvocation> invocations) {
ScenarioPrinter scenarioPrinter = new ScenarioPrinter();
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public void verify(VerificationData data) {
AssertionError error = null;
timer.start();
while (timer.isCounting()) {
try {
... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public static boolean anyBoolean() {
return reportMatcher(Any.ANY).returnFalse();
}
// Test Case
[/INST]
@Test
public void shouldNotAcceptNullInAllAnyPri... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
private void readTypeVariables() {
for (Type type : typeVariable.getBounds()) {
registerTypeVariablesOn(type);
}
regis... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
protected void registerTypeVariablesOn(Type classType) {
if (!(classType instanceof ParameterizedType)) {
return;
}
ParameterizedType para... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public class CallsRealMethods implements Answer<Object>, Serializable {
private static final long serialVersionUID = 9057165148930624087L;
public Object answer(Invocatio... |
<s>[INST] <<SYS>>
You are a helpful assistant. Generate a test case that triggers the bug for the buggy function.
<</SYS>>
// Buggy Function
public Partial(DateTimeFieldType[] types, int[] values, Chronology chronology) {
super();
chronology = DateTimeUtils.getChronology(chronology).withUTC();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.