@Test public void createCategoriesArray_returns_empty_array_for_empty_collection() throws Exception { final JSONArray array = serializer.createCategoriesArray(Collections.emptyList()); assertEquals(0, array.length()); }
@VisibleForTesting @NonNull JSONArray createCategoriesArray(List<KVCategory> categories) throws JSONException { final JSONArray categoriesJsonArray = new JSONArray(); for (KVCategory category : categories) { if (category.isEmpty()) { continue; } final JSONObject categoryJsonObject = createCategoryObject(category); categoriesJsonArray.put(categoryJsonObject); } return categoriesJsonArray; }
KVJsonSerializer { @VisibleForTesting @NonNull JSONArray createCategoriesArray(List<KVCategory> categories) throws JSONException { final JSONArray categoriesJsonArray = new JSONArray(); for (KVCategory category : categories) { if (category.isEmpty()) { continue; } final JSONObject categoryJsonObject = createCategoryObject(category); categoriesJsonArray.put(categoryJsonObject); } return categoriesJsonArray; } }
KVJsonSerializer { @VisibleForTesting @NonNull JSONArray createCategoriesArray(List<KVCategory> categories) throws JSONException { final JSONArray categoriesJsonArray = new JSONArray(); for (KVCategory category : categories) { if (category.isEmpty()) { continue; } final JSONObject categoryJsonObject = createCategoryObject(category); categoriesJsonArray.put(categoryJsonObject); } return categoriesJsonArray; }  }
KVJsonSerializer { @VisibleForTesting @NonNull JSONArray createCategoriesArray(List<KVCategory> categories) throws JSONException { final JSONArray categoriesJsonArray = new JSONArray(); for (KVCategory category : categories) { if (category.isEmpty()) { continue; } final JSONObject categoryJsonObject = createCategoryObject(category); categoriesJsonArray.put(categoryJsonObject); } return categoriesJsonArray; }   }
KVJsonSerializer { @VisibleForTesting @NonNull JSONArray createCategoriesArray(List<KVCategory> categories) throws JSONException { final JSONArray categoriesJsonArray = new JSONArray(); for (KVCategory category : categories) { if (category.isEmpty()) { continue; } final JSONObject categoryJsonObject = createCategoryObject(category); categoriesJsonArray.put(categoryJsonObject); } return categoriesJsonArray; }    }