public static void testMergeDownloadedStored() { final Geocache stored = new Geocache(); stored.setGeocode("GC12345"); stored.setDetailed(true); stored.setDisabled(true); stored.setType(CacheType.TRADITIONAL); stored.setCoords(new Geopoint(40.0, 8.0)); stored.setDescription("Test1"); stored.setAttributes(Collections.singletonList("TestAttribute")); stored.setShortDescription("Short"); stored.setHint("Hint"); saveFreshCacheToDB(stored); final Geocache download = new Geocache(); download.setGeocode("GC12345"); download.setDetailed(true); download.setDisabled(false); download.setType(CacheType.MULTI); download.setCoords(new Geopoint(41.0, 9.0)); download.setDescription("Test2"); download.setAttributes(Collections.<String>emptyList()); download.gatherMissingFrom(stored); assertThat(download.isDetailed()).as("merged detailed").isTrue(); assertThat(download.isDisabled()).as("merged disabled").isFalse(); assertThat(download.getType()).as("merged download").isEqualTo(CacheType.MULTI); assertThat(download.getCoords()).as("merged coordinates").isEqualTo(new Geopoint(41.0, 9.0)); assertThat(download.getDescription()).as("merged description").isEqualTo("Test2"); assertThat(download.getShortDescription()).as("merged short description").isEmpty(); assertThat(download.getAttributes()).as("merged attributes").isEmpty(); assertThat(download.getHint()).as("merged hint").isEmpty(); }