@Test public void testMetadataForProject() { assertEquals(null, ProjectUtils.metadataForProject(ProjectFactory.project())); assertEquals(ProjectUtils.Metadata.BACKING, ProjectUtils.metadataForProject(ProjectFactory.backedProject())); assertEquals(ProjectUtils.Metadata.CATEGORY_FEATURED, ProjectUtils.metadataForProject(ProjectFactory.featured())); assertEquals(ProjectUtils.Metadata.SAVING, ProjectUtils.metadataForProject(ProjectFactory.saved())); final Project savedAndBacked = ProjectFactory.backedProject().toBuilder().isStarred(true).build(); assertEquals(ProjectUtils.Metadata.BACKING, ProjectUtils.metadataForProject(savedAndBacked)); final DateTime now = new DateTime(); final Project savedAndFeatured = ProjectFactory.saved().toBuilder().featuredAt(now).build(); assertEquals(ProjectUtils.Metadata.SAVING, ProjectUtils.metadataForProject(savedAndFeatured)); final Project savedBackedFeatured = ProjectFactory.backedProject().toBuilder().featuredAt(now).isStarred(true).build(); assertEquals(ProjectUtils.Metadata.BACKING, ProjectUtils.metadataForProject(savedBackedFeatured)); }
public static @Nullable Metadata metadataForProject(final @NonNull Project project) { if (project.isBacking()) { return Metadata.BACKING; } else if (project.isStarred()) { return Metadata.SAVING; } else if (project.isFeaturedToday()) { return Metadata.CATEGORY_FEATURED; } return null; }
ProjectUtils { public static @Nullable Metadata metadataForProject(final @NonNull Project project) { if (project.isBacking()) { return Metadata.BACKING; } else if (project.isStarred()) { return Metadata.SAVING; } else if (project.isFeaturedToday()) { return Metadata.CATEGORY_FEATURED; } return null; } }
ProjectUtils { public static @Nullable Metadata metadataForProject(final @NonNull Project project) { if (project.isBacking()) { return Metadata.BACKING; } else if (project.isStarred()) { return Metadata.SAVING; } else if (project.isFeaturedToday()) { return Metadata.CATEGORY_FEATURED; } return null; } private  ProjectUtils(); }
ProjectUtils { public static @Nullable Metadata metadataForProject(final @NonNull Project project) { if (project.isBacking()) { return Metadata.BACKING; } else if (project.isStarred()) { return Metadata.SAVING; } else if (project.isFeaturedToday()) { return Metadata.CATEGORY_FEATURED; } return null; } private  ProjectUtils(); static boolean acceptedCardType(final @NonNull CreditCardTypes type, final @NonNull Project project); static List<Pair<Project, DiscoveryParams>> combineProjectsAndParams(final @NonNull List<Project> projects, final @NonNull DiscoveryParams params); static @NonNull String deadlineCountdown(final @NonNull Project project, final @NonNull Context context); static @NonNull String deadlineCountdownDetail(final @NonNull Project project, final @NonNull Context context,
    final @NonNull KSString ksString); static @NonNull String deadlineCountdownUnit(final @NonNull Project project, final @NonNull Context context); static int deadlineCountdownValue(final @NonNull Project project); static boolean isCompleted(final @NonNull Project project); static boolean isProjectNamePunctuated(final @NonNull String name); static @Nullable Metadata metadataForProject(final @NonNull Project project); static int photoHeightFromWidthRatio(final int width); static @NonNull Long timeInSecondsOfDuration(final @NonNull Project project); static @NonNull Long timeInSecondsUntilDeadline(final @NonNull Project project); static boolean userIsCreator(final @NonNull Project project, final @Nullable User user); static boolean isUSUserViewingNonUSProject(final @NonNull String userCountry, final @NonNull String projectCountry); }
ProjectUtils { public static @Nullable Metadata metadataForProject(final @NonNull Project project) { if (project.isBacking()) { return Metadata.BACKING; } else if (project.isStarred()) { return Metadata.SAVING; } else if (project.isFeaturedToday()) { return Metadata.CATEGORY_FEATURED; } return null; } private  ProjectUtils(); static boolean acceptedCardType(final @NonNull CreditCardTypes type, final @NonNull Project project); static List<Pair<Project, DiscoveryParams>> combineProjectsAndParams(final @NonNull List<Project> projects, final @NonNull DiscoveryParams params); static @NonNull String deadlineCountdown(final @NonNull Project project, final @NonNull Context context); static @NonNull String deadlineCountdownDetail(final @NonNull Project project, final @NonNull Context context,
    final @NonNull KSString ksString); static @NonNull String deadlineCountdownUnit(final @NonNull Project project, final @NonNull Context context); static int deadlineCountdownValue(final @NonNull Project project); static boolean isCompleted(final @NonNull Project project); static boolean isProjectNamePunctuated(final @NonNull String name); static @Nullable Metadata metadataForProject(final @NonNull Project project); static int photoHeightFromWidthRatio(final int width); static @NonNull Long timeInSecondsOfDuration(final @NonNull Project project); static @NonNull Long timeInSecondsUntilDeadline(final @NonNull Project project); static boolean userIsCreator(final @NonNull Project project, final @Nullable User user); static boolean isUSUserViewingNonUSProject(final @NonNull String userCountry, final @NonNull String projectCountry);  }