From 752ebe5022f3df880042c07f56e5ee34a1016eb7 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Fri, 8 Jan 2016 23:40:54 +0100 Subject: [PATCH] Fix cast exception in integration test - Although the class only has fields of Property type it would appear that CircleCI et al. may use libraries that add fields to classes later on, so we need to check for the field type --- .../settings/custom/NewSettingIntegrationTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/java/fr/xephi/authme/settings/custom/NewSettingIntegrationTest.java b/src/test/java/fr/xephi/authme/settings/custom/NewSettingIntegrationTest.java index 8e6801fe6..dcb3c6833 100644 --- a/src/test/java/fr/xephi/authme/settings/custom/NewSettingIntegrationTest.java +++ b/src/test/java/fr/xephi/authme/settings/custom/NewSettingIntegrationTest.java @@ -35,10 +35,12 @@ public class NewSettingIntegrationTest { public static void generatePropertyMap() { propertyMap = new PropertyMap(); for (Field field : TestConfiguration.class.getDeclaredFields()) { - Property property = - (Property) ReflectionTestUtils.getFieldValue(TestConfiguration.class, null, field.getName()); - String[] comments = new String[]{"Comment for '" + property.getPath() + "'"}; - propertyMap.put(property, comments); + Object fieldValue = ReflectionTestUtils.getFieldValue(TestConfiguration.class, null, field.getName()); + if (fieldValue instanceof Property) { + Property property = (Property) fieldValue; + String[] comments = new String[]{"Comment for '" + property.getPath() + "'"}; + propertyMap.put(property, comments); + } } }