use of me.retrodaredevil.io.serial.SerialConfigBuilder in project solarthing by wildmountainfarms.
the class DeserializeTest method testAllIO.
@Test
void testAllIO() {
ObjectMapper mapper = MAPPER.copy();
InjectableValues.Std iv = new InjectableValues.Std();
iv.addValue(SerialIOConfig.DEFAULT_SERIAL_CONFIG_KEY, new SerialConfigBuilder(9600));
mapper.setInjectableValues(iv);
for (File configFile : getJsonFiles(IO_CONFIG_DIRECTORY)) {
try {
mapper.readValue(configFile, IOConfig.class);
} catch (IOException ex) {
fail("Failed parsing config: " + configFile, ex);
}
}
{
// many users of SolarThing have come to rely on config_templates/io/default_linux_serial.json. Let's make sure it's always there for them
File file = new File(IO_CONFIG_DIRECTORY, "default_linux_serial.json");
assertTrue(file.exists(), "default_linux_serial.json doesn't exist!");
try {
mapper.readValue(file, IOConfig.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
Aggregations