From 451bca27fd83b0364a7a21c6316df347a2976379 Mon Sep 17 00:00:00 2001 From: Bane Stojkovic Date: Tue, 6 Oct 2026 14:03:57 +0200 Subject: [PATCH] variants --- .../resources/import-defaults/variants.xml | 1005 ++++++++--------- .../diylc-core/src/main/resources/update.xml | 2 +- .../diylc/components/FactoryVariantsTest.java | 138 +++ 3 files changed, 593 insertions(+), 552 deletions(-) create mode 100644 diylc/diylc-library/src/test/java/org/diylc/components/FactoryVariantsTest.java diff --git a/diylc/diylc-core/src/main/resources/import-defaults/variants.xml b/diylc/diylc-core/src/main/resources/import-defaults/variants.xml index db9957af..348478c2 100644 --- a/diylc/diylc-core/src/main/resources/import-defaults/variants.xml +++ b/diylc/diylc-core/src/main/resources/import-defaults/variants.xml @@ -6,7 +6,7 @@ Covered PAF-Style - Bobin 1 + Bobbin 1 @@ -18,17 +18,13 @@ true - Bobin 2 + Bobbin 2 Color - - Alpha - 127 - Model @@ -60,7 +56,7 @@ Uncovered PAF-Style - Bobin 1 + Bobbin 1 @@ -72,17 +68,13 @@ false - Bobin 2 + Bobbin 2 Color - - Alpha - 127 - Pole Color @@ -114,7 +106,7 @@ EMG-style - Bobin 1 + Bobbin 1 @@ -126,17 +118,13 @@ true - Bobin 2 + Bobbin 2 Color - - Alpha - 127 - Pole Color @@ -168,7 +156,7 @@ Filtertron-style - Bobin 1 + Bobbin 1 @@ -184,17 +172,13 @@ true - Bobin 2 + Bobbin 2 Color - - Alpha - 127 - Model @@ -239,7 +223,7 @@ - Power rating + Power Rating @@ -247,11 +231,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -262,10 +246,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -302,7 +282,7 @@ - Power rating + Power Rating @@ -310,11 +290,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -325,10 +305,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -365,7 +341,7 @@ - Power rating + Power Rating @@ -373,11 +349,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -388,10 +364,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -428,7 +400,7 @@ - Power rating + Power Rating @@ -436,11 +408,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -451,10 +423,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -491,7 +459,7 @@ - Power rating + Power Rating @@ -499,11 +467,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -514,10 +482,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -554,7 +518,7 @@ - Power rating + Power Rating @@ -562,11 +526,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -577,10 +541,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -617,7 +577,7 @@ - Power rating + Power Rating @@ -625,11 +585,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -640,10 +600,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -680,7 +636,7 @@ - Power rating + Power Rating @@ -688,11 +644,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -703,10 +659,6 @@ Value - - Alpha - 127 - Color code NONE @@ -743,7 +695,7 @@ - Power rating + Power Rating @@ -751,11 +703,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -766,10 +718,6 @@ Value - - Alpha - 127 - Color code NONE @@ -806,7 +754,7 @@ - Power rating + Power Rating @@ -814,11 +762,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -829,10 +777,6 @@ Value - - Alpha - 127 - Color code NONE @@ -869,7 +813,7 @@ - Power rating + Power Rating @@ -877,11 +821,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -892,10 +836,6 @@ Value - - Alpha - 127 - Color code NONE @@ -932,7 +872,7 @@ - Power rating + Power Rating @@ -940,11 +880,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -955,10 +895,6 @@ Value - - Alpha - 127 - Color code NONE @@ -995,7 +931,7 @@ - Power rating + Power Rating @@ -1003,11 +939,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1018,10 +954,6 @@ Value - - Alpha - 127 - Color code NONE @@ -1058,7 +990,7 @@ - Power rating + Power Rating @@ -1066,11 +998,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1081,10 +1013,6 @@ Value - - Alpha - 127 - Color code NONE @@ -1121,7 +1049,7 @@ - Power rating + Power Rating @@ -1129,11 +1057,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1144,10 +1072,6 @@ Value - - Alpha - 127 - Color code NONE @@ -1184,7 +1108,7 @@ - Power rating + Power Rating @@ -1192,11 +1116,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1207,10 +1131,6 @@ Value - - Alpha - 127 - Color code NONE @@ -1247,7 +1167,7 @@ - Power rating + Power Rating @@ -1255,11 +1175,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1270,10 +1190,6 @@ Value - - Alpha - 127 - Color code NONE @@ -1310,7 +1226,7 @@ - Power rating + Power Rating @@ -1318,11 +1234,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1333,10 +1249,6 @@ Value - - Alpha - 127 - Color code NONE @@ -1373,7 +1285,7 @@ - Power rating + Power Rating @@ -1381,11 +1293,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1396,10 +1308,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -1436,7 +1344,7 @@ - Power rating + Power Rating @@ -1444,11 +1352,11 @@ false - Lead color + Lead Color - Label color + Label Color @@ -1459,10 +1367,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -1534,10 +1438,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -1609,10 +1509,6 @@ Value - - Alpha - 127 - Color code _5_BAND @@ -1653,10 +1549,6 @@ Color - - Alpha - 127 - Pole Color @@ -1695,10 +1587,6 @@ Color - - Alpha - 127 - Pole Color @@ -1737,10 +1625,6 @@ Color - - Alpha - 127 - Pole Color @@ -1779,10 +1663,6 @@ Color - - Alpha - 127 - Pole Color @@ -1821,10 +1701,6 @@ Color - - Alpha - 127 - Pole Color @@ -1863,10 +1739,6 @@ Color - - Alpha - 127 - Pole Color @@ -1906,14 +1778,6 @@ Type MONO - - Alpha - 127 - - - Value - - Orientation DEFAULT @@ -1935,14 +1799,6 @@ Type STEREO - - Alpha - 127 - - - Value - - Orientation DEFAULT @@ -1979,10 +1835,6 @@ Pin Spacing - - Alpha - 127 - Value @@ -2044,10 +1896,6 @@ Pin Spacing - - Alpha - 127 - Value @@ -2118,10 +1966,6 @@ Voltage - - Alpha - 127 - Value @@ -2175,10 +2019,6 @@ Voltage - - Alpha - 100 - Value @@ -2232,10 +2072,6 @@ Voltage - - Alpha - 100 - Value @@ -2293,10 +2129,6 @@ Value - - Alpha - 100 - Label @@ -2343,22 +2175,10 @@ PCB Noval - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Base B9A @@ -2382,22 +2202,10 @@ PCB Octal - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Base OCTAL @@ -2420,22 +2228,10 @@ Chassis Noval - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2471,22 +2267,10 @@ Chassis Octal - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2521,22 +2305,10 @@ Chassis Noval 9A (12A?7) - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2572,22 +2344,10 @@ Chassis Noval 9CV (EL84) - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2623,22 +2383,10 @@ Chassis Octal 5T - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2673,22 +2421,10 @@ Chassis Octal 7AC (6?6) - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2723,22 +2459,10 @@ Chassis 7-pin 7BK - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2772,22 +2496,10 @@ Chassis Octal 8ET (EL34) - - Type - - - - Angle - 0 - Color - - Alpha - 127 - Mount CHASSIS @@ -2831,18 +2543,10 @@ Type MONO - - Alpha - 127 - Labels true - - Orientation - DEFAULT - @@ -2859,18 +2563,10 @@ Type STEREO - - Alpha - 127 - Labels true - - Orientation - DEFAULT - @@ -2887,18 +2583,10 @@ Type SWITCHED - - Alpha - 127 - Labels true - - Orientation - DEFAULT - @@ -2920,14 +2608,6 @@ Type DP3T - - Alpha - 127 - - - Orientation - DEFAULT - @@ -2949,14 +2629,6 @@ Type _4P5T - - Alpha - 127 - - - Orientation - DEFAULT - @@ -3012,25 +2684,17 @@ - Lug size + Lug Size Type ThroughHole - - Show shaft - false - Value - - Alpha - 127 - Body @@ -3076,25 +2740,17 @@ - Lug size + Lug Size Type ThroughHole - - Show shaft - false - Value - - Alpha - 127 - Body @@ -3146,10 +2802,6 @@ - - Alpha - 127 - Label @@ -3197,10 +2849,6 @@ Voltage - - Alpha - 127 - Value @@ -3267,10 +2915,6 @@ - - Alpha - 127 - Label @@ -3328,10 +2972,6 @@ - - Alpha - 127 - Label @@ -3425,10 +3065,6 @@ Core Border - - Alpha - 100 - Value @@ -3508,10 +3144,6 @@ Core Border - - Alpha - 100 - Value @@ -3591,10 +3223,6 @@ Core Border - - Alpha - 100 - Value @@ -3639,16 +3267,12 @@ Color - - Alpha - 127 - Border - Border thickness + Border Thickness @@ -3670,16 +3294,12 @@ Color - - Alpha - 127 - Border - Border thickness + Border Thickness @@ -3701,16 +3321,12 @@ Color - - Alpha - 127 - Border - Border thickness + Border Thickness @@ -3732,16 +3348,12 @@ Color - - Alpha - 127 - Border - Border thickness + Border Thickness @@ -3764,10 +3376,6 @@ Type DPDT - - Alpha - 127 - Spacing @@ -3803,10 +3411,6 @@ Type SPDT - - Alpha - 127 - Spacing @@ -3839,10 +3443,6 @@ Type _3PDT - - Alpha - 127 - Spacing @@ -3995,10 +3595,6 @@ Label - - Alpha - 127 - Timing @@ -4052,10 +3648,6 @@ Label - - Alpha - 127 - Timing @@ -4110,10 +3702,6 @@ Label - - Alpha - 127 - Timing @@ -4169,10 +3757,6 @@ Label - - Alpha - 127 - Timing @@ -4240,10 +3824,6 @@ Label - - Alpha - 127 - Timing @@ -4302,10 +3882,6 @@ Label - - Alpha - 127 - Timing @@ -4366,10 +3942,6 @@ Label - - Alpha - 127 - Timing @@ -4440,10 +4012,6 @@ Label - - Alpha - 127 - Timing @@ -4505,10 +4073,6 @@ 0 - - Alpha - 127 - @@ -4535,10 +4099,6 @@ 0 - - Alpha - 127 - @@ -4567,10 +4127,6 @@ 0 - - Alpha - 127 - @@ -4614,10 +4170,6 @@ 0 - - Alpha - 127 - @@ -4644,10 +4196,6 @@ 0 - - Alpha - 127 - @@ -4675,10 +4223,6 @@ 0 - - Alpha - 127 - @@ -4702,11 +4246,11 @@ 6x6 (e.g. Omron B3F-1000) - Spacing X + Pin Spacing - Spacing Y + Row Spacing @@ -4718,7 +4262,7 @@ DEFAULT - Case + Case Size @@ -4733,10 +4277,6 @@ Value - - Alpha - 127 - Body @@ -4767,11 +4307,11 @@ 12x12 (e.g. Omron B3F-4000) - Spacing X + Pin Spacing - Spacing Y + Row Spacing @@ -4783,7 +4323,7 @@ DEFAULT - Case + Case Size @@ -4798,10 +4338,6 @@ Value - - Alpha - 127 - Body @@ -4832,11 +4368,11 @@ 5x5 Low Profile SMD (e.g. Alps SKQG) - Spacing X + Pin Spacing - Spacing Y + Row Spacing @@ -4848,7 +4384,7 @@ DEFAULT - Case + Case Size @@ -4863,10 +4399,6 @@ Value - - Alpha - 127 - Border @@ -5355,4 +4887,375 @@ + + org.diylc.components.displays.CharacterLCD + + + 16x2 I2C Backpack + + Size_16x2 + InterfaceI2C_Backpack + + false + 2026-10-11T00:00:00.0000000 + + + 16x2 Parallel HD44780 + + Size_16x2 + InterfaceParallel_16Pin + + false + 2026-10-11T00:00:00.0000000 + + + 20x4 I2C Backpack + + Size_20x4 + InterfaceI2C_Backpack + + false + 2026-10-11T00:00:00.0000000 + + + 20x4 Parallel HD44780 + + Size_20x4 + InterfaceParallel_16Pin + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.OLEDDisplay + + + 0.96" SSD1306 I2C + + SizeSSD1306_0_96 + InterfaceI2C_4Pin + + false + 2026-10-11T00:00:00.0000000 + + + 0.96" SSD1306 SPI (7-Pin) + + SizeSSD1306_0_96 + InterfaceSPI_7Pin + + false + 2026-10-11T00:00:00.0000000 + + + 0.96" SSD1306 SPI (6-Pin) + + SizeSSD1306_0_96 + InterfaceSPI_6Pin + + false + 2026-10-11T00:00:00.0000000 + + + 0.91" SSD1306 I2C + + SizeSSD1306_0_91 + InterfaceI2C_4Pin + + false + 2026-10-11T00:00:00.0000000 + + + 0.91" SSD1306 SPI (7-Pin) + + SizeSSD1306_0_91 + InterfaceSPI_7Pin + + false + 2026-10-11T00:00:00.0000000 + + + 0.91" SSD1306 SPI (6-Pin) + + SizeSSD1306_0_91 + InterfaceSPI_6Pin + + false + 2026-10-11T00:00:00.0000000 + + + 1.3" SH1106 I2C + + SizeSH1106_1_3 + InterfaceI2C_4Pin + + false + 2026-10-11T00:00:00.0000000 + + + 1.3" SH1106 SPI (7-Pin) + + SizeSH1106_1_3 + InterfaceSPI_7Pin + + false + 2026-10-11T00:00:00.0000000 + + + 1.3" SH1106 SPI (6-Pin) + + SizeSH1106_1_3 + InterfaceSPI_6Pin + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.TFTDisplay + + + 2.8" ILI9341 (Touch + SD) + + ControllerILI9341_2_8 + + false + 2026-10-11T00:00:00.0000000 + + + 2.4" ILI9341 (Touch + SD) + + ControllerILI9341_2_4 + + false + 2026-10-11T00:00:00.0000000 + + + 0.96" ST7735 80x160 + + ControllerST7735_0_96 + + false + 2026-10-11T00:00:00.0000000 + + + 1.8" ST7735 128x160 + + ControllerST7735_1_8 + + false + 2026-10-11T00:00:00.0000000 + + + 1.54" ST7789 240x240 + + ControllerST7789_1_54 + + false + 2026-10-11T00:00:00.0000000 + + + 1.28" GC9A01 Round + + ControllerGC9A01_1_28 + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.SevenSegmentDisplay + + + 1-Digit 0.56" Common Cathode + + TypeSingleDigit_10Pin + CommonCathode + + false + 2026-10-11T00:00:00.0000000 + + + 1-Digit 0.56" Common Anode + + TypeSingleDigit_10Pin + CommonAnode + + false + 2026-10-11T00:00:00.0000000 + + + 4-Digit 0.36" Common Cathode + + TypeFourDigit_0_36_12Pin + CommonCathode + + false + 2026-10-11T00:00:00.0000000 + + + 4-Digit 0.36" Common Anode + + TypeFourDigit_0_36_12Pin + CommonAnode + + false + 2026-10-11T00:00:00.0000000 + + + 4-Digit 0.56" Common Cathode + + TypeFourDigit_0_56_12Pin + CommonCathode + + false + 2026-10-11T00:00:00.0000000 + + + 4-Digit 0.56" Common Anode + + TypeFourDigit_0_56_12Pin + CommonAnode + + false + 2026-10-11T00:00:00.0000000 + + + 4-Digit TM1637 Module + + TypeTM1637_Module_4Pin + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.LEDMatrix + + + Single 8x8 (MAX7219) + + ModulesSingle_8x8 + + false + 2026-10-11T00:00:00.0000000 + + + Compact 8x8 (MAX7219) + + ModulesCompact_8x8 + + false + 2026-10-11T00:00:00.0000000 + + + 4-in-1 32x8 (MAX7219) + + ModulesFourInOne_32x8 + + false + 2026-10-11T00:00:00.0000000 + + + 8-in-1 64x8 (MAX7219) + + ModulesEightInOne_64x8 + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.LEDBarGraph + + + 8 Segment + + Segments_8 + + false + 2026-10-11T00:00:00.0000000 + + + 10 Segment + + Segments_10 + + false + 2026-10-11T00:00:00.0000000 + + + 12 Segment + + Segments_12 + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.WS2812BRing + + + 12 LEDs + + Ring Size_12_LED + + false + 2026-10-11T00:00:00.0000000 + + + 16 LEDs + + Ring Size_16_LED + + false + 2026-10-11T00:00:00.0000000 + + + 24 LEDs + + Ring Size_24_LED + + false + 2026-10-11T00:00:00.0000000 + + + + + org.diylc.components.displays.WS2812BStrip + + + 30 LED/m + + Density_30 + + false + 2026-10-11T00:00:00.0000000 + + + 60 LED/m + + Density_60 + + false + 2026-10-11T00:00:00.0000000 + + + 144 LED/m + + Density_144 + + false + 2026-10-11T00:00:00.0000000 + + + diff --git a/diylc/diylc-core/src/main/resources/update.xml b/diylc/diylc-core/src/main/resources/update.xml index d75d69dc..7523d1e7 100644 --- a/diylc/diylc-core/src/main/resources/update.xml +++ b/diylc/diylc-core/src/main/resources/update.xml @@ -502,7 +502,7 @@ 7 0 - 2026-09-30 00:00:00.000 CET + 2026-10-11 00:00:00.000 CET diff --git a/diylc/diylc-library/src/test/java/org/diylc/components/FactoryVariantsTest.java b/diylc/diylc-library/src/test/java/org/diylc/components/FactoryVariantsTest.java new file mode 100644 index 00000000..fb1dfdd3 --- /dev/null +++ b/diylc/diylc-library/src/test/java/org/diylc/components/FactoryVariantsTest.java @@ -0,0 +1,138 @@ +/* + * + * DIY Layout Creator (DIYLC). + * Copyright (c) 2009-2025 held jointly by the individual authors. + * + * This file is part of DIYLC. + * + * DIYLC is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DIYLC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with DIYLC. If not, see . + * + */ +package org.diylc.components; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.diylc.appframework.miscutils.ConfigurationManager; +import org.diylc.common.PropertyWrapper; +import org.diylc.core.IDIYComponent; +import org.diylc.core.Template; +import org.diylc.presenter.ComponentProcessor; +import org.diylc.serialization.ProjectFileManager; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Checks every factory variant shipped in {@code import-defaults/variants.xml} against the class it + * configures. Nothing else does, and the failure is silent: a template names its properties as + * plain strings and its enum constants through an XStream package alias, so a renamed property, a + * renamed constant or a mistyped alias gives a variant that loads and then sets nothing. The user + * picks it from the palette and gets a default component. + * + *

