@Test public void modal_missingTitle_throwsException() { MessagesProto.Content incompleteModalProto = MessagesProto.Content.newBuilder() .setModal( MessagesProto.ModalMessage.newBuilder() .setAction(ACTION_PROTO) .setActionButton(BUTTON_PROTO) .setBackgroundHexColor(MESSAGE_BACKGROUND_HEX_STRING) .setBody(BODY_PROTO) .setImageUrl(IMAGE_URL_STRING)) .build(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> decode(incompleteModalProto)); assertThat(e).hasMessageThat().contains("Modal model must have a title"); }
private static Button decode(MessagesProto.Button in) { Button.Builder builder = Button.builder(); if (!TextUtils.isEmpty(in.getButtonHexColor())) { builder.setButtonHexColor(in.getButtonHexColor()); } if (in.hasText()) { builder.setText(decode(in.getText())); } return builder.build(); }
ProtoMarshallerClient { private static Button decode(MessagesProto.Button in) { Button.Builder builder = Button.builder(); if (!TextUtils.isEmpty(in.getButtonHexColor())) { builder.setButtonHexColor(in.getButtonHexColor()); } if (in.hasText()) { builder.setText(decode(in.getText())); } return builder.build(); } }
ProtoMarshallerClient { private static Button decode(MessagesProto.Button in) { Button.Builder builder = Button.builder(); if (!TextUtils.isEmpty(in.getButtonHexColor())) { builder.setButtonHexColor(in.getButtonHexColor()); } if (in.hasText()) { builder.setText(decode(in.getText())); } return builder.build(); } @Inject  ProtoMarshallerClient(); }
ProtoMarshallerClient { private static Button decode(MessagesProto.Button in) { Button.Builder builder = Button.builder(); if (!TextUtils.isEmpty(in.getButtonHexColor())) { builder.setButtonHexColor(in.getButtonHexColor()); } if (in.hasText()) { builder.setText(decode(in.getText())); } return builder.build(); } @Inject  ProtoMarshallerClient(); static InAppMessage decode(
      @Nonnull MessagesProto.Content in,
      @NonNull String campaignId,
      @NonNull String campaignName,
      boolean isTestMessage,
      @Nullable Map<String, String> data); }
ProtoMarshallerClient { private static Button decode(MessagesProto.Button in) { Button.Builder builder = Button.builder(); if (!TextUtils.isEmpty(in.getButtonHexColor())) { builder.setButtonHexColor(in.getButtonHexColor()); } if (in.hasText()) { builder.setText(decode(in.getText())); } return builder.build(); } @Inject  ProtoMarshallerClient(); static InAppMessage decode(
      @Nonnull MessagesProto.Content in,
      @NonNull String campaignId,
      @NonNull String campaignName,
      boolean isTestMessage,
      @Nullable Map<String, String> data);  }