java/nekurak.net-ejb/test/cz/frantovo/nekurak/ext/GeoTest.java
author František Kučera <franta-hg@frantovo.cz>
Sat Jun 19 14:00:11 2010 +0200 (2010-06-19)
changeset 143 91c4282ea15f
parent 122 f6c7168be1b7
child 145 0efefbf5f8b6
permissions -rw-r--r--
doladění CSS pro lidi bez JS
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@120
    13
    private Geo geo = new Geo();
franta-hg@125
    14
    private static final int CASOVY_LIMIT = 1000;
franta-hg@120
    15
franta-hg@125
    16
    @Test(timeout = CASOVY_LIMIT)
franta-hg@120
    17
    public void praha() {
franta-hg@121
    18
	testuj("Praha, Czech Republic", 50.0878114, 14.4204598);
franta-hg@121
    19
    }
franta-hg@121
    20
franta-hg@125
    21
    @Test(timeout = CASOVY_LIMIT)
franta-hg@121
    22
    public void sanghaj() {
franta-hg@121
    23
	// https://frantovo.cz/blog/?q=cina-sanghaj-mesto-lide :-)
franta-hg@122
    24
	testuj("Shanghai, China", 31.230708, 121.472916);
franta-hg@121
    25
    }
franta-hg@121
    26
franta-hg@125
    27
    @Test(timeout = CASOVY_LIMIT)
franta-hg@121
    28
    public void dallas() {
franta-hg@122
    29
	testuj("Dallas, TX", 32.802955, -96.769923);
franta-hg@121
    30
    }
franta-hg@121
    31
franta-hg@125
    32
    @Test(timeout = CASOVY_LIMIT)
franta-hg@121
    33
    public void moskva() {
franta-hg@122
    34
	testuj("Moscow, Russia", 55.755786, 37.617633);
franta-hg@122
    35
    }
franta-hg@122
    36
franta-hg@122
    37
    @Test
franta-hg@122
    38
    public void loc() {
franta-hg@122
    39
	Souradnice s = geo.new Souradnice(55.755786, 37.617633);
franta-hg@122
    40
	assertEquals("Loc: 55.755786, 37.617633", s.getLoc());
franta-hg@120
    41
    }
franta-hg@120
    42
franta-hg@120
    43
    private void testuj(String vstup, double pozadovanaSirka, double pozadovanaDelka) {
franta-hg@120
    44
	Souradnice vystup = geo.getSouradnice(vstup);
franta-hg@120
    45
	assertEquals(geo.new Souradnice(pozadovanaSirka, pozadovanaDelka), vystup);
franta-hg@120
    46
    }
franta-hg@120
    47
}