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


Java BeanUtil.getMethod方法代码示例

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


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

示例1: testCreationFromScratch

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testCreationFromScratch() throws Exception {
    File createdFile = null;
    try {
        Method testMethod = BeanUtil.getMethod(TEST_CLASS, "creationFromScratch", TEST_PARAMS);
        Collection<WorkbookTracker> trackers = JavaBeanExcelDocumentMapper.createOrMergeDocuments(testMethod, TARGET_CLASSES);
        createdFile = trackers.iterator().next().getFile();
        verifyExcelDocument(trackers, "test_from_scratch.xls", new String[] { "name1", "name2" },
                new String[] { "sub.name" },
                null);
    }
    finally {
        if (createdFile != null) {
            FileUtil.deleteIfExists(createdFile);
        }
    }
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:18,代码来源:JavaBeanExcelDocumentMapperTest.java

示例2: testAdditionalExcelColumns

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testAdditionalExcelColumns() throws Exception {
    final String EXCEL_URI = "test_additional_columns.xls";
    copyToTarget(EXCEL_URI);
    Method testMethod = BeanUtil.getMethod(TEST_CLASS, "additionalColumns", TEST_PARAMS);
    Collection<WorkbookTracker> trackers = JavaBeanExcelDocumentMapper.createOrMergeDocuments(testMethod, TARGET_CLASSES);
    verifyExcelDocument(trackers, EXCEL_URI, new String[] { "name1", "name2" }, new String[] { "sub.name" },
            new String[] { "Alice", "Bob", "x", "Charly", "y" });
    // verify warnings
    WorkbookTracker tracker = trackers.iterator().next();
    List<String> warnings = tracker.getWarnings();
    assertEquals(2, warnings.size());
    assertEquals("Unmappable column 'add' in sheet 'sheet1' of file 'test_additional_columns.xls'", warnings.get(0));
    assertEquals("Unmappable column 'sub.add' in sheet 'sheet1' of file 'test_additional_columns.xls'", warnings.get(1));
    Workbook workbook = tracker.getWorkbook();
    Sheet sheet1 = workbook.getSheet("sheet1");
    Row headerRow = sheet1.getRow(0);
    assertNotNull(headerRow);
    assertEquals(HSSFColor.RED.index, headerRow.getCell(2).getCellStyle().getFillForegroundColor());
    assertEquals(HSSFColor.RED.index, headerRow.getCell(4).getCellStyle().getFillForegroundColor());
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:22,代码来源:JavaBeanExcelDocumentMapperTest.java

示例3: testNoArgMethod

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testNoArgMethod() throws Exception {
    Method noArgMethod = BeanUtil.getMethod(DatabeneFormatsTestDataProviderTest.class, "noArgMethod");
    List<TestCaseData> testDataSets = createProvider().getTestDataSets(noArgMethod);
    assertTrue("No test data sets created for no-arg method", testDataSets.size() >= 1);
    assertTrue("Unexpected test data sets for no-arg method", testDataSets.size() <= 1);
    assertTrue("Unexpected parameters loaded for no-arg method", testDataSets.get(0).getData().length == 0);
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:9,代码来源:DatabeneFormatsTestDataProviderTest.java

示例4: testSingleArgMethod

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testSingleArgMethod() throws Exception {
    Method singleArgMethod = BeanUtil.getMethod(DatabeneFormatsTestDataProviderTest.class, "singleArgMethod", PersonBean.class);
    List<TestCaseData> testDataSets = createProvider().getTestDataSets(singleArgMethod);
    assertTrue("No test data sets created for single-arg method", testDataSets.size() >= 1);
    assertEquals(2, testDataSets.size());
    assertPerson("Alice", 23, "London", "Dover", testDataSets.get(0).getData());
    assertPerson("Bob", 34, "New York", "Hauppauge", testDataSets.get(1).getData());
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:10,代码来源:DatabeneFormatsTestDataProviderTest.java

示例5: testSingleArgMethodWithOffset

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testSingleArgMethodWithOffset() throws Exception {
    Method singleArgMethod = BeanUtil.getMethod(DatabeneFormatsTestDataProviderTest.class, "singleArgMethodWithOffset", PersonBean.class);
    List<TestCaseData> testDataSets = createProvider().getTestDataSets(singleArgMethod);
    assertTrue("No test data sets created for single-arg method", testDataSets.size() >= 1);
    assertEquals(1, testDataSets.size());
    assertPerson("Bob", 34, "New York", "Hauppauge", testDataSets.get(0).getData());
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:9,代码来源:DatabeneFormatsTestDataProviderTest.java

示例6: testMultiArgMethod

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testMultiArgMethod() throws Exception {
    Method multiArgMethod = BeanUtil.getMethod(DatabeneFormatsTestDataProviderTest.class, "multiArgMethod", PersonBean.class, AddressBean.class);
    List<TestCaseData> testDataSets = createProvider().getTestDataSets(multiArgMethod);
    assertTrue("No test data sets created for multi-arg method", testDataSets.size() >= 1);
    assertEquals(2, testDataSets.size());
    assertPersonAndAddress("Max", 23, "Munich", testDataSets.get(0).getData());
    assertPersonAndAddress("Jens", 34, "Hamburg", testDataSets.get(1).getData());
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:10,代码来源:DatabeneFormatsTestDataProviderTest.java

示例7: testEmptyValuesMethod

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testEmptyValuesMethod() throws Exception {
    Method nullValuesMethod = BeanUtil.getMethod(DatabeneFormatsTestDataProviderTest.class, "withNullValuesMethod",
            PersonBean.class);
    List<TestCaseData> testDataSets = createProvider().getTestDataSets(nullValuesMethod);
    assertTrue("No test data sets created for null values method", testDataSets.size() >= 1);
    assertEquals(5, testDataSets.size());

    assertPerson("Alice", 23, null, null, testDataSets.get(0).getData());
    assertPerson("Bob", 34, null, null, testDataSets.get(1).getData());
    assertPerson(null, 35, null, null, testDataSets.get(2).getData());
    assertPerson("", 36, null, null, testDataSets.get(3).getData());
    assertPerson("<NULL>", 37, null, null, testDataSets.get(4).getData());
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:15,代码来源:DatabeneFormatsTestDataProviderTest.java

示例8: testNullHeaderMethod

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test(expected = AssertionError.class)
public void testNullHeaderMethod() throws Exception {
    Method nullValuesMethod = BeanUtil.getMethod(DatabeneFormatsTestDataProviderTest.class, "nullHeaderMethod",
            PersonBean.class);
    List<TestCaseData> testDataSets = createProvider().getTestDataSets(nullValuesMethod);
    assertTrue("No test data sets created for null values method", testDataSets.size() >= 1);
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:8,代码来源:DatabeneFormatsTestDataProviderTest.java

示例9: testMatchingExcelDocument

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testMatchingExcelDocument() throws Exception {
    final String EXCEL_URI = "test_match.xls";
    copyToTarget(EXCEL_URI);
    Method testMethod = BeanUtil.getMethod(TEST_CLASS, "matchingExcelDocument", TEST_PARAMS);
    Collection<WorkbookTracker> trackers = JavaBeanExcelDocumentMapper.createOrMergeDocuments(testMethod, TARGET_CLASSES);
    verifyExcelDocument(trackers, EXCEL_URI, new String[] { "name1", "name2" },
            new String[] { "sub.name" },
            new String[] { "Alice", "Bob", "Charly" });
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:11,代码来源:JavaBeanExcelDocumentMapperTest.java

示例10: testMissingExcelColumns

import org.databene.commons.BeanUtil; //导入方法依赖的package包/类
@Test
public void testMissingExcelColumns() throws Exception {
    final String EXCEL_URI = "test_missing_columns.xls";
    copyToTarget(EXCEL_URI);
    Method testMethod = BeanUtil.getMethod(TEST_CLASS, "missingColumns", TEST_PARAMS);
    Collection<WorkbookTracker> trackers = JavaBeanExcelDocumentMapper.createOrMergeDocuments(testMethod, TARGET_CLASSES);
    verifyExcelDocument(trackers, EXCEL_URI, new String[] { "name1", "name2" }, new String[] { "sub.name" }, new String[] {
            "Alice", null, "Charly" });
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:10,代码来源:JavaBeanExcelDocumentMapperTest.java


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