### Question:
FlexBoxComponent extends FlexMessageComponent { public static Builder newBuilder(@NonNull Layout layout, @NonNull List<FlexMessageComponent> contents) { return new Builder(layout, contents); } private  FlexBoxComponent(); private  FlexBoxComponent(@NonNull Builder builder); static Builder newBuilder(@NonNull Layout layout,
                                     @NonNull List<FlexMessageComponent> contents); @NonNull @Override JSONObject toJsonObject();  }### Answer:
@Test public void all_fields() throws JSONException { component = FlexBoxComponent.newBuilder(FlexMessageComponent.Layout.HORIZONTAL, contents) .setFlex(1) .setMargin(FlexMessageComponent.Margin.MD) .setSpacing(FlexMessageComponent.Margin.MD) .setAction(new UriAction("https: .build(); messageShouldBe("{" + " \"type\": \"box\"," + " \"layout\": \"horizontal\"," + " \"contents\": [" + " {" + " \"type\": \"text\"," + " \"text\": \"Hello, World!\"" + " }," + " {" + " \"type\": \"image\"," + " \"url\": \"https: " }" + " ]," + " \"spacing\": \"md\"," + " \"margin\": \"md\"," + " \"action\": {" + " \"type\": \"uri\"," + " \"label\": \"View details\"," + " \"uri\": \"https: " }," + " \"flex\": 1" + "}"); }
@Test public void only_required_fields() throws JSONException { component = FlexBoxComponent.newBuilder(FlexMessageComponent.Layout.VERTICAL, contents).build(); messageShouldBe("{" + " \"type\": \"box\"," + " \"layout\": \"vertical\"," + " \"contents\": [" + " {" + " \"type\": \"text\"," + " \"text\": \"Hello, World!\"" + " }," + " {" + " \"type\": \"image\"," + " \"url\": \"https: " }" + " ]" + "}"); }