/** * Tests that badly ordered input (with respect to the version) is detected correctly. * * @throws Exception * if anything fails. */ @Test public void badSortOrderVersion() throws Exception { ChangeSimplifier simplifier = new ChangeSimplifier(); simplifier.setChangeSink(new NullChangeWriter()); simplifier.initialize(new HashMap<String, Object>()); Node node; node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 2), 1, 1); simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify)); try { node = new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1); simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify)); } catch (OsmosisRuntimeException e) { if (e.getMessage().startsWith("Pipeline entities are not sorted")) { return; } throw e; } Assert.fail("Expected exception not thrown"); }
/** * Tests that badly ordered input (with respect to the ids) is detected correctly. * * @throws Exception * if anything fails. */ @Test public void badSortOrderId() throws Exception { ChangeSimplifier simplifier = new ChangeSimplifier(); simplifier.setChangeSink(new NullChangeWriter()); simplifier.initialize(new HashMap<String, Object>()); Node node; node = new Node(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2), 1, 1); simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify)); try { node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1); simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify)); } catch (OsmosisRuntimeException e) { if (e.getMessage().startsWith("Pipeline entities are not sorted")) { return; } throw e; } Assert.fail("Expected exception not thrown"); }
/** * Tests that badly ordered input (with respect to the ids) is detected correctly. * * @throws Exception * if anything fails. */ @Test public void badSortOrderType() throws Exception { ChangeSimplifier simplifier = new ChangeSimplifier(); simplifier.setChangeSink(new NullChangeWriter()); simplifier.initialize(new HashMap<String, Object>()); Node node; Way way; way = new Way(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2)); simplifier.process(new ChangeContainer(new WayContainer(way), ChangeAction.Modify)); try { node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1); simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify)); } catch (OsmosisRuntimeException e) { if (e.getMessage().startsWith("Pipeline entities are not sorted")) { return; } throw e; } Assert.fail("Expected exception not thrown"); } }