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


Java ConfigurationValue类代码示例

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


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

示例1: injectField

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private void injectField(Configuration config, Field field, Object target) {

        ConfigurationValue configurationValue = field.getAnnotation(ConfigurationValue.class);
        if (configurationValue == null) {
            // field should not be injected
            return;
        }

        field.setAccessible(true);

        Injector injector = injectorMap.get(field.getType());
        if (injector == null) {
            throw new IllegalClassException(UNINJECTABLE_FIELD_TYPE + field.getType());
        }

        try {
            injector.injectInto(config, configurationValue.value(), field, target);
        } catch (IllegalAccessException e) {
            /* since fields are set accessible at the beginning of this method  IllegalAccessExceptions should not occur.
             * That makes it ok to throw an UndeclaredThrowableException */
            throw new UndeclaredThrowableException(e);
        }

    }
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:25,代码来源:ConfigurationValueInjector.java

示例2: injectField

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private static void injectField(Configuration config, Field field, Object target) {

        ConfigurationValue configurationValue = field.getAnnotation(ConfigurationValue.class);
        if (configurationValue == null) {
            // field should not be injected
            return;
        }

        field.setAccessible(true);

        Injector injector = INJECTOR_MAP.get(field.getType());
        if (injector == null) {
            throw new IllegalClassException(UNINJECTABLE_FIELD_TYPE + field.getType());
        }

        try {
            injector.injectInto(config, configurationValue.value(), field, target);
        } catch (IllegalAccessException e) {
            /* since fields are set accessible at the beginning of this method  IllegalAccessExceptions should not occur.
             * That makes it ok to throw an UndeclaredThrowableException */
            throw new UndeclaredThrowableException(e);
        }

    }
 
开发者ID:testIT-WebTester,项目名称:webtester-core,代码行数:25,代码来源:ConfigurationValueInjector.java

示例3: configurationValuesAnnotationIsUsedOnClassLevel

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private boolean configurationValuesAnnotationIsUsedOnClassLevel() {
    boolean isUsed = false;
    Class<?> testClass = getTestClass().getJavaClass();
    for (Field field : reflectionUtils.getAllFieldsOfClassHierarchy(testClass)) {
        boolean isStatic = Modifier.isStatic(field.getModifiers());
        boolean isAnnotated = field.isAnnotationPresent(ConfigurationValue.class);
        if (isStatic && isAnnotated) {
            isUsed = true;
        }
    }
    return isUsed;
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:13,代码来源:WebTesterJUnitRunner.java

示例4: configurationValuesAnnotationIsUsedOnMethodLevel

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private boolean configurationValuesAnnotationIsUsedOnMethodLevel() {
    boolean isUsed = false;
    Class<?> testClass = getTestClass().getJavaClass();
    for (Field field : reflectionUtils.getAllFieldsOfClassHierarchy(testClass)) {
        boolean isStatic = Modifier.isStatic(field.getModifiers());
        boolean isAnnotated = field.isAnnotationPresent(ConfigurationValue.class);
        if (!isStatic && isAnnotated) {
            isUsed = true;
        }
    }
    return isUsed;
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:13,代码来源:WebTesterJUnitRunner.java

示例5: getConfigurationValueFields

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private List<Field> getConfigurationValueFields() {
    List<Field> configurationValueFields = new LinkedList<Field>();
    for (Field field : allFields) {
        if (field.isAnnotationPresent(ConfigurationValue.class)) {
            configurationValueFields.add(field);
        }
    }
    return configurationValueFields;
}
 
开发者ID:testIT-WebTester,项目名称:webtester-core,代码行数:10,代码来源:TestClassPlausibilityChecker.java

示例6: configurationValuesAnnotationIsUsedOnClassLevel

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private boolean configurationValuesAnnotationIsUsedOnClassLevel() {
    boolean isUsed = false;
    Class<?> testClass = getTestClass().getJavaClass();
    for (Field field : ReflectionUtils.getAllFieldsOfClassHierarchy(testClass)) {
        boolean isStatic = Modifier.isStatic(field.getModifiers());
        boolean isAnnotated = field.isAnnotationPresent(ConfigurationValue.class);
        if (isStatic && isAnnotated) {
            isUsed = true;
        }
    }
    return isUsed;
}
 
开发者ID:testIT-WebTester,项目名称:webtester-core,代码行数:13,代码来源:WebTesterJUnitRunner.java

示例7: configurationValuesAnnotationIsUsedOnMethodLevel

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private boolean configurationValuesAnnotationIsUsedOnMethodLevel() {
    boolean isUsed = false;
    Class<?> testClass = getTestClass().getJavaClass();
    for (Field field : ReflectionUtils.getAllFieldsOfClassHierarchy(testClass)) {
        boolean isStatic = Modifier.isStatic(field.getModifiers());
        boolean isAnnotated = field.isAnnotationPresent(ConfigurationValue.class);
        if (!isStatic && isAnnotated) {
            isUsed = true;
        }
    }
    return isUsed;
}
 
开发者ID:testIT-WebTester,项目名称:webtester-core,代码行数:13,代码来源:WebTesterJUnitRunner.java

示例8: getConfigurationValueFields

import info.novatec.testit.webtester.junit.annotations.ConfigurationValue; //导入依赖的package包/类
private List<Field> getConfigurationValueFields() {
    return allFields.stream()
        .filter(field -> field.isAnnotationPresent(ConfigurationValue.class))
        .collect(Collectors.toList());
}
 
开发者ID:testIT-WebTester,项目名称:webtester2-core,代码行数:6,代码来源:TestClassPlausibilityChecker.java


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