@Test public void build1() { Publisher publisher = new Publisher.Builder() .setId(null) .setName(null) .setDomain(null) .addCategory(null) .addCategories(null) .build(); publisher.build(builder); Context.App.Publisher protoPublisher = builder.getPub(); assertNotNull(protoPublisher); assertEquals("", protoPublisher.getId()); assertEquals("", protoPublisher.getName()); assertEquals("", protoPublisher.getDomain()); assertNotNull(protoPublisher.getCatList()); assertTrue(protoPublisher.getCatList().isEmpty()); }
void build(Context.App.Builder builder) { Context.App.Publisher.Builder publisherBuilder = Context.App.Publisher.newBuilder(); if (id != null) { publisherBuilder.setId(id); } if (name != null) { publisherBuilder.setName(name); } if (domain != null) { publisherBuilder.setDomain(domain); } if (categories != null) { publisherBuilder.addAllCat(categories); } builder.setPub(publisherBuilder.build()); }
Publisher { void build(Context.App.Builder builder) { Context.App.Publisher.Builder publisherBuilder = Context.App.Publisher.newBuilder(); if (id != null) { publisherBuilder.setId(id); } if (name != null) { publisherBuilder.setName(name); } if (domain != null) { publisherBuilder.setDomain(domain); } if (categories != null) { publisherBuilder.addAllCat(categories); } builder.setPub(publisherBuilder.build()); } }
Publisher { void build(Context.App.Builder builder) { Context.App.Publisher.Builder publisherBuilder = Context.App.Publisher.newBuilder(); if (id != null) { publisherBuilder.setId(id); } if (name != null) { publisherBuilder.setName(name); } if (domain != null) { publisherBuilder.setDomain(domain); } if (categories != null) { publisherBuilder.addAllCat(categories); } builder.setPub(publisherBuilder.build()); } private  Publisher(@Nullable String id,
                      @Nullable String name,
                      @Nullable String domain,
                      @Nullable List<String> categories); }
Publisher { void build(Context.App.Builder builder) { Context.App.Publisher.Builder publisherBuilder = Context.App.Publisher.newBuilder(); if (id != null) { publisherBuilder.setId(id); } if (name != null) { publisherBuilder.setName(name); } if (domain != null) { publisherBuilder.setDomain(domain); } if (categories != null) { publisherBuilder.addAllCat(categories); } builder.setPub(publisherBuilder.build()); } private  Publisher(@Nullable String id,
                      @Nullable String name,
                      @Nullable String domain,
                      @Nullable List<String> categories);  }
Publisher { void build(Context.App.Builder builder) { Context.App.Publisher.Builder publisherBuilder = Context.App.Publisher.newBuilder(); if (id != null) { publisherBuilder.setId(id); } if (name != null) { publisherBuilder.setName(name); } if (domain != null) { publisherBuilder.setDomain(domain); } if (categories != null) { publisherBuilder.addAllCat(categories); } builder.setPub(publisherBuilder.build()); } private  Publisher(@Nullable String id,
                      @Nullable String name,
                      @Nullable String domain,
                      @Nullable List<String> categories);   }