SendWithUs { public Snippet[] getSnippets() throws SendWithUsException { String url = getURLEndpoint("snippets"); String response = makeURLRequest(url, "GET"); Gson gson = new Gson(); return gson.fromJson(response, Snippet[].class); } SendWithUs(String apiKey);  SendWithUs(String apiKey, SendWithUsApiLocation sendWithUsApiLocation); @Deprecated Email[] emails(); Email[] templates(); Email template(String templateId); Email template(String templateId, String locale); TemplateVersionDetails templateVersion(String templateId, String versionId); TemplateVersionDetails templateVersion(String templateId, String versionId, String locale); SendReceipt send(String emailId, Map<String, Object> recipient,
            Map<String, Object> emailData); SendReceipt send(String emailId, Map<String, Object> recipient,
            Map<String, Object> sender, Map<String, Object> emailData); SendReceipt send(String emailId, Map<String, Object> recipient,
            Map<String, Object> sender, Map<String, Object> emailData,
            Map<String, Object>[] cc); SendReceipt send(String emailId, Map<String, Object> recipient,
            Map<String, Object> sender, Map<String, Object> emailData,
            Map<String, Object>[] cc, Map<String, Object>[] bcc); SendReceipt send(String emailId, Map<String, Object> recipient,
            Map<String, Object> sender, Map<String, Object> emailData,
            Map<String, Object>[] cc, Map<String, Object>[] bcc,
            String[] attachment_paths); SendReceipt send(String emailId, Map<String, Object> recipient,
            Map<String, Object> sender, Map<String, Object> emailData,
            Map<String, Object>[] cc, Map<String, Object>[] bcc,
            String[] attachment_paths, String espAccount); SendReceipt send(String emailId, Map<String, Object> recipient,
                            Map<String, Object> sender, Map<String, Object> emailData,
                            Map<String, Object>[] cc, Map<String, Object>[] bcc,
                            String[] attachment_paths, String espAccount,
                            String locale); SendReceipt send(String emailId, Map<String, Object> recipient,
                            Map<String, Object> sender, Map<String, Object> emailData,
                            Map<String, Object>[] cc, Map<String, Object>[] bcc,
                            String[] attachment_paths, String espAccount,
                            String locale, Map<String, String> headers); SendReceipt send(SendWithUsSendRequest request); RenderedTemplate render(String templateId,
            Map<String, Object> templateData); ActivatedDrip startOnDripCampaign(String dripCampaignId, SendWithUsDripRequest dripRequest); DeactivatedDrip removeFromDripCampaign(String customerEmailAddress, String dripCampaignId ); DeactivatedDrips deactivateDrips(String customerEmailAddress); CustomerReceipt createUpdateCustomer(String customerEmailAddress,
            Map<String, Object> customerData); SendReceipt resend(String logId); Snippet[] getSnippets(); Snippet getSnippet(String snippetId); SnippetReceipt createSnippet(String name, String body); SnippetReceipt updateSnippet(String snippetId, String name, String body); APIReceipt deleteSnippet(String snippetId); static final String CLIENT_VERSION; static final String CLIENT_LANG; static final String SWU_API_HEADER; static final String SWU_CLIENT_HEADER; }
@Test public void testGetSnippets() throws Exception { Mockito.doReturn( "[{'id': 'test-snippet-id', 'name': 'test-snippet', 'body': '<h1>test header</h1>', 'created': 1414091325}]" ).when(sendwithusAPI).makeURLRequest( Mockito.endsWith("snippets"), Mockito.eq("GET") ); Snippet[] snippets = sendwithusAPI.getSnippets(); assertNotNull(snippets); assertTrue(snippets.length > 0); assertNotNull(snippets[0]); assertEquals("test-snippet", snippets[0].getName()); }