Add vector tile api key parameter, closes #49

This commit is contained in:
Emux
2016-07-06 17:12:48 +03:00
parent dfe4a10bf0
commit 7a88524343
2 changed files with 43 additions and 6 deletions

View File

@@ -1,9 +1,26 @@
/*
* Copyright 2016 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.tiling.source;
import static org.fest.assertions.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import org.oscim.core.Tile;
import org.oscim.tiling.ITileDataSource;
public class UrlTileSourceTest {
@@ -14,6 +31,12 @@ public class UrlTileSourceTest {
tileSource = new TestTileSource("http://example.org/tiles/vtm", "/{Z}/{X}/{Z}.vtm");
}
@Test
public void setApiKey_shouldAppendApiKey() throws Exception {
tileSource.setApiKey("testkey");
assertThat(tileSource.getTileUrl(new Tile(0, 0, (byte) 0))).endsWith("?api_key=testkey");
}
@Test
public void shouldNotBeNull() throws Exception {
assertThat(tileSource).isNotNull();