|
| 1 | +/** |
| 2 | + * Copyright (c) 2010-2024 Contributors to the openHAB project |
| 3 | + * |
| 4 | + * See the NOTICE file(s) distributed with this work for additional |
| 5 | + * information. |
| 6 | + * |
| 7 | + * This program and the accompanying materials are made available under the |
| 8 | + * terms of the Eclipse Public License 2.0 which is available at |
| 9 | + * http://www.eclipse.org/legal/epl-2.0 |
| 10 | + * |
| 11 | + * SPDX-License-Identifier: EPL-2.0 |
| 12 | + */ |
| 13 | +package org.openhab.binding.sensibo.internal; |
| 14 | + |
| 15 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
| 16 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
| 17 | + |
| 18 | +import java.io.IOException; |
| 19 | + |
| 20 | +import org.junit.jupiter.api.Test; |
| 21 | +import org.openhab.binding.sensibo.internal.dto.poddetails.PodDetailsDTO; |
| 22 | +import org.openhab.binding.sensibo.internal.model.SensiboModel; |
| 23 | +import org.openhab.binding.sensibo.internal.model.SensiboSky; |
| 24 | + |
| 25 | +/** |
| 26 | + * @author Arne Seime - Initial contribution |
| 27 | + * |
| 28 | + */ |
| 29 | +public class SensiboModelTest { |
| 30 | + |
| 31 | + private final WireHelper wireHelper = new WireHelper(); |
| 32 | + |
| 33 | + @Test |
| 34 | + public void testCaseInsensitiveMacAddress() throws IOException { |
| 35 | + |
| 36 | + final PodDetailsDTO rsp = wireHelper.deSerializeResponse("/get_pod_details_response.json", PodDetailsDTO.class); |
| 37 | + SensiboSky sky = new SensiboSky(rsp); |
| 38 | + |
| 39 | + SensiboModel model = new SensiboModel(0); |
| 40 | + model.addPod(sky); |
| 41 | + |
| 42 | + assertFalse(model.findSensiboSkyByMacAddress("MA:C:AD:DR:ES:XX").isPresent()); |
| 43 | + assertTrue(model.findSensiboSkyByMacAddress("MA:C:AD:DR:ES:S0").isPresent()); |
| 44 | + assertTrue(model.findSensiboSkyByMacAddress("MA:C:AD:DR:ES:S0".toLowerCase()).isPresent()); |
| 45 | + } |
| 46 | +} |
0 commit comments