junitparams.Parameters.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中junitparams.Parameters.<init>()方法的一些代码示例,展示了Parameters.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parameters.<init>()方法的具体详情如下:
包路径:junitparams.Parameters
类名称:Parameters
方法名:<init>

Parameters.<init>介绍

暂无

代码示例

代码示例来源:origin: PipelineAI/pipeline

  1. @Test
  2. @Parameters(method = "classGenericDefinitionSuccess")
  3. public void testClassGenericDefinitionSuccess(Class<?> type) {
  4. testXKindGenericDefinitionSuccess(type);
  5. }

代码示例来源:origin: PipelineAI/pipeline

  1. @Test
  2. @Parameters(method = "methodGenericDefinitionSuccess")
  3. public void testMethodGenericDefinitionSuccess(Class<?> type) {
  4. testXKindGenericDefinitionSuccess(type);
  5. }

代码示例来源:origin: apache/incubator-druid

  1. @Test
  2. @Parameters
  3. public void testApply(DimensionSpec dimensionSpec, Map<String, String> map)
  4. {
  5. for (Map.Entry<String, String> entry : map.entrySet()) {
  6. Assert.assertEquals(
  7. NullHandling.emptyToNullIfNeeded(entry.getValue()),
  8. dimensionSpec.getExtractionFn().apply(entry.getKey())
  9. );
  10. }
  11. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
  3. public void repeatUntilValue_throwsIfValueIsNeverTrue(Execution execution) {
  4. boolean expectedVal = true;
  5. retVal.set(false);
  6. concurrencyRule.add(callWithEventuallyCorrectRetVal)
  7. .repeatUntilValue(expectedVal)
  8. .repeatForDuration(Duration.ofSeconds(2));
  9. assertThatThrownBy(() -> execution.execute(concurrencyRule))
  10. .isInstanceOf(ComparisonFailure.class);
  11. assertThat(invoked.get()).isTrue();
  12. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters(method = "getCommands")
  3. public void whenLastReceivedIsSetThenCheckAndSetLastResultSentIfValidMustNotSetIt(
  4. BaseCommand baseCommand) {
  5. ServerToClientFunctionResultSender resultSender =
  6. mock(ServerToClientFunctionResultSender.class);
  7. when(resultSender.isLastResultReceived()).thenReturn(true);
  8. baseCommand.setLastResultReceived(resultSender);
  9. verify(resultSender, times(0)).setLastResultReceived(true);
  10. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
  3. public void runAndExpectException_throwableInstance_wrongClass_fails(Execution execution) {
  4. Callable<?> callable = () -> {
  5. throw new IllegalArgumentException("foo");
  6. };
  7. concurrencyRule.add(callable).expectException(new NullPointerException("foo"));
  8. assertThatThrownBy(() -> execution.execute(concurrencyRule))
  9. .isInstanceOf(AssertionError.class);
  10. }

代码示例来源:origin: apache/incubator-druid

  1. @Test
  2. @Parameters
  3. public void testGetCacheKey(DimensionSpec dimensionSpec, boolean expectedResult)
  4. {
  5. Assert.assertEquals(expectedResult, Arrays.equals(lookupDimSpec.getCacheKey(), dimensionSpec.getCacheKey()));
  6. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters(source = FieldType.class)
  3. public void readWritesFieldGivenPdxFieldType(FieldType fieldType) throws Exception {
  4. setupResultSet(resultSet, fieldType);
  5. when(resultSet.next()).thenReturn(true).thenReturn(false);
  6. PdxInstanceFactory factory = setupPdxInstanceFactory(fieldType);
  7. when(regionMapping.getFieldNameForColumn(eq(COLUMN_NAME_1), any()))
  8. .thenReturn(PDX_FIELD_NAME_1);
  9. createPdxInstance();
  10. verifyPdxFactoryWrite(factory, fieldType);
  11. verify(factory).create();
  12. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters(method = "getCommands")
  3. public void whenLastReceivedIsNotSetThenCheckAndSetLastResultSentIfValidMustReturnFalse(
  4. BaseCommand baseCommand) {
  5. ServerToClientFunctionResultSender resultSender =
  6. mock(ServerToClientFunctionResultSender.class);
  7. when(resultSender.isLastResultReceived()).thenReturn(false);
  8. assertTrue(baseCommand.setLastResultReceived(resultSender));
  9. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
  3. public void runAndExpectValueRepeatedly_failsIfExceptionIsThrown(Execution execution) {
  4. concurrencyRule.add(callWithOneExceptionAndRepeatCount).expectValue(expectedRetVal)
  5. .repeatForIterations(5);
  6. assertThatThrownBy(() -> execution.execute(concurrencyRule))
  7. .isInstanceOf(IllegalStateException.class)
  8. .hasMessageContaining(expectedException.getMessage());
  9. assertThat(iterations.get()).isEqualTo(stopIteration);
  10. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({MAC_OSX_NAME, LINUX_OS_NAME, SOLARIS_OS_NAME, WINDOWS_OS_NAME})
  3. public void shouldUseComputerNameIfAvailableOnOS(String osName) throws IOException {
  4. setHostNameProperties(osName);
  5. String result = new HostName().determineHostName();
  6. assertThat(result).isEqualTo(EXPECTED_HOSTNAME);
  7. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
  3. public void runAndExpectExceptionAndCauseTypes_wrongCauseTypeFails(Execution execution) {
  4. concurrencyRule.add(callWithExceptionAndCause)
  5. .expectExceptionType(expectedExceptionWithCause.getClass())
  6. .expectExceptionCauseType(IllegalStateException.class);
  7. assertThatThrownBy(() -> execution.execute(concurrencyRule)).isInstanceOf(AssertionError.class);
  8. }

代码示例来源:origin: PipelineAI/pipeline

  1. @Test(expected = FallbackDefinitionException.class)
  2. @Parameters(method = "methodGenericDefinitionFailure")
  3. public void testMethodGenericDefinitionFailure(Class<?> type) {
  4. Object p = createProxy(type);
  5. executeCommand(p);
  6. }

代码示例来源:origin: PipelineAI/pipeline

  1. @Test(expected = FallbackDefinitionException.class)
  2. @Parameters(method = "classGenericDefinitionFailure")
  3. public void testClassGenericDefinitionFailure(Class<?> type) {
  4. Object p = createProxy(type);
  5. executeCommand(p);
  6. }

代码示例来源:origin: apache/incubator-druid

  1. @Parameters
  2. @Test
  3. public void testSerDesr(DimensionSpec lookupDimSpec) throws IOException
  4. {
  5. ObjectMapper mapper = new DefaultObjectMapper();
  6. mapper.registerSubtypes(new NamedType(LookupDimensionSpec.class, "lookup"));
  7. InjectableValues injectableValues = new InjectableValues.Std().addValue(
  8. LookupReferencesManager.class,
  9. LOOKUP_REF_MANAGER
  10. );
  11. String serLookup = mapper.writeValueAsString(lookupDimSpec);
  12. Assert.assertEquals(lookupDimSpec, mapper.readerFor(DimensionSpec.class).with(injectableValues).readValue(serLookup));
  13. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters(method = "getCompiledValuesWhichDoNotImplementGetReceiver")
  3. public void whenGetReceiverIsNotImplementedThenHasIdentifierAtLeafMustReturnFalse(
  4. CompiledValue compiledValue) {
  5. assertFalse(compiledValue.hasIdentifierAtLeafNode());
  6. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters(method = "getCompiledValuesWhichImplementGetReceiver")
  3. public void whenGetReceiverIsImplementedThenHasIdentifierAtLeafMustReturnTrue(
  4. CompiledValue compiledValue) {
  5. assertTrue(compiledValue.hasIdentifierAtLeafNode());
  6. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
  3. public void runAndExpectExceptionAndCauseTypes(Execution execution) {
  4. concurrencyRule.add(callWithExceptionAndCause)
  5. .expectExceptionType(expectedExceptionWithCause.getClass())
  6. .expectExceptionCauseType(expectedExceptionWithCause.getCause().getClass());
  7. execution.execute(concurrencyRule);
  8. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({"EXECUTE_IN_SERIES", "EXECUTE_IN_PARALLEL"})
  3. public void runAndExpectExceptionCauseType(Execution execution) {
  4. concurrencyRule.add(callWithExceptionAndCause)
  5. .expectExceptionCauseType(expectedExceptionWithCause.getCause().getClass());
  6. execution.execute(concurrencyRule);
  7. }

代码示例来源:origin: apache/geode

  1. @Test
  2. @Parameters({MAC_OSX_NAME, LINUX_OS_NAME, SOLARIS_OS_NAME, WINDOWS_OS_NAME})
  3. public void shouldExecHostNameIfEnvValueNotAvailableOnOS(String osName) throws IOException {
  4. setHostNamePropertiesNull(osName);
  5. String result = new HostName().determineHostName();
  6. assertThat(result).isNotNull();
  7. }

相关文章

Parameters类方法