This goes through {@link ComponentProcessor#extractProperties} and {@link PropertyWrapper}, + * which is exactly what {@code InstantiationManager} does when it applies a template, so a variant + * that passes here is one the application can really apply. That matters more than it sounds: + * matching properties by hand gets autoboxing and inherited accessors subtly wrong, and would + * report drift that is not there. + */ +public class FactoryVariantsTest { + + @BeforeClass + public static void setUp() { + try { + ConfigurationManager.getInstance().initialize("diylc"); + } catch (Exception ignored) { + } + } + + @SuppressWarnings("unchecked") + private static Map> loadVariants() { + InputStream in = FactoryVariantsTest.class.getClassLoader() + .getResourceAsStream("import-defaults/variants.xml"); + Assert.assertNotNull("variants.xml is not on the classpath", in); + return (Map>) ProjectFileManager.xStreamSerializer.fromXML(in); + } + + /** + * Problems are collected rather than asserted one at a time, so a run reports every stale + * template at once instead of stopping at the first. + */ + @Test + public void everyVariantNamesLivePropertiesAndApplies() throws Exception { + List problems = new ArrayList(); + int checked = 0; + + for (Map.Entry> entry : loadVariants().entrySet()) { + Class type; + try { + type = Class.forName(entry.getKey()); + } catch (ClassNotFoundException e) { + problems.add(entry.getKey() + ": no such class"); + continue; + } + + Map properties = new HashMap(); + for (PropertyWrapper property : ComponentProcessor.getInstance().extractProperties(type)) { + properties.put(property.getName(), property); + } + + for (Template variant : entry.getValue()) { + String where = type.getSimpleName() + " / " + variant.getName(); + if (variant.getValues() == null || variant.getValues().isEmpty()) { + problems.add(where + ": sets nothing"); + continue; + } + checked++; + + for (Map.Entry value : variant.getValues().entrySet()) { + PropertyWrapper property = properties.get(value.getKey()); + if (property == null) { + problems.add(where + ": no property named \"" + value.getKey() + "\""); + continue; + } + if (value.getValue() == null) { + continue; + } + + IDIYComponent component = + (IDIYComponent) type.getDeclaredConstructor().newInstance(); + PropertyWrapper applied = (PropertyWrapper) property.clone(); + applied.setValue(value.getValue()); + try { + applied.writeTo(component); + } catch (Exception e) { + problems.add(where + ": \"" + value.getKey() + "\" will not apply -- " + + e.getClass().getSimpleName() + " writing a " + + value.getValue().getClass().getSimpleName() + " to a " + + property.getType().getSimpleName()); + continue; + } + applied.readFrom(component); + if (!value.getValue().equals(applied.getValue())) { + problems.add(where + ": \"" + value.getKey() + "\" set to " + value.getValue() + + " but reads back " + applied.getValue()); + } + } + } + } + + Assert.assertTrue("no variants were found at all", checked > 0); + Assert.assertEquals(problems.size() + " stale factory variant value(s):\n " + + String.join("\n ", problems) + "\n", 0, problems.size()); + } +}