private void runApp() throws SparkPostException, IOException { client = this.newConfiguredClient(); RestConnection connection = new RestConnection(client, getEndPoint()); // Get All Templates TemplateListResponse listResponse = ResourceTemplates.listAll(connection); List<TemplateItem> results = listResponse.getResults(); for (TemplateItem item : results) { // Delete any template with the name "_TMP_TEMPLATE_TEST" if (item.getName().equals(SAMPLE_TEMPLATE_NAME)) { deleteTemplate(connection, item.getId()); } } }