@Test public void testCreateMailTextCommentEmpty() { ProjectOfferData offer = new ProjectOfferData(); offer.first = "Hans"; offer.name = "Wurst"; offer.isAfforestation = true; offer.isLeasing = true; offer.isSelling = true; offer.lease = "lange"; offer.location = "hier"; offer.mail = "hans@wurst.de"; offer.owner = "Bernd Wurst"; offer.purpose = ""; offer.size = "1m²"; offer.comment = ""; String createdText = ProjectOfferHelper.createMailText(offer, null); String compareText = createCompareText(true, true, true, true, true, false, false); List<String> createdList = cutByNewLines(createdText); List<String> compareList = cutByNewLines(compareText); for (int i = 0; i < createdList.size(); i++) { assertEquals("Mail text isn't equal at line " + i + "!", createdList.get(i), compareList.get(i)); } }
protected static String createMailText(ProjectOfferData projectOffer, User user) { final StringBuilder text = new StringBuilder(); if (user != null) { text.append("User: " + user + "\n"); } text.append("Name: " + projectOffer.getName() + "\n"); final String first = projectOffer.getFirst(); if (!StringHelper.isEmpty(first)) { text.append("Vorname: " + first + "\n"); } text.append("E-Mail: " + projectOffer.getMail() + "\n"); text.append("Ort: " + projectOffer.getLocation() + "\n"); text.append("Größe: " + projectOffer.getSize() + "\n"); text.append("Eigentümer: " + projectOffer.getOwner() + "\n"); text.append("Aufforstung: " + (projectOffer.isAfforestation() ? "ja" : "nein") + "\n"); final String purpose = projectOffer.getPurpose(); if (!StringHelper.isEmpty(purpose)) { text.append("Nutzung: " + purpose + "\n"); } text.append("Verkauf: " + (projectOffer.isSelling() ? "ja" : "nein") + "\n"); final boolean leasing = projectOffer.isLeasing(); text.append("Pachtverträge: " + (leasing ? "ja" : "nein") + "\n"); if (leasing) { text.append("Zeit der Pachtverträge: " + projectOffer.getLease() + "\n"); } final String comment = projectOffer.getComment(); if (!StringHelper.isEmpty(comment)) { text.append("Bemerkungen: " + comment + "\n"); } return text.toString(); }
ProjectOfferHelper { protected static String createMailText(ProjectOfferData projectOffer, User user) { final StringBuilder text = new StringBuilder(); if (user != null) { text.append("User: " + user + "\n"); } text.append("Name: " + projectOffer.getName() + "\n"); final String first = projectOffer.getFirst(); if (!StringHelper.isEmpty(first)) { text.append("Vorname: " + first + "\n"); } text.append("E-Mail: " + projectOffer.getMail() + "\n"); text.append("Ort: " + projectOffer.getLocation() + "\n"); text.append("Größe: " + projectOffer.getSize() + "\n"); text.append("Eigentümer: " + projectOffer.getOwner() + "\n"); text.append("Aufforstung: " + (projectOffer.isAfforestation() ? "ja" : "nein") + "\n"); final String purpose = projectOffer.getPurpose(); if (!StringHelper.isEmpty(purpose)) { text.append("Nutzung: " + purpose + "\n"); } text.append("Verkauf: " + (projectOffer.isSelling() ? "ja" : "nein") + "\n"); final boolean leasing = projectOffer.isLeasing(); text.append("Pachtverträge: " + (leasing ? "ja" : "nein") + "\n"); if (leasing) { text.append("Zeit der Pachtverträge: " + projectOffer.getLease() + "\n"); } final String comment = projectOffer.getComment(); if (!StringHelper.isEmpty(comment)) { text.append("Bemerkungen: " + comment + "\n"); } return text.toString(); } }
ProjectOfferHelper { protected static String createMailText(ProjectOfferData projectOffer, User user) { final StringBuilder text = new StringBuilder(); if (user != null) { text.append("User: " + user + "\n"); } text.append("Name: " + projectOffer.getName() + "\n"); final String first = projectOffer.getFirst(); if (!StringHelper.isEmpty(first)) { text.append("Vorname: " + first + "\n"); } text.append("E-Mail: " + projectOffer.getMail() + "\n"); text.append("Ort: " + projectOffer.getLocation() + "\n"); text.append("Größe: " + projectOffer.getSize() + "\n"); text.append("Eigentümer: " + projectOffer.getOwner() + "\n"); text.append("Aufforstung: " + (projectOffer.isAfforestation() ? "ja" : "nein") + "\n"); final String purpose = projectOffer.getPurpose(); if (!StringHelper.isEmpty(purpose)) { text.append("Nutzung: " + purpose + "\n"); } text.append("Verkauf: " + (projectOffer.isSelling() ? "ja" : "nein") + "\n"); final boolean leasing = projectOffer.isLeasing(); text.append("Pachtverträge: " + (leasing ? "ja" : "nein") + "\n"); if (leasing) { text.append("Zeit der Pachtverträge: " + projectOffer.getLease() + "\n"); } final String comment = projectOffer.getComment(); if (!StringHelper.isEmpty(comment)) { text.append("Bemerkungen: " + comment + "\n"); } return text.toString(); }  }
ProjectOfferHelper { protected static String createMailText(ProjectOfferData projectOffer, User user) { final StringBuilder text = new StringBuilder(); if (user != null) { text.append("User: " + user + "\n"); } text.append("Name: " + projectOffer.getName() + "\n"); final String first = projectOffer.getFirst(); if (!StringHelper.isEmpty(first)) { text.append("Vorname: " + first + "\n"); } text.append("E-Mail: " + projectOffer.getMail() + "\n"); text.append("Ort: " + projectOffer.getLocation() + "\n"); text.append("Größe: " + projectOffer.getSize() + "\n"); text.append("Eigentümer: " + projectOffer.getOwner() + "\n"); text.append("Aufforstung: " + (projectOffer.isAfforestation() ? "ja" : "nein") + "\n"); final String purpose = projectOffer.getPurpose(); if (!StringHelper.isEmpty(purpose)) { text.append("Nutzung: " + purpose + "\n"); } text.append("Verkauf: " + (projectOffer.isSelling() ? "ja" : "nein") + "\n"); final boolean leasing = projectOffer.isLeasing(); text.append("Pachtverträge: " + (leasing ? "ja" : "nein") + "\n"); if (leasing) { text.append("Zeit der Pachtverträge: " + projectOffer.getLease() + "\n"); } final String comment = projectOffer.getComment(); if (!StringHelper.isEmpty(comment)) { text.append("Bemerkungen: " + comment + "\n"); } return text.toString(); }   }
ProjectOfferHelper { protected static String createMailText(ProjectOfferData projectOffer, User user) { final StringBuilder text = new StringBuilder(); if (user != null) { text.append("User: " + user + "\n"); } text.append("Name: " + projectOffer.getName() + "\n"); final String first = projectOffer.getFirst(); if (!StringHelper.isEmpty(first)) { text.append("Vorname: " + first + "\n"); } text.append("E-Mail: " + projectOffer.getMail() + "\n"); text.append("Ort: " + projectOffer.getLocation() + "\n"); text.append("Größe: " + projectOffer.getSize() + "\n"); text.append("Eigentümer: " + projectOffer.getOwner() + "\n"); text.append("Aufforstung: " + (projectOffer.isAfforestation() ? "ja" : "nein") + "\n"); final String purpose = projectOffer.getPurpose(); if (!StringHelper.isEmpty(purpose)) { text.append("Nutzung: " + purpose + "\n"); } text.append("Verkauf: " + (projectOffer.isSelling() ? "ja" : "nein") + "\n"); final boolean leasing = projectOffer.isLeasing(); text.append("Pachtverträge: " + (leasing ? "ja" : "nein") + "\n"); if (leasing) { text.append("Zeit der Pachtverträge: " + projectOffer.getLease() + "\n"); } final String comment = projectOffer.getComment(); if (!StringHelper.isEmpty(comment)) { text.append("Bemerkungen: " + comment + "\n"); } return text.toString(); }    }