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


Java ReflectionAssert.assertLenientEquals方法代码示例

本文整理汇总了Java中org.unitils.reflectionassert.ReflectionAssert.assertLenientEquals方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectionAssert.assertLenientEquals方法的具体用法?Java ReflectionAssert.assertLenientEquals怎么用?Java ReflectionAssert.assertLenientEquals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.unitils.reflectionassert.ReflectionAssert的用法示例。


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

示例1: testCodec

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testCodec() throws Exception {
  String expectedString =
          "{" +
                  "\"cores\":2," +
                  "\"memorySize\":1024," +
                  "\"instances\":2," +
                  "\"uplink\":100," +
                  "\"downlink\":100" +
          "}";
  final ResourceSpecification expected =
          new DefaultResourceSpecification(2, 1024, 2, 100, 100);
  final String actualString = gson.toJson(expected);
  Assert.assertEquals(expectedString, actualString);

  final JsonElement expectedJson = gson.toJsonTree(expected);
  final ResourceSpecification actual = gson.fromJson(expectedJson, DefaultResourceSpecification.class);
  final JsonElement actualJson = gson.toJsonTree(actual);

  Assert.assertEquals(expectedJson, actualJson);
  ReflectionAssert.assertLenientEquals(expected, actual);
}
 
开发者ID:apache,项目名称:twill,代码行数:23,代码来源:ResourceSpecificationCodecTest.java

示例2: testFilter

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testFilter() throws MalformedURLException {
    List<URL> filteredResources = new ArrayList<URL>();
    File file1 = new File("src/test/resources/org/unitils/dbunit/test1/testFile.txt");
    
    URL urlFile1 = new URL("file:///" + file1.getAbsolutePath());
    filteredResources.add(urlFile1);
    String resourceSearchName = file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf(pathSeperator) + 1);
    
    strategy.filter(filteredResources, resourceSearchName);
    Assert.assertEquals(1, filteredResources.size());
    ReflectionAssert.assertLenientEquals(Arrays.asList(urlFile1), filteredResources);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:14,代码来源:ResourcePickingStrategieTest.java

示例3: testObject

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
/**
 * @throws SecurityException
 * @throws NoSuchFieldException
 */
