@Test public void toLocation() throws Exception { PositionConverter.toLocation(positionString); verify(mockLocation).setLatitude(55.55); verify(mockLocation).setLongitude(90.0); verify(mockLocation).setTime((long)1521158400); }
@TypeConverter public static Location toLocation(String location) { if (location == null) return null; String[] split = location.split("#"); double lat = Double.parseDouble(split[0]); double lon = Double.parseDouble(split[1]); long time = Long.parseLong(split[2]); Location l = new Location(LocationManager.GPS_PROVIDER); l.setLatitude(lat); l.setLongitude(lon); l.setTime(time); return l; }
PositionConverter { @TypeConverter public static Location toLocation(String location) { if (location == null) return null; String[] split = location.split("#"); double lat = Double.parseDouble(split[0]); double lon = Double.parseDouble(split[1]); long time = Long.parseLong(split[2]); Location l = new Location(LocationManager.GPS_PROVIDER); l.setLatitude(lat); l.setLongitude(lon); l.setTime(time); return l; } }
PositionConverter { @TypeConverter public static Location toLocation(String location) { if (location == null) return null; String[] split = location.split("#"); double lat = Double.parseDouble(split[0]); double lon = Double.parseDouble(split[1]); long time = Long.parseLong(split[2]); Location l = new Location(LocationManager.GPS_PROVIDER); l.setLatitude(lat); l.setLongitude(lon); l.setTime(time); return l; }  }
PositionConverter { @TypeConverter public static Location toLocation(String location) { if (location == null) return null; String[] split = location.split("#"); double lat = Double.parseDouble(split[0]); double lon = Double.parseDouble(split[1]); long time = Long.parseLong(split[2]); Location l = new Location(LocationManager.GPS_PROVIDER); l.setLatitude(lat); l.setLongitude(lon); l.setTime(time); return l; }  @TypeConverter static Location toLocation(String location); @TypeConverter static String toDoubles(Location location); }
PositionConverter { @TypeConverter public static Location toLocation(String location) { if (location == null) return null; String[] split = location.split("#"); double lat = Double.parseDouble(split[0]); double lon = Double.parseDouble(split[1]); long time = Long.parseLong(split[2]); Location l = new Location(LocationManager.GPS_PROVIDER); l.setLatitude(lat); l.setLongitude(lon); l.setTime(time); return l; }  @TypeConverter static Location toLocation(String location); @TypeConverter static String toDoubles(Location location);  }