当前位置: 首页>>代码示例>>Java>>正文


Java TestCaseName类代码示例

本文整理汇总了Java中junitparams.naming.TestCaseName的典型用法代码示例。如果您正苦于以下问题:Java TestCaseName类的具体用法?Java TestCaseName怎么用?Java TestCaseName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestCaseName类属于junitparams.naming包,在下文中一共展示了TestCaseName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: should_unwrap_proxy_from_spied_on_instance

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = proxyInterfaceDataProvider)
@TestCaseName("should_unwrap_{0}_from_spied_on_instance")
public void should_unwrap_proxy_from_spied_on_instance(String proxyProviderName, boolean proxyTargetClass) throws ClassNotFoundException {
	//given
	final IService rawService = new Service();
	final String serviceName = "service";
	final DoubleDefinition definition = DoubleDefinition.builder()
			.doubleClass(IService.class)
			.name(serviceName)
			.build();
	final TestContextBuilder.TestContext testContext = new TestContextBuilder()
			.withBean(serviceName, createProxyFactoryBean(rawService, proxyTargetClass))
			.withSpy(definition)
			.build();

	//when
	final Object bean = testContext.applicationContext.getBean(serviceName);
	testContext.toSpyReplacingProcessor.postProcessAfterInitialization(bean, serviceName);

	//then
	assertTrue(AopUtils.isAopProxy(bean));
	Mockito.verify(doubleFactory).createSpy(
			argThat(not(isProxy())),
			eq(definition));
}
 
开发者ID:pchudzik,项目名称:springmock,代码行数:27,代码来源:ToSpyReplacingProcessorTest.java

示例2: equalDecimalsHaveEqualHashCodes

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(source = BinaryDecimalArgumentProvider.class)
@TestCaseName("hashCode check: [{0}, {1}]")
public void equalDecimalsHaveEqualHashCodes(
		final Decimal<ScaleMetrics> first,
		final Decimal<ScaleMetrics> second) {
	// given
	assertEquals(first, second);

	// when
	final int hashCodeFirst = first.hashCode();
	final int hashCodeSecond = second.hashCode();

	// then
	assertEquals(hashCodeFirst, hashCodeSecond);
}
 
开发者ID:tools4j,项目名称:decimal4j,代码行数:17,代码来源:ObjectMethodsOnDecimalsTest.java

示例3: equalDecimalsHaveSameStringRepresentation

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(source = BinaryDecimalArgumentProvider.class)
@TestCaseName("toString() check: [{0}, {1}]")
public void equalDecimalsHaveSameStringRepresentation(
		final Decimal<ScaleMetrics> first,
		final Decimal<ScaleMetrics> second) {
	// given
	assertEquals(first, second);

	// when
	final String stringFirst = first.toString();
	final String stringSecond = second.toString();

	// then
	assertEquals(stringFirst, stringSecond);
}
 
开发者ID:tools4j,项目名称:decimal4j,代码行数:17,代码来源:ObjectMethodsOnDecimalsTest.java

示例4: getKeysReadOnly

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "getTestCases")
@TestCaseName("'getKeysReadOnly' for implementation type: {1}, {2}")
public void getKeysReadOnly(ConfigSource configSource,
                            Class<? extends ConfigSource> configSourceType,
                            String instanceDescription) {

  Set<String> keys = configSource.getKeys();
  try {
    keys.add("abc");
    fail("Expected exception not thrown: " + UnsupportedOperationException.class);
  }
  catch (UnsupportedOperationException ex) {
    // do nothing
  }
}
 
开发者ID:raistlic,项目名称:raistlic-lib-commons-core,代码行数:17,代码来源:ConfigSourceTest.java

示例5: writeConfigWhenOutputStreamThrowsException

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test(expected = ConfigIOException.class)
@Parameters(method = "failedCallCases")
@TestCaseName("writeConfigWhenOutputStreamThrowsException with : {1}")
public void writeConfigWhenOutputStreamThrowsException(ConfigIO configIO, String description)
    throws Exception {

  Config config = ConfigFactory.newMutableConfig()
      .setString("test.key", "test value")
      .get();
  OutputStream outputStream = spy(new ByteArrayOutputStream());
  doThrow(new RuntimeException("Test Exception")).when(outputStream).write(anyInt());
  doThrow(new RuntimeException("Test Exception")).when(outputStream).write(any(byte[].class));
  doThrow(new RuntimeException("Test Exception")).when(outputStream).write(any(byte[].class), anyInt(), anyInt());

  configIO.writeConfig(config, outputStream);
}
 
开发者ID:raistlic,项目名称:raistlic-lib-commons-core,代码行数:17,代码来源:ConfigIOTest.java

示例6: writeConfigExpected

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "expectedCases")
@TestCaseName("writeConfigExpected with {2}")
public void writeConfigExpected(ConfigIO configIO, String fixturePath, String description)
    throws Exception {

  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  Config config = ConfigFixture.getConfigFixture();

  configIO.writeConfig(config, outputStream);

  String actual = new String(outputStream.toByteArray()).trim().replaceAll("\n", "").replaceAll("\r", "");
  InputStream inputStream = getClass().getResourceAsStream(fixturePath);
  String expected = readAll(inputStream).trim().replaceAll("\n", "").replaceAll("\r", "");
  inputStream.close();
  assertThat(actual).isEqualTo(expected);
}
 
开发者ID:raistlic,项目名称:raistlic-lib-commons-core,代码行数:18,代码来源:ConfigIOTest.java

