Subversion Repositories mkgmap

Rev

Rev 3221 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2008 Steve Ratcliffe
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  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.
 *
 *
 * Author: Steve Ratcliffe
 * Create date: 30-Nov-2008
 */

package uk.me.parabola.mkgmap.reader.osm;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import static org.junit.Assert.*;


public class ElementTest {
        @Test
        public void testEntryIterator() {
                Element el = new Way(1);

                el.addTag("a", "1");
                el.addTag("b", "2");
                el.addTag("c", "3");

                List<String> keys = new ArrayList<String>();
                List<String> values = new ArrayList<String>();

                for (Map.Entry<String, String> ent : el.getTagEntryIterator()) {
                        keys.add(ent.getKey());
                        values.add(ent.getValue());
                }

                Collections.sort(keys);
                Collections.sort(values);

                assertArrayEquals("list of keys",
                                new String[] {"a", "b", "c"},
                                keys.toArray());

                assertArrayEquals("list of values",
                                new String[] {"1", "2", "3"},
                                values.toArray());
        }
}