Java 类org.junit.experimental.theories.PotentialAssignment.CouldNotGenerateValueException 实例源码

项目:sosiefier    文件:Assignments.java   
public Object[] getActualValues(int start, int stop) 
        throws CouldNotGenerateValueException {
    Object[] values = new Object[stop - start];
    for (int i = start; i < stop; i++) {
        values[i - start] = fAssigned.get(i).getValue();
    }
    return values;
}
项目:sosiefier    文件:Assignments.java   
public Object[] getArgumentStrings(boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[fAssigned.size()];
    for (int i = 0; i < values.length; i++) {
        values[i] = fAssigned.get(i).getDescription();
    }
    return values;
}
项目:sosiefier    文件:PotentialAssignmentTest.java   
@Test
public void shouldUseQuotedValueInDescription() throws CouldNotGenerateValueException {
    String name = "stringDatapoint";
    Object value = new Object() {
        @Override
        public String toString() {
            return "string value";
        }
    };

    PotentialAssignment assignment = PotentialAssignment.forValue(name, value);

    assertEquals("\"string value\" <from stringDatapoint>", assignment.getDescription());
}
项目:sosiefier    文件:PotentialAssignmentTest.java   
@Test
public void shouldNotUseQuotesForNullValueDescriptions() throws CouldNotGenerateValueException {
    String name = "nullDatapoint";
    Object value = null;

    PotentialAssignment assignment = PotentialAssignment.forValue(name, value);

    assertEquals("null <from nullDatapoint>", assignment.getDescription());
}
项目:sosiefier    文件:PotentialAssignmentTest.java   
@Test
public void shouldIncludeFailureInDescriptionIfToStringFails() throws CouldNotGenerateValueException {
    String name = "explodingValue";
    Object value = new Object() {
        @Override
        public String toString() {
            throw new RuntimeException("Oh no!");
        }
    };

    PotentialAssignment assignment = PotentialAssignment.forValue(name, value);

    assertEquals("[toString() threw RuntimeException: Oh no!] <from explodingValue>", assignment.getDescription());
}
项目:sosiefier    文件:SpecificDataPointsSupplierTest.java   
private List<String> getStringValuesFromAssignments(List<PotentialAssignment> assignments) throws CouldNotGenerateValueException {
    List<String> stringValues = new ArrayList<String>();
    for (PotentialAssignment assignment : assignments) {
        stringValues.add((String) assignment.getValue());
    }
    return stringValues;
}
项目:lcm    文件:Theories.java   
private Statement methodCompletesWithParameters(
        final FrameworkMethod method, final Assignments complete, final Object freshInstance) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            try {
                final Object[] values = complete.getMethodArguments(
                        nullsOk());
                method.invokeExplosively(freshInstance, values);
            } catch (CouldNotGenerateValueException e) {
                // ignore
            }
        }
    };
}
项目:lcm    文件:Assignments.java   
public Object[] getActualValues(int start, int stop, boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[stop - start];
    for (int i = start; i < stop; i++) {
        Object value = fAssigned.get(i).getValue();
        if (value == null && !nullsOk) {
            throw new CouldNotGenerateValueException();
        }
        values[i - start] = value;
    }
    return values;
}
项目:lcm    文件:Assignments.java   
public Object[] getArgumentStrings(boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[fAssigned.size()];
    for (int i = 0; i < values.length; i++) {
        values[i] = fAssigned.get(i).getDescription();
    }
    return values;
}
项目:junit    文件:Theories.java   
private Statement methodCompletesWithParameters(
        final FrameworkMethod method, final Assignments complete, final Object freshInstance) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            try {
                final Object[] values = complete.getMethodArguments(
                        nullsOk());
                method.invokeExplosively(freshInstance, values);
            } catch (CouldNotGenerateValueException e) {
                // ignore
            }
        }
    };
}
项目:junit    文件:Assignments.java   
public Object[] getActualValues(int start, int stop, boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[stop - start];
    for (int i = start; i < stop; i++) {
        Object value = fAssigned.get(i).getValue();
        if (value == null && !nullsOk) {
            throw new CouldNotGenerateValueException();
        }
        values[i - start] = value;
    }
    return values;
}
项目:junit    文件:Assignments.java   
public Object[] getArgumentStrings(boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[fAssigned.size()];
    for (int i = 0; i < values.length; i++) {
        values[i] = fAssigned.get(i).getDescription();
    }
    return values;
}
项目:org.openntf.domino    文件:Theories.java   
private Statement methodCompletesWithParameters(
        final FrameworkMethod method, final Assignments complete, final Object freshInstance) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            try {
                final Object[] values = complete.getMethodArguments(
                        nullsOk());
                method.invokeExplosively(freshInstance, values);
            } catch (CouldNotGenerateValueException e) {
                // ignore
            }
        }
    };
}
项目:org.openntf.domino    文件:Assignments.java   
public Object[] getActualValues(int start, int stop, boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[stop - start];
    for (int i = start; i < stop; i++) {
        Object value = fAssigned.get(i).getValue();
        if (value == null && !nullsOk) {
            throw new CouldNotGenerateValueException();
        }
        values[i - start] = value;
    }
    return values;
}
项目:org.openntf.domino    文件:Assignments.java   
public Object[] getArgumentStrings(boolean nullsOk)
        throws CouldNotGenerateValueException {
    Object[] values = new Object[fAssigned.size()];
    for (int i = 0; i < values.length; i++) {
        values[i] = fAssigned.get(i).getDescription();
    }
    return values;
}
项目:sosiefier    文件:Assignments.java   
public Object[] getConstructorArguments()
        throws CouldNotGenerateValueException {
    return getActualValues(0, getConstructorParameterCount());
}
项目:sosiefier    文件:Assignments.java   
public Object[] getMethodArguments() throws CouldNotGenerateValueException {
    return getActualValues(getConstructorParameterCount(), fAssigned.size());
}
项目:sosiefier    文件:Assignments.java   
public Object[] getAllArguments() throws CouldNotGenerateValueException {
    return getActualValues(0, fAssigned.size());
}
项目:sosiefier    文件:PotentialAssignmentTest.java   
@Test
public void shouldReturnGivenValue() throws CouldNotGenerateValueException {
    Object value = new Object();
    PotentialAssignment assignment = PotentialAssignment.forValue("name", value);
    assertEquals(value, assignment.getValue());
}
项目:lcm    文件:Assignments.java   
public Object[] getConstructorArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(0, getConstructorParameterCount(), nullsOk);
}
项目:lcm    文件:Assignments.java   
public Object[] getMethodArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(getConstructorParameterCount(),
            fAssigned.size(), nullsOk);
}
项目:lcm    文件:Assignments.java   
public Object[] getAllArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(0, fAssigned.size(), nullsOk);
}
项目:junit    文件:Assignments.java   
public Object[] getConstructorArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(0, getConstructorParameterCount(), nullsOk);
}
项目:junit    文件:Assignments.java   
public Object[] getMethodArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(getConstructorParameterCount(),
            fAssigned.size(), nullsOk);
}
项目:junit    文件:Assignments.java   
public Object[] getAllArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(0, fAssigned.size(), nullsOk);
}
项目:org.openntf.domino    文件:Assignments.java   
public Object[] getConstructorArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(0, getConstructorParameterCount(), nullsOk);
}
项目:org.openntf.domino    文件:Assignments.java   
public Object[] getMethodArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(getConstructorParameterCount(),
            fAssigned.size(), nullsOk);
}
项目:org.openntf.domino    文件:Assignments.java   
public Object[] getAllArguments(boolean nullsOk)
        throws CouldNotGenerateValueException {
    return getActualValues(0, fAssigned.size(), nullsOk);
}