Fix network config "Supported" bug (#130)

* Fix network config bug

* Use Jackson instead of hacky solution for management

* run spotless

* Add assertion
This commit is contained in:
Matt
2020-09-24 15:34:47 -07:00
committed by GitHub
parent 125cd35557
commit 28459704c6
2 changed files with 57 additions and 11 deletions

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2020 Photon Vision.
*
* This program 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.
*
* This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.photonvision.common.configuration;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.nio.file.Path;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class NetworkConfigTest {
@Test
public void testSerialization() throws IOException {
var mapper = new ObjectMapper();
var path = Path.of("netTest.json");
mapper.writeValue(path.toFile(), new NetworkConfig());
Assertions.assertDoesNotThrow(() -> mapper.readValue(path.toFile(), NetworkConfig.class));
}
}