@Test public void testFromYearFormat() { String year = "-30/2000"; int[] yearPair = {-30, 2000}; assertArrayEquals(yearPair, FeedRow.fromYearFormat(year)); year = "0/0"; yearPair = new int[]{0, 0}; assertArrayEquals(yearPair, FeedRow.fromYearFormat(year)); thrown.expect(IllegalArgumentException.class); year = "5/4/"; FeedRow.fromYearFormat(year); year = "205-2077"; FeedRow.fromYearFormat(year); }
public static int[] fromYearFormat(String yearFormat) { String[] parts = yearFormat.split("/"); if (parts.length != 2) { throw new IllegalArgumentException("Given string is not in expected format: " + yearFormat); } int[] intParts = {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; return intParts; }
FeedRow { public static int[] fromYearFormat(String yearFormat) { String[] parts = yearFormat.split("/"); if (parts.length != 2) { throw new IllegalArgumentException("Given string is not in expected format: " + yearFormat); } int[] intParts = {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; return intParts; } }
FeedRow { public static int[] fromYearFormat(String yearFormat) { String[] parts = yearFormat.split("/"); if (parts.length != 2) { throw new IllegalArgumentException("Given string is not in expected format: " + yearFormat); } int[] intParts = {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; return intParts; } FeedRow();  FeedRow(String imageUrl,
                   String title,
                   String description,
                   String location,
                   String year,
                   List<String> tagList,
                   String favoriteCount,
                   boolean isFavorite,
                   String creatorUsername); }
FeedRow { public static int[] fromYearFormat(String yearFormat) { String[] parts = yearFormat.split("/"); if (parts.length != 2) { throw new IllegalArgumentException("Given string is not in expected format: " + yearFormat); } int[] intParts = {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; return intParts; } FeedRow();  FeedRow(String imageUrl,
                   String title,
                   String description,
                   String location,
                   String year,
                   List<String> tagList,
                   String favoriteCount,
                   boolean isFavorite,
                   String creatorUsername); static String toYearFormat(int startYear, int endYear); static int[] fromYearFormat(String yearFormat); String getImageUrl(); void setImageUrl(String imageUrl); String getTitle(); void setTitle(String title); String getDescription(); void setDescription(String description); String getLocation(); void setLocation(String location); String getYear(); void setYear(String year); void setTagList(List<String> tagList); List<String> getTagList(); String getFavoriteCount(); void setFavoriteCount(String favoriteCount); String getCreatorUsername(); void setCreatorUsername(String creatorUsername); boolean isFavorite(); void setFavorite(boolean favorite); }
FeedRow { public static int[] fromYearFormat(String yearFormat) { String[] parts = yearFormat.split("/"); if (parts.length != 2) { throw new IllegalArgumentException("Given string is not in expected format: " + yearFormat); } int[] intParts = {Integer.parseInt(parts[0]), Integer.parseInt(parts[1])}; return intParts; } FeedRow();  FeedRow(String imageUrl,
                   String title,
                   String description,
                   String location,
                   String year,
                   List<String> tagList,
                   String favoriteCount,
                   boolean isFavorite,
                   String creatorUsername); static String toYearFormat(int startYear, int endYear); static int[] fromYearFormat(String yearFormat); String getImageUrl(); void setImageUrl(String imageUrl); String getTitle(); void setTitle(String title); String getDescription(); void setDescription(String description); String getLocation(); void setLocation(String location); String getYear(); void setYear(String year); void setTagList(List<String> tagList); List<String> getTagList(); String getFavoriteCount(); void setFavoriteCount(String favoriteCount); String getCreatorUsername(); void setCreatorUsername(String creatorUsername); boolean isFavorite(); void setFavorite(boolean favorite);  }