@Test public void testRefTag() { assertEquals( DiscoveryParamsUtils.refTag(DiscoveryParams.builder().category(CategoryFactory.artCategory()).build()), RefTag.category() ); assertEquals( RefTag.category(DiscoveryParams.Sort.POPULAR), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().category(CategoryFactory.artCategory()).sort(DiscoveryParams.Sort.POPULAR).build()) ); assertEquals( RefTag.city(), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().location(LocationFactory.germany()).build()) ); assertEquals( RefTag.recommended(), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().staffPicks(true).build()) ); assertEquals( RefTag.recommended(DiscoveryParams.Sort.POPULAR), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().staffPicks(true).sort(DiscoveryParams.Sort.POPULAR).build()) ); assertEquals( RefTag.social(), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().social(1).build()) ); assertEquals( RefTag.search(), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().term("art").build()) ); assertEquals( RefTag.discovery(), DiscoveryParamsUtils.refTag(DiscoveryParams.builder().build()) ); }
public static @NonNull RefTag refTag(final @NonNull DiscoveryParams params) { if (params.isCategorySet()) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.category(sort); } return RefTag.category(); } if (params.location() != null) { return RefTag.city(); } final boolean staffPicks = isTrue(params.staffPicks()); if (staffPicks) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.recommended(sort); } return RefTag.recommended(); } final Integer tagId = params.tagId(); if (tagId != null) { return RefTag.collection(tagId); } if (isNonZero(params.social())) { return RefTag.social(); } if (params.term() != null) { return RefTag.search(); } return RefTag.discovery(); }
DiscoveryParamsUtils { public static @NonNull RefTag refTag(final @NonNull DiscoveryParams params) { if (params.isCategorySet()) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.category(sort); } return RefTag.category(); } if (params.location() != null) { return RefTag.city(); } final boolean staffPicks = isTrue(params.staffPicks()); if (staffPicks) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.recommended(sort); } return RefTag.recommended(); } final Integer tagId = params.tagId(); if (tagId != null) { return RefTag.collection(tagId); } if (isNonZero(params.social())) { return RefTag.social(); } if (params.term() != null) { return RefTag.search(); } return RefTag.discovery(); } }
DiscoveryParamsUtils { public static @NonNull RefTag refTag(final @NonNull DiscoveryParams params) { if (params.isCategorySet()) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.category(sort); } return RefTag.category(); } if (params.location() != null) { return RefTag.city(); } final boolean staffPicks = isTrue(params.staffPicks()); if (staffPicks) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.recommended(sort); } return RefTag.recommended(); } final Integer tagId = params.tagId(); if (tagId != null) { return RefTag.collection(tagId); } if (isNonZero(params.social())) { return RefTag.social(); } if (params.term() != null) { return RefTag.search(); } return RefTag.discovery(); } private  DiscoveryParamsUtils(); }
DiscoveryParamsUtils { public static @NonNull RefTag refTag(final @NonNull DiscoveryParams params) { if (params.isCategorySet()) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.category(sort); } return RefTag.category(); } if (params.location() != null) { return RefTag.city(); } final boolean staffPicks = isTrue(params.staffPicks()); if (staffPicks) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.recommended(sort); } return RefTag.recommended(); } final Integer tagId = params.tagId(); if (tagId != null) { return RefTag.collection(tagId); } if (isNonZero(params.social())) { return RefTag.social(); } if (params.term() != null) { return RefTag.search(); } return RefTag.discovery(); } private  DiscoveryParamsUtils(); static @NonNull RefTag refTag(final @NonNull DiscoveryParams params); }
DiscoveryParamsUtils { public static @NonNull RefTag refTag(final @NonNull DiscoveryParams params) { if (params.isCategorySet()) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.category(sort); } return RefTag.category(); } if (params.location() != null) { return RefTag.city(); } final boolean staffPicks = isTrue(params.staffPicks()); if (staffPicks) { final DiscoveryParams.Sort sort = params.sort(); if (sort != null) { return RefTag.recommended(sort); } return RefTag.recommended(); } final Integer tagId = params.tagId(); if (tagId != null) { return RefTag.collection(tagId); } if (isNonZero(params.social())) { return RefTag.social(); } if (params.term() != null) { return RefTag.search(); } return RefTag.discovery(); } private  DiscoveryParamsUtils(); static @NonNull RefTag refTag(final @NonNull DiscoveryParams params);  }