String data = FileLoader.loadFileOnClasspath("/TestData/Templates/attachment1.xml");
// Using the standard Java 6 base64 encoder
String base64data = Base64.encodeBase64String(data.getBytes());
template.setAttachment(base64data);
template.setTimeAuthored(new DateValue("20130101"));
AuthorPersonUniversal author = AuthorPersonUniversalTest.createFull();
template.setAuthor(author);
RelatedEntity informant = RelatedEntityTest.createFull();
template.setInformant(informant);
AttachmentSubject subject = new AttachmentSubject();
subject.setAwarenessCode(TargetAwareness._fullawareness);
subject.setSubjectRelationshipType(PersonalRelationshipRoleType._FamilyMember);
subject.addSubjectAddress(new Address()
.addAddressLine("Appleton House")
.addAddressLine("Lanchester Road")
.setCity("Grimsby")
.setPostcode("DN3 1UJ"));
subject.addSubjectTelephoneNumber(new Telecom("tel:01472354321"));
subject.addSubjectName(new PersonName("Mr", "Mark", "Smith"));
subject.setSubjectSex(Sex._Male);
subject.setSubjectBirthTime(new DateValue("19490101"));
template.addAttachmentSubject(subject);
return template;
}