本文整理了Java中junitparams.Parameters.<init>()
方法的一些代码示例,展示了Parameters.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameters.<init>()
方法的具体详情如下:
包路径:junitparams.Parameters
类名称:Parameters
方法名:<init>
暂无
代码示例来源:origin: PipelineAI/pipeline
@Test
@Parameters(method = "classGenericDefinitionSuccess")
public void testClassGenericDefinitionSuccess(Class<?> type) {
testXKindGenericDefinitionSuccess(type);
}
代码示例来源:origin: PipelineAI/pipeline
@Test
@Parameters(method = "methodGenericDefinitionSuccess")
public void testMethodGenericDefinitionSuccess(Class<?> type) {
testXKindGenericDefinitionSuccess(type);
}
代码示例来源:origin: apache/incubator-druid
@Test
@Parameters
public void testApply(DimensionSpec dimensionSpec, Map<String, String> map)
{
for (Map.Entry<String, String> entry : map.entrySet()) {
Assert.assertEquals(
NullHandling.emptyToNullIfNeeded(entry.getValue()),
dimensionSpec.getExtractionFn().apply(entry.getKey())
);
}
}
代码示例来源:origin: apache/geode
@Test
@Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
public void repeatUntilValue_throwsIfValueIsNeverTrue(Execution execution) {
boolean expectedVal = true;
retVal.set(false);
concurrencyRule.add(callWithEventuallyCorrectRetVal)
.repeatUntilValue(expectedVal)
.repeatForDuration(Duration.ofSeconds(2));
assertThatThrownBy(() -> execution.execute(concurrencyRule))
.isInstanceOf(ComparisonFailure.class);
assertThat(invoked.get()).isTrue();
}
代码示例来源:origin: apache/geode
@Test
@Parameters(method = "getCommands")
public void whenLastReceivedIsSetThenCheckAndSetLastResultSentIfValidMustNotSetIt(
BaseCommand baseCommand) {
ServerToClientFunctionResultSender resultSender =
mock(ServerToClientFunctionResultSender.class);
when(resultSender.isLastResultReceived()).thenReturn(true);
baseCommand.setLastResultReceived(resultSender);
verify(resultSender, times(0)).setLastResultReceived(true);
}
代码示例来源:origin: apache/geode
@Test
@Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
public void runAndExpectException_throwableInstance_wrongClass_fails(Execution execution) {
Callable<?> callable = () -> {
throw new IllegalArgumentException("foo");
};
concurrencyRule.add(callable).expectException(new NullPointerException("foo"));
assertThatThrownBy(() -> execution.execute(concurrencyRule))
.isInstanceOf(AssertionError.class);
}
代码示例来源:origin: apache/incubator-druid
@Test
@Parameters
public void testGetCacheKey(DimensionSpec dimensionSpec, boolean expectedResult)
{
Assert.assertEquals(expectedResult, Arrays.equals(lookupDimSpec.getCacheKey(), dimensionSpec.getCacheKey()));
}
代码示例来源:origin: apache/geode
@Test
@Parameters(source = FieldType.class)
public void readWritesFieldGivenPdxFieldType(FieldType fieldType) throws Exception {
setupResultSet(resultSet, fieldType);
when(resultSet.next()).thenReturn(true).thenReturn(false);
PdxInstanceFactory factory = setupPdxInstanceFactory(fieldType);
when(regionMapping.getFieldNameForColumn(eq(COLUMN_NAME_1), any()))
.thenReturn(PDX_FIELD_NAME_1);
createPdxInstance();
verifyPdxFactoryWrite(factory, fieldType);
verify(factory).create();
}
代码示例来源:origin: apache/geode
@Test
@Parameters(method = "getCommands")
public void whenLastReceivedIsNotSetThenCheckAndSetLastResultSentIfValidMustReturnFalse(
BaseCommand baseCommand) {
ServerToClientFunctionResultSender resultSender =
mock(ServerToClientFunctionResultSender.class);
when(resultSender.isLastResultReceived()).thenReturn(false);
assertTrue(baseCommand.setLastResultReceived(resultSender));
}
代码示例来源:origin: apache/geode
@Test
@Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
public void runAndExpectValueRepeatedly_failsIfExceptionIsThrown(Execution execution) {
concurrencyRule.add(callWithOneExceptionAndRepeatCount).expectValue(expectedRetVal)
.repeatForIterations(5);
assertThatThrownBy(() -> execution.execute(concurrencyRule))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining(expectedException.getMessage());
assertThat(iterations.get()).isEqualTo(stopIteration);
}
代码示例来源:origin: apache/geode
@Test
@Parameters({MAC_OSX_NAME, LINUX_OS_NAME, SOLARIS_OS_NAME, WINDOWS_OS_NAME})
public void shouldUseComputerNameIfAvailableOnOS(String osName) throws IOException {
setHostNameProperties(osName);
String result = new HostName().determineHostName();
assertThat(result).isEqualTo(EXPECTED_HOSTNAME);
}
代码示例来源:origin: apache/geode
@Test
@Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
public void runAndExpectExceptionAndCauseTypes_wrongCauseTypeFails(Execution execution) {
concurrencyRule.add(callWithExceptionAndCause)
.expectExceptionType(expectedExceptionWithCause.getClass())
.expectExceptionCauseType(IllegalStateException.class);
assertThatThrownBy(() -> execution.execute(concurrencyRule)).isInstanceOf(AssertionError.class);
}
代码示例来源:origin: PipelineAI/pipeline
@Test(expected = FallbackDefinitionException.class)
@Parameters(method = "methodGenericDefinitionFailure")
public void testMethodGenericDefinitionFailure(Class<?> type) {
Object p = createProxy(type);
executeCommand(p);
}
代码示例来源:origin: PipelineAI/pipeline
@Test(expected = FallbackDefinitionException.class)
@Parameters(method = "classGenericDefinitionFailure")
public void testClassGenericDefinitionFailure(Class<?> type) {
Object p = createProxy(type);
executeCommand(p);
}
代码示例来源:origin: apache/incubator-druid
@Parameters
@Test
public void testSerDesr(DimensionSpec lookupDimSpec) throws IOException
{
ObjectMapper mapper = new DefaultObjectMapper();
mapper.registerSubtypes(new NamedType(LookupDimensionSpec.class, "lookup"));
InjectableValues injectableValues = new InjectableValues.Std().addValue(
LookupReferencesManager.class,
LOOKUP_REF_MANAGER
);
String serLookup = mapper.writeValueAsString(lookupDimSpec);
Assert.assertEquals(lookupDimSpec, mapper.readerFor(DimensionSpec.class).with(injectableValues).readValue(serLookup));
}
代码示例来源:origin: apache/geode
@Test
@Parameters(method = "getCompiledValuesWhichDoNotImplementGetReceiver")
public void whenGetReceiverIsNotImplementedThenHasIdentifierAtLeafMustReturnFalse(
CompiledValue compiledValue) {
assertFalse(compiledValue.hasIdentifierAtLeafNode());
}
代码示例来源:origin: apache/geode
@Test
@Parameters(method = "getCompiledValuesWhichImplementGetReceiver")
public void whenGetReceiverIsImplementedThenHasIdentifierAtLeafMustReturnTrue(
CompiledValue compiledValue) {
assertTrue(compiledValue.hasIdentifierAtLeafNode());
}
代码示例来源:origin: apache/geode
@Test
@Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
public void runAndExpectExceptionAndCauseTypes(Execution execution) {
concurrencyRule.add(callWithExceptionAndCause)
.expectExceptionType(expectedExceptionWithCause.getClass())
.expectExceptionCauseType(expectedExceptionWithCause.getCause().getClass());
execution.execute(concurrencyRule);
}
代码示例来源:origin: apache/geode
@Test
@Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
public void runAndExpectExceptionCauseType(Execution execution) {
concurrencyRule.add(callWithExceptionAndCause)
.expectExceptionCauseType(expectedExceptionWithCause.getCause().getClass());
execution.execute(concurrencyRule);
}
代码示例来源:origin: apache/geode
@Test
@Parameters({MAC_OSX_NAME, LINUX_OS_NAME, SOLARIS_OS_NAME, WINDOWS_OS_NAME})
public void shouldExecHostNameIfEnvValueNotAvailableOnOS(String osName) throws IOException {
setHostNamePropertiesNull(osName);
String result = new HostName().determineHostName();
assertThat(result).isNotNull();
}
内容来源于网络,如有侵权,请联系作者删除!