source: josm/trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java@ 17442

Last change on this file since 17442 was 17275, checked in by Don-vip, 3 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.io.ByteArrayInputStream;
5import java.io.ByteArrayOutputStream;
6import java.io.ObjectInputStream;
7import java.io.ObjectOutputStream;
8import java.util.Arrays;
9
10import org.junit.Assert;
11import org.junit.jupiter.api.Test;
12
13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
14
15class WayDataTest {
16
17 @Test
18 @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION")
19 void testSerializationForDragAndDrop() throws Exception {
20 final WayData data = new WayData();
21 data.setNodeIds(Arrays.asList(1415L, 9265L, 3589L, 7932L, 3846L));
22 data.setId(314);
23 data.setVersion(14);
24 data.setChangesetId(314159);
25 final Object readData;
26 try (ByteArrayOutputStream bytes = new ByteArrayOutputStream();
27 ObjectOutputStream out = new ObjectOutputStream(bytes)) {
28 out.writeObject(data);
29 try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()))) {
30 readData = in.readObject();
31 }
32 }
33 Assert.assertEquals(data.toString(), readData.toString());
34 }
35}
Note: See TracBrowser for help on using the repository browser.