java/nekurak.net-ejb/test/cz/frantovo/nekurak/ext/GeoTest.java
author František Kučera <franta-hg@frantovo.cz>
Wed Jun 30 00:26:14 2010 +0200 (2010-06-30)
changeset 149 8238cdb4113a
parent 125 1eecc767a610
child 169 15f172a772a4
permissions -rw-r--r--
XMPP chat – první verze.
franta-hg@120
     1
package cz.frantovo.nekurak.ext;
franta-hg@120
     2
franta-hg@120
     3
import cz.frantovo.nekurak.ext.Geo.Souradnice;
franta-hg@120
     4
import org.junit.Test;
franta-hg@120
     5
import static org.junit.Assert.*;
franta-hg@120
     6
franta-hg@120
     7
/**
franta-hg@120
     8
 * Testuje hlavně dostupnost a funkčnost vzdálené služby (Google).
franta-hg@120
     9
 * @author fiki
franta-hg@120
    10
 */
franta-hg@120
    11
public class GeoTest {
franta-hg@120
    12
franta-hg@145
    13
	private Geo geo = new Geo();
franta-hg@145
    14
	private static final int CASOVY_LIMIT = 1000;
franta-hg@120
    15
franta-hg@145
    16
	@Test(timeout = CASOVY_LIMIT)
franta-hg@145
    17
	public void praha() {
franta-hg@145
    18
		testuj("Praha, Czech Republic", 50.0878114, 14.4204598);
franta-hg@145
    19
	}
franta-hg@121
    20
franta-hg@145
    21
	@Test(timeout = CASOVY_LIMIT)
franta-hg@145
    22
	public void sanghaj() {
franta-hg@145
    23
		// https://frantovo.cz/blog/?q=cina-sanghaj-mesto-lide :-)
franta-hg@145
    24
		testuj("Shanghai, China", 31.230708, 121.472916);
franta-hg@145
    25
	}
franta-hg@121
    26
franta-hg@145
    27
	@Test(timeout = CASOVY_LIMIT)
franta-hg@145
    28
	public void dallas() {
franta-hg@145
    29
		testuj("Dallas, TX", 32.802955, -96.769923);
franta-hg@145
    30
	}
franta-hg@121
    31
franta-hg@145
    32
	@Test(timeout = CASOVY_LIMIT)
franta-hg@145
    33
	public void moskva() {
franta-hg@145
    34
		testuj("Moscow, Russia", 55.755786, 37.617633);
franta-hg@145
    35
	}
franta-hg@122
    36
franta-hg@145
    37
	@Test
franta-hg@145
    38
	public void loc() {
franta-hg@145
    39
		Souradnice s = geo.new Souradnice(55.755786, 37.617633);
franta-hg@145
    40
		assertEquals("Loc: 55.755786, 37.617633", s.getLoc());
franta-hg@145
    41
	}
franta-hg@120
    42
franta-hg@145
    43
	private void testuj(String vstup, double pozadovanaSirka, double pozadovanaDelka) {
franta-hg@145
    44
		Souradnice vystup = geo.getSouradnice(vstup);
franta-hg@145
    45
		assertEquals(geo.new Souradnice(pozadovanaSirka, pozadovanaDelka), vystup);
franta-hg@145
    46
	}
franta-hg@120
    47
}