/**
* GeoDress - A program for reverse geocoding
* Copyright (C) 2010 Stefan T.
*
* See COPYING for Details.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package geodress.tests;
import geodress.model.Address;
import geodress.model.Coordinate;
import geodress.model.reader.GoogleMapsReader;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* A location reader that generates fake addresses but has the same API as
* {@link geodress.model.reader.GoogleMapsReader}. This class should only be
* used for testing and debugging when no Internet connection is available.
*
* @author Stefan T.
*/
public class FakeGoogleMapsReader extends GoogleMapsReader {
/** formatter for date/time */
private final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat(
"kk:mm:ss");
/**
* @see geodress.model.reader.GoogleMapsReader#GoogleMapsReader()
*/
public FakeGoogleMapsReader() {
super();
}
/**
* @see geodress.model.reader.GoogleMapsReader#GoogleMapsReader(String)
* @param googleMapsKey
* to be ignored
*/
public FakeGoogleMapsReader(String googleMapsKey) {
super(googleMapsKey);
}
/**
* @see geodress.model.reader.GoogleMapsReader#getAddress(Coordinate)
*/
@Override
public Address getAddress(Coordinate coordinates)
throws UnknownHostException {
return new Address(DATE_FORMATTER.format(new Date().getTime()),
Address.STATUS_RANDOM);
}
}