### Question:
SwrveMessageTextTemplatingChecks { public static boolean checkTemplating(SwrveMessage message, Map<String, String> properties) { try { for (final SwrveMessageFormat format : message.getFormats()) { for (final SwrveImage image : format.getImages()) { String imageText = image.getText(); if (!SwrveHelper.isNullOrEmpty(imageText)) { String personalizedText = SwrveTextTemplating.apply(imageText, properties); if (SwrveHelper.isNullOrEmpty(personalizedText)) { SwrveLogger.i("Text template could not be resolved: " + imageText + " in given properties."); return false; } else if (SwrveTextTemplating.hasPatternMatch(personalizedText)) { SwrveLogger.i("Not showing campaign with personalisation outside of Message Center / without personalisation info provided."); return false; } } } for (final SwrveButton button : format.getButtons()) { String buttonText = button.getText(); if (!SwrveHelper.isNullOrEmpty(buttonText)) { String personalizedText = SwrveTextTemplating.apply(buttonText, properties); if (SwrveHelper.isNullOrEmpty(personalizedText)) { SwrveLogger.i("Text template could not be resolved: " + buttonText + " in given properties."); return false; } else if (SwrveTextTemplating.hasPatternMatch(personalizedText)) { SwrveLogger.i("Not showing campaign with personalisation outside of Message Center / without personalisation info provided."); return false; } } String personalizedButtonAction = button.getAction(); if ((button.getActionType() == SwrveActionType.Custom || button.getActionType() == SwrveActionType.CopyToClipboard) && !SwrveHelper.isNullOrEmpty(personalizedButtonAction)) { personalizedButtonAction = SwrveTextTemplating.apply(personalizedButtonAction, properties); if (SwrveHelper.isNullOrEmpty(personalizedButtonAction)) { SwrveLogger.i("Button action template could not be resolved: " + button.getAction() + " in given properties."); return false; } else if (SwrveTextTemplating.hasPatternMatch(personalizedButtonAction)) { SwrveLogger.i("Not showing campaign with personalisation outside of Message Center / without personalisation info provided."); return false; } } } } } catch(SwrveSDKTextTemplatingException exp) { SwrveLogger.e("Not showing campaign, error with personalisation", exp); return false; } return true; }  static boolean checkTemplating(SwrveMessage message, Map<String, String> properties);  }### Answer:
@Test public void testChecks() throws Exception { String messageJson = SwrveTestUtils.getAssetAsText(mActivity, "personalized_message.json"); SwrveMessage message = new SwrveMessage(null, new JSONObject(messageJson), null); assertFalse(SwrveMessageTextTemplatingChecks.checkTemplating(message, null)); List<String> requiredProps = new ArrayList<>(); requiredProps.add("test_image_text"); requiredProps.add("test_button_action"); requiredProps.add("test_copy_to_clipboard"); Map<String, String> properties = new HashMap<>(); for (String prop : requiredProps) { assertFalse(SwrveMessageTextTemplatingChecks.checkTemplating(message, properties)); properties.put(prop, "defined"); } assertTrue(SwrveMessageTextTemplatingChecks.checkTemplating(message, properties)); }