@Test public void serializes() { String output = new CategorySerializer().serialize(expectedInput); Assert.assertEquals(expectedOutput, output); }
@Override @Nullable public String serialize(Category[] categories) { if (categories != null) { StringBuilder stringBuilder = new StringBuilder(); for (Category category : categories) { stringBuilder.append(category.getStableId()); if (category != categories[categories.length - 1]) { stringBuilder.append(';'); } } return stringBuilder.toString(); } else { return null; } }
CategorySerializer implements Serializer<Category[], String> { @Override @Nullable public String serialize(Category[] categories) { if (categories != null) { StringBuilder stringBuilder = new StringBuilder(); for (Category category : categories) { stringBuilder.append(category.getStableId()); if (category != categories[categories.length - 1]) { stringBuilder.append(';'); } } return stringBuilder.toString(); } else { return null; } } }
CategorySerializer implements Serializer<Category[], String> { @Override @Nullable public String serialize(Category[] categories) { if (categories != null) { StringBuilder stringBuilder = new StringBuilder(); for (Category category : categories) { stringBuilder.append(category.getStableId()); if (category != categories[categories.length - 1]) { stringBuilder.append(';'); } } return stringBuilder.toString(); } else { return null; } }  }
CategorySerializer implements Serializer<Category[], String> { @Override @Nullable public String serialize(Category[] categories) { if (categories != null) { StringBuilder stringBuilder = new StringBuilder(); for (Category category : categories) { stringBuilder.append(category.getStableId()); if (category != categories[categories.length - 1]) { stringBuilder.append(';'); } } return stringBuilder.toString(); } else { return null; } }  @Override @Nullable String serialize(Category[] categories); @Override @Nullable Category[] deserialize(String string); }
CategorySerializer implements Serializer<Category[], String> { @Override @Nullable public String serialize(Category[] categories) { if (categories != null) { StringBuilder stringBuilder = new StringBuilder(); for (Category category : categories) { stringBuilder.append(category.getStableId()); if (category != categories[categories.length - 1]) { stringBuilder.append(';'); } } return stringBuilder.toString(); } else { return null; } }  @Override @Nullable String serialize(Category[] categories); @Override @Nullable Category[] deserialize(String string);  }