### Question:
Transformers { static Optional<GoogleColor> modelToColor(Model m) { if(m == null) { return Optional.empty(); } if(!m.supports(ColorTemperatureCapability.NAMESPACE) && !m.supports(ColorCapability.NAMESPACE)) { return Optional.empty(); } GoogleColor color = new GoogleColor(); if(m.supports(ColorTemperatureCapability.NAMESPACE)) { color.setTemperature(ColorTemperatureModel.getColortemp(m)); } if(m.supports(ColorCapability.NAMESPACE)) { color.setSpectrumRGB(new Colors.HSB( ColorModel.getHue(m), ColorModel.getSaturation(m), m.supports(DimmerCapability.NAMESPACE) ? DimmerModel.getBrightness(m) : 100 ).toRGB().toInt()); } return Optional.of(color); } private  Transformers(); static Optional<GoogleDevice> modelToDevice(Model m, boolean whitelisted, @Nullable ProductCatalogEntry pm, boolean reportStateEnabled); static Map<String,Object> modelToStateMap(Model m, boolean hubOffline, boolean whitelisted, @Nullable ProductCatalogEntry pm); static Optional<MessageBody> commandToMessageBody(Model m, boolean hubOffline, String command, Map<String, Object> params, boolean whitelisted, @Nullable ProductCatalogEntry pm); static PlatformMessage requestToMessage(Request req, UUID placeId, String population, int ttl); static Response messageToResponse(PlatformMessage msg); static final Gson GSON; static final String PRODUCT_ID; static final String TYPE_HINT; }### Answer:
@Test public void testModelToColor() { assertEquals(Optional.empty(), Transformers.modelToColor(null)); assertEquals(Optional.empty(), Transformers.modelToColor(nonDevModel)); GoogleColor color = new GoogleColor(); color.setTemperature(2500); color.setSpectrumRGB(65280); assertColor(color, Transformers.modelToColor(allCaps).get()); }