@Test
public void testObject() throws SecurityException, NoSuchFieldException{
    Person expected = new Person("testName", "testSurname");
    ReflectionUtils.setFieldValue(testclass, "personTest", expected);
    ReflectionAssert.assertLenientEquals(expected, testclass.getPersonTest());
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:11,代码来源:ReflectionUtilsTypesTest.java

示例4: testFindById

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
@DataSet("../datasets/SinglePerson.xml")
public void testFindById() {
	Session currentSession = sessionFactory.getCurrentSession();
    Person userFromDb = (Person) currentSession.get(Person.class, 1L);
	ReflectionAssert.assertLenientEquals(person, userFromDb);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:8,代码来源:HibernateTest.java

示例5: testGetProfileWithAnnotations

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testGetProfileWithAnnotations() {
    profileModule.getProfile(TestClass6.class);
    ReflectionAssert.assertLenientEquals("Test if the actual context is a GenericXmlApplicationContext", AnnotationConfigApplicationContext.class, profileModule.getCtx().getClass());


    //drop table DummyTable
    dropTableDummyTable();
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:10,代码来源:ProfileModuleTest.java

示例6: testCreate

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testCreate() {
    Map<String, DatabaseConfiguration> databaseConfigurations = new HashMap<String, DatabaseConfiguration>();
    databaseConfigurations.put("database1", config1);
    databaseConfigurations.put("database2", config2);
    DatabaseConfigurations configs = new DatabaseConfigurations(null, databaseConfigurations);
    ReflectionAssert.assertLenientEquals(configs, factory.create());
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:9,代码来源:DatabaseConfigurationsFactoryTest.java

示例7: testGetScriptsAt_qualifiers

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testGetScriptsAt_qualifiers() throws Exception {
    String nameFolder = "getscriptsat_qualifiers";
    File parentFile = tempFolder.newFolder(nameFolder);

    tempFolder.newFile(nameFolder + "/01_#include1_products.sql");
    tempFolder.newFile(nameFolder + "/#include1_#include2_products.sql");
    tempFolder.newFile(nameFolder + "/01_#include1_#include2_products.sql");
    tempFolder.newFile(nameFolder + "/01_#refdata_#postgres_products.sql");
    tempFolder.newFile(nameFolder + "/01_#include1_#exclude2_products.sql");

    String path = getPath(parentFile);
    scriptSource = new ResourceScriptSource();
    configuration.setProperty(DefaultScriptSource.PROPKEY_INCLUDE_QUALIFIERS, "include1, include2, include3");
    configuration.setProperty(DefaultScriptSource.PROPKEY_EXCLUDE_QUALIFIERS, "exclude1, exclude2");
    configuration.setProperty(DefaultScriptSource.PROPKEY_SCRIPT_LOCATIONS, path);
    configuration.setProperty(DefaultScriptSource.PROPKEY_SCRIPT_EXTENSIONS, "sql");
    configuration.setProperty(DefaultScriptSource.PROPKEY_POSTPROCESSINGSCRIPT_DIRNAME, "postprocessing");
    configuration.setProperty(DefaultScriptSource.PROPKEY_USESCRIPTFILELASTMODIFICATIONDATES, "false");
    configuration.setProperty("database.dialect", "hsqldb");

    scriptSource.init(configuration);


    List<Script> actual = new ArrayList<Script>();

    scriptSource.getScriptsAt(actual, path, nameFolder, "users", true);
    List<String> actualNames = new ArrayList<String>();
    for (Script script : actual) {
        actualNames.add(script.getFileName());
    }

    Assert.assertEquals(3, actualNames.size());

    ReflectionAssert.assertLenientEquals(Arrays.asList("01_%23include1_products.sql", "%23include1_%23include2_products.sql", "01_%23include1_%23include2_products.sql"), actualNames);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:37,代码来源:ResourceScriptSourceQualifiersMultiSupportTest.java

示例8: testGetScriptsAt_qualifiers

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testGetScriptsAt_qualifiers() throws Exception {
    String nameFolder = "getscriptsat_qualifiers";
    File parentFile = tempFolder.newFolder(nameFolder);

    tempFolder.newFile(nameFolder + "/01_#include1_products.sql");
    tempFolder.newFile(nameFolder + "/#include1_#include2_products.sql");
    tempFolder.newFile(nameFolder + "/01_#include1_#include2_products.sql");
    tempFolder.newFile(nameFolder + "/01_#refdata_#postgres_products.sql");
    tempFolder.newFile(nameFolder + "/01_#include1_#exclude2_products.sql");
    
    scriptSource = new DefaultScriptSource();
    configuration.setProperty(DefaultScriptSource.PROPKEY_INCLUDE_QUALIFIERS, "include1, include2, include3");
    scriptSource.init(configuration);

    
    List<Script> actual = new ArrayList<Script>();

    scriptSource.getScriptsAt(actual, parentFile.getParentFile().getAbsolutePath(), nameFolder, "users", true);
    List<String> actualNames = new ArrayList<String>();
    for (Script script : actual) {
        actualNames.add(script.getFileName());
    }

    Assert.assertEquals(3, actualNames.size());

    ReflectionAssert.assertLenientEquals(Arrays.asList(nameFolder + "/01_#include1_products.sql", nameFolder + "/#include1_#include2_products.sql", nameFolder + "/01_#include1_#include2_products.sql"), actualNames);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:29,代码来源:DefaultScriptSourceTest.java

示例9: testAddMostRecentDuplicateFile

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testAddMostRecentDuplicateFile() throws IOException {
    List<URL> filteredResources = new ArrayList<URL>();
    File file1 = new File("src/test/resources/org/unitils/dbunit/test1/testFile.txt");
    
    URL urlFile1 = new URL("file:///" + file1.getAbsolutePath());
    filteredResources.add(urlFile1);
    
    String resourceSearchName = file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf(pathSeperator) + 1);
    
    strategy.addMostRecent(filteredResources, urlFile1, resourceSearchName);
    Assert.assertEquals(1, filteredResources.size());
    ReflectionAssert.assertLenientEquals(Arrays.asList(urlFile1), filteredResources);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:15,代码来源:ResourcePickingStrategieTest.java

示例10: testComputeParams

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testComputeParams() throws Exception {
	List<Object[]> parameters = new ArrayList<Object[]>();
	parameters.add(new Object[]{1,2});
	sut = unitilsParameterized.new TestClassRunnerForParameters(Testclass1.class, parameters, 0);
	
	Object[] actual = sut.computeParams();
	Object[] expected = new Object[]{1,2};
	ReflectionAssert.assertLenientEquals(expected, actual);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:11,代码来源:UnitilsParameterizedTestClassRunnerForParameters.java

示例11: testAddMostRecentEmptyFilteredResources

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testAddMostRecentEmptyFilteredResources() throws Exception {
    List<URL> filteredResources = new ArrayList<URL>();
    File file1 = new File("src/test/resources/org/unitils/dbunit/test1/testFile.txt");
    
    URL urlFile1 = new URL("file:///" + file1.getAbsolutePath());
    
    String resourceSearchName = file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf("\\") + 1);
    
    strategy.addMostRecent(filteredResources, urlFile1, resourceSearchName);
    Assert.assertEquals(1, filteredResources.size());
    ReflectionAssert.assertLenientEquals(Arrays.asList(urlFile1), filteredResources);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:14,代码来源:ResourcePickingStrategieTest.java

示例12: testBuilder

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testBuilder() throws Exception {
  final ResourceSpecification actual = ResourceSpecification.Builder.with()
          .setVirtualCores(5)
          .setMemory(4, ResourceSpecification.SizeUnit.GIGA)
          .setInstances(3)
          .setUplink(10, ResourceSpecification.SizeUnit.GIGA)
          .setDownlink(5, ResourceSpecification.SizeUnit.GIGA)
          .build();
  final DefaultResourceSpecification expected =
          new DefaultResourceSpecification(5, 4096, 3, 10240, 5120);
  ReflectionAssert.assertLenientEquals(expected, actual);
}
 
开发者ID:chtyim,项目名称:incubator-twill,代码行数:14,代码来源:ResourceSpecificationCodecTest.java

示例13: testBuilderWithLists

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
public void testBuilderWithLists() throws Exception {
  final ResourceSpecification actual = ResourceSpecification.Builder.with()
          .setVirtualCores(5)
          .setMemory(4, ResourceSpecification.SizeUnit.GIGA)
          .setInstances(3)
          .setUplink(10, ResourceSpecification.SizeUnit.GIGA)
          .setDownlink(5, ResourceSpecification.SizeUnit.GIGA)
          .build();
  final DefaultResourceSpecification expected =
          new DefaultResourceSpecification(5, 4096, 3, 10240, 5120);
  ReflectionAssert.assertLenientEquals(expected, actual);
}
 
开发者ID:chtyim,项目名称:incubator-twill,代码行数:14,代码来源:ResourceSpecificationCodecTest.java

示例14: testByte

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
/**
 * @throws SecurityException
 * @throws NoSuchFieldException
 */
@Test
public void testByte() throws SecurityException, NoSuchFieldException{
    ReflectionUtils.setFieldValue(testclass, "byteTest", new Byte("125"));
    ReflectionAssert.assertLenientEquals(new Byte("125"), testclass.getByteTest());
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:10,代码来源:ReflectionUtilsTypesTest.java

示例15: testFindById

import org.unitils.reflectionassert.ReflectionAssert; //导入方法依赖的package包/类
@Test
@DataSet("../datasets/SinglePerson.xml")
public void testFindById() {
	Person userFromDb = entityManager.find(Person.class, 1L);
	ReflectionAssert.assertLenientEquals(person, userFromDb);
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:7,代码来源:HibernateJpaTest.java


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