示例7: readConfigExpected

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "expectedCases")
@TestCaseName("readConfigExpected with {2}")
public void readConfigExpected(ConfigIO configIO, String fixturePath, String description)
    throws Exception {

  InputStream inputStream = getClass().getResourceAsStream(fixturePath);
  Config actual = configIO.readConfig(inputStream);
  inputStream.close();
  Config expected = ConfigFixture.getConfigFixture();

  assertThat(actual.getKeys()).hasSize(expected.getKeys().size());
  assertThat(actual.getKeys()).containsAll(expected.getKeys());
  for (String key : expected.getKeys()) {
    assertThat(actual.getString(key)).isEqualTo(expected.getString(key));
  }
}
 
开发者ID:raistlic,项目名称:raistlic-lib-commons-core,代码行数:18,代码来源:ConfigIOTest.java

示例8: splitOnSpace

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@TestCaseName("{method}: input \"{0}\" splits to {1}")
@Parameters
public void splitOnSpace(String input, String[] expected) {
    String[] result = StringUtil.splitOnSpaceWithEscape(input);
    assertEquals(expected.length, result.length);
    for (int j = 0; j < expected.length; j++) {
        assertEquals(expected[j],result[j]);
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-build,代码行数:11,代码来源:StringUtilTest.java

示例9: max

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@TestCaseName("{method}: max({0},{1}) = {2}, {0} >= {1} ? {3}")
@Parameters
public void versionChecks(String versionA, String versionB, String largerVersion, boolean isGreaterOrEquals) {
    assertEquals(largerVersion, StringUtil.extractLargerVersion(versionA,versionB));
    assertEquals(isGreaterOrEquals, StringUtil.greaterOrEqualsVersion(versionA,versionB));
}
 
开发者ID:fabric8io,项目名称:fabric8-build,代码行数:8,代码来源:StringUtilTest.java

示例10: buildFeatureDescription

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@TestCaseName("{method}:{0}")
@Parameters(method = "featureDescription_multipleTextsInBlock," +
		             "featureDescription_singleTextInBlock," +
		             "featureDescription_whereBlockIgnoring," +
		             "featureDescription_noBlocks" )
public void buildFeatureDescription(String testDescription, FeatureInfo featureInfo, String expectedResult) {
	String actualDescription = NodeInfoUtils.buildFeatureDescription(featureInfo);

	assertThat(testDescription, actualDescription, equalTo(expectedResult));
}
 
开发者ID:reportportal,项目名称:agent-java-spock,代码行数:12,代码来源:NodeInfoUtilsTest.java

示例11: getFixtureDisplayName

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@TestCaseName("{method}(inherited={1})")
@Parameters(method = "parametersForFixtureDescription")
public void getFixtureDisplayName(MethodInfo methodInfo, boolean inherited, String expectedDisplayName) {
	String actualName = NodeInfoUtils.getFixtureDisplayName(methodInfo, inherited);

	assertThat(actualName, equalTo(expectedDisplayName));
}
 
开发者ID:reportportal,项目名称:agent-java-spock,代码行数:9,代码来源:NodeInfoUtilsTest.java

示例12: annotationDiffer

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "parameters")
@TestCaseName("{method}[{index}] - {0}")
public void annotationDiffer(String testName, AnnotationInfo previous, AnnotationInfo next, List<Diff> expected) throws Exception {
    AnnotationDiffer differ = AnnotationDiffer.annotationDiffer(previous, next);
    Collection<Diff> actual = differ.diff();
    assertThat(actual, equalTo(expected));
}
 
开发者ID:aalmiray,项目名称:naum,代码行数:9,代码来源:AnnotationDifferTest.java

示例13: classesDifferInStructure

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "classStructure")
@TestCaseName("{method}[{index}] - {0}")
public void classesDifferInStructure(String testName, ClassInfo previous, ClassInfo next, Collection<Diff> expected) {
    ClassDiffer differ = classDiffer(previous, next);
    Collection<Diff> actual = differ.diff();
    assertThat(actual, hasSize(greaterThan(0)));
    assertThat(actual, equalTo(expected));
}
 
开发者ID:aalmiray,项目名称:naum,代码行数:10,代码来源:ClassDifferTest.java

示例14: methodsDiffer

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "parameters")
@TestCaseName("{method}[{index}] - {0}")
public void methodsDiffer(String testName, MethodInfo previous, MethodInfo next, Collection<Diff> expected) {
    MethodDiffer differ = methodDiffer(previous, next);
    Collection<Diff> actual = differ.diff();
    assertThat(actual, hasSize(greaterThan(0)));
    assertThat(actual, equalTo(expected));
}
 
开发者ID:aalmiray,项目名称:naum,代码行数:10,代码来源:MethodDifferTest.java

示例15: fieldsDiffer

import junitparams.naming.TestCaseName; //导入依赖的package包/类
@Test
@Parameters(method = "parameters")
@TestCaseName("{method}[{index}] - {0}")
public void fieldsDiffer(String testName, FieldInfo previous, FieldInfo next, Collection<Diff> expected) {
    FieldDiffer differ = fieldDiffer(previous, next);
    Collection<Diff> actual = differ.diff();
    assertThat(actual, hasSize(greaterThan(0)));
    assertThat(actual, equalTo(expected));
}
 
开发者ID:aalmiray,项目名称:naum,代码行数:10,代码来源:FieldDifferTest.java


注:本文中的junitparams.naming.TestCaseName类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。