test pass: Postoffice AllTest.class
1 parent e913923 commit 7e35823d4eb7fcc162f7bbb7e085ea39763dce75
@hayashi hayashi authored on 25 Mar 2018
Showing 7 changed files
View
0
■■■■■
src/police.activity.violet.html
Too large (Show diff)
View
4
test/osm/jp/coverage/fuel/DbExistTest.java
}
boolean checkRenge(double d1, String str) throws SQLException {
double base = Double.parseDouble(str);
double up = d1 + 0.0000005D;
double down = d1 - 0.0000005D;
double up = d1 + 0.0001D;
double down = d1 - 0.0001D;
boolean ret = true;
if (Double.compare(base, up) > 0) {
ret = false;
}
View
1
■■■■
test/osm/jp/coverage/police/DbExistTest.java
import static org.hamcrest.CoreMatchers.is;
import org.junit.*;
import static org.junit.Assert.*;
import org.junit.runners.MethodSorters;
import static osm.jp.api.Osmdb.create;
 
@FixMethodOrder (MethodSorters.NAME_ASCENDING)
public class DbExistTest {
public void init() throws Exception {
View
39
test/osm/jp/coverage/postoffice/AllTest.java 0 → 100644
package osm.jp.coverage.postoffice;
 
import java.io.File;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
 
@RunWith(Suite.class)
@Suite.SuiteClasses({
DbPostofficeTest.class,
DbExistTest.class,
PostofficeTest.class
})
public class AllTest {
 
@BeforeClass
public static void setUpClass() throws Exception {
File dir = new File("database");
dir.deleteOnExit();
dir.mkdir();
}
 
@AfterClass
public static void tearDownClass() throws Exception {
}
 
@Before
public void setUp() throws Exception {
}
 
@After
public void tearDown() throws Exception {
}
}
View
109
test/osm/jp/coverage/postoffice/DbExistTest.java
import jp.co.areaweb.tools.database.DatabaseTool;
import static org.hamcrest.CoreMatchers.is;
import org.junit.*;
import static org.junit.Assert.*;
import org.junit.runners.MethodSorters;
import static osm.jp.api.Osmdb.create;
 
/**
*
* @author yuu
*/
@FixMethodOrder (MethodSorters.NAME_ASCENDING)
public class DbExistTest {
@Before
public void setUp() throws Exception {
File dir = new File("database");
if (dir.exists()) {
if (dir.isDirectory()) {
dir.deleteOnExit();
}
else {
throw new Exception("'database' is not directory.");
}
}
}
@After
public void tearDown() throws Exception {
}
@Test
public void test01_hsqldbの生成確認() {
public void test00_hsqldbの生成確認() {
Connection con = null;
try {
File dir = new File("database");
if (dir.exists()) {
if (dir.isDirectory()) {
dir.deleteOnExit();
}
else {
throw new Exception("'database' is not directory.");
}
}
// DB.tableを作成
con = DatabaseTool.openDb("database");
create(con);
}
catch (ClassNotFoundException | SQLException | IOException ex) {
fail();
catch (Exception ex) {
fail(ex.toString());
} finally {
if (con != null) {
DatabaseTool.closeDb(con);
}
}
 
}
 
@Test
public void test01_hsqldbの生成確認() {
File dir = new File("database");
assertTrue(dir.exists());
assertTrue(dir.isDirectory());
}
catch (Exception ex) {
fail(ex.toString());
}
 
}
@Test
public void test03_check() {
File dir = new File("database");
assertTrue(dir.exists());
assertTrue(dir.isDirectory());
fail();
}
}
// ノード: 綾瀬郵便局 (1420831800) 場所: 35.4470975, 139.4159210
ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='1420831800'");
try (ResultSet rset1 = ps1.executeQuery()) {
if (rset1.next()) {
assertThat(rset1.getInt("score"), is(50));
assertTrue(checkRenge(rset1, "35.4470975", "139.4159210"));
}
else {
fail();
}
}
// ノード: 蒲田駅前郵便局 (1420797282) 場所: 35.5629710, 139.7145174
ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='1420797282'");
try (ResultSet rset1 = ps1.executeQuery()) {
if (rset1.next()) {
assertThat(rset1.getInt("score"), is(50));
assertThat(checkRenge(rset1, "35.5629710", "139.7145174"), is(true));
assertTrue(checkRenge(rset1, "35.5629710", "139.7145174"));
}
else {
fail();
}
}
// ウェイ: 世田谷郵便局 (50810596) 場所: 35.6402036, 139.6678386
ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='50810596'");
try (ResultSet rset1 = ps1.executeQuery()) {
if (rset1.next()) {
assertThat(rset1.getInt("score"), is(50));
assertTrue(checkRenge(rset1, "35.6402036", "139.6678386"));
}
else {
fail();
}
}
// disused:amenity=post_office ノード: 南大和郵便局 (1420814864) 場所: 35.4714005, 139.4649291
ps1 = hsqldb.prepareStatement("SELECT score,name,lat,lon FROM OSM_EXIST where idref='1420814864'");
try (ResultSet rset1 = ps1.executeQuery()) {
if (rset1.next()) {
assertThat(rset1.getInt("score"), is(50));
assertTrue(checkRenge(rset1, "35.4714005", "139.4649291"));
}
else {
fail();
}
}
boolean checkRenge(double d1, String str) throws SQLException {
double base = Double.parseDouble(str);
double up = d1 + 0.0000005D;
double down = d1 - 0.0000005D;
double up = d1 + 0.0001D;
double down = d1 - 0.0001D;
boolean ret = true;
if (Double.compare(base, up) > 0) {
ret = false;
}
View
test/osm/jp/coverage/postoffice/DbPostofficeTest.java
View
test/osm/jp/coverage/postoffice/PostofficeTest.java 0 → 100644