本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}