@Test public void testCreate() throws Exception { productList.addProduct(createSearchResult(1)); productList.addProduct(createSearchResult(2)); productList.addProduct(createSearchResult(3)); final Bundle bundle = new Bundle(); productList.writeToBundle(bundle); final ProductList productListNew = ProductList.create(bundle); assertEquals(this.productList.get(0), productListNew.get(0)); assertEquals(this.productList.get(1), productListNew.get(1)); assertEquals(this.productList.get(2), productListNew.get(2)); }
public static ProductList create(@Nullable Bundle bundle) { final List<SearchResult> searchResults; if (bundle != null) { searchResults = Parcels.unwrap(bundle.getParcelable(SearchResult.class.getName())); } else { searchResults = new ArrayList<>(); } return new ProductList(searchResults); }
ProductList { public static ProductList create(@Nullable Bundle bundle) { final List<SearchResult> searchResults; if (bundle != null) { searchResults = Parcels.unwrap(bundle.getParcelable(SearchResult.class.getName())); } else { searchResults = new ArrayList<>(); } return new ProductList(searchResults); } }
ProductList { public static ProductList create(@Nullable Bundle bundle) { final List<SearchResult> searchResults; if (bundle != null) { searchResults = Parcels.unwrap(bundle.getParcelable(SearchResult.class.getName())); } else { searchResults = new ArrayList<>(); } return new ProductList(searchResults); } private  ProductList(@NonNull final List<SearchResult> searchResults); }
ProductList { public static ProductList create(@Nullable Bundle bundle) { final List<SearchResult> searchResults; if (bundle != null) { searchResults = Parcels.unwrap(bundle.getParcelable(SearchResult.class.getName())); } else { searchResults = new ArrayList<>(); } return new ProductList(searchResults); } private  ProductList(@NonNull final List<SearchResult> searchResults); static ProductList create(@Nullable Bundle bundle); void setOnProductListChanged(@Nullable OnProductListChanged onProductListChanged); void writeToBundle(@NonNull final Bundle bundle); void addProduct(SearchResult searchResult); void createProductPlaceholder(); void removeProductPlaceholder(); boolean itemExists(String code); int size(); SearchResult get(int position); }
ProductList { public static ProductList create(@Nullable Bundle bundle) { final List<SearchResult> searchResults; if (bundle != null) { searchResults = Parcels.unwrap(bundle.getParcelable(SearchResult.class.getName())); } else { searchResults = new ArrayList<>(); } return new ProductList(searchResults); } private  ProductList(@NonNull final List<SearchResult> searchResults); static ProductList create(@Nullable Bundle bundle); void setOnProductListChanged(@Nullable OnProductListChanged onProductListChanged); void writeToBundle(@NonNull final Bundle bundle); void addProduct(SearchResult searchResult); void createProductPlaceholder(); void removeProductPlaceholder(); boolean itemExists(String code); int size(); SearchResult get(int position);  }