franta-hg@120: package cz.frantovo.nekurak.ext; franta-hg@120: franta-hg@120: import cz.frantovo.nekurak.ext.Geo.Souradnice; franta-hg@120: import org.junit.Test; franta-hg@120: import static org.junit.Assert.*; franta-hg@120: franta-hg@120: /** franta-hg@120: * Testuje hlavně dostupnost a funkčnost vzdálené služby (Google). franta-hg@120: * @author fiki franta-hg@120: */ franta-hg@120: public class GeoTest { franta-hg@120: franta-hg@145: private Geo geo = new Geo(); franta-hg@145: private static final int CASOVY_LIMIT = 1000; franta-hg@120: franta-hg@145: @Test(timeout = CASOVY_LIMIT) franta-hg@145: public void praha() { franta-hg@145: testuj("Praha, Czech Republic", 50.0878114, 14.4204598); franta-hg@145: } franta-hg@121: franta-hg@145: @Test(timeout = CASOVY_LIMIT) franta-hg@145: public void sanghaj() { franta-hg@145: // https://frantovo.cz/blog/?q=cina-sanghaj-mesto-lide :-) franta-hg@145: testuj("Shanghai, China", 31.230708, 121.472916); franta-hg@145: } franta-hg@121: franta-hg@145: @Test(timeout = CASOVY_LIMIT) franta-hg@145: public void dallas() { franta-hg@145: testuj("Dallas, TX", 32.802955, -96.769923); franta-hg@145: } franta-hg@121: franta-hg@145: @Test(timeout = CASOVY_LIMIT) franta-hg@145: public void moskva() { franta-hg@145: testuj("Moscow, Russia", 55.755786, 37.617633); franta-hg@145: } franta-hg@122: franta-hg@145: @Test franta-hg@145: public void loc() { franta-hg@145: Souradnice s = geo.new Souradnice(55.755786, 37.617633); franta-hg@145: assertEquals("Loc: 55.755786, 37.617633", s.getLoc()); franta-hg@145: } franta-hg@120: franta-hg@145: private void testuj(String vstup, double pozadovanaSirka, double pozadovanaDelka) { franta-hg@145: Souradnice vystup = geo.getSouradnice(vstup); franta-hg@145: assertEquals(geo.new Souradnice(pozadovanaSirka, pozadovanaDelka), vystup); franta-hg@145: } franta-hg@120: }