diff --git a/.gitignore b/.gitignore index 333c71863b..ca7b2f132a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ release.properties .project .settings/ settings.json + + +*.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 023f63031e..bbcc5a777b 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ If you run into trouble with local tests, use: String accountSid = "ACXXXXXX"; String authToken = "XXXXXXXX"; -Twilio.init(accountSid, authToken); +Twilio twilio = new Twilio(accountSid, authToken); ``` ### Specify Region and/or Edge @@ -83,9 +83,9 @@ Twilio.init(accountSid, authToken); To take advantage of Twilio's [Global Infrastructure](https://www.twilio.com/docs/global-infrastructure), specify the target Region and/or Edge for the client: ```java -Twilio.init(accountSid, authToken); -Twilio.setRegion("au1"); -Twilio.setEdge("sydney"); +Twilio twilio = new Twilio(accountSid, authToken); +twilio.setRegion("au1"); +twilio.setEdge("sydney"); ``` This will result in the `hostname` transforming from `api.twilio.com` to `api.sydney.au1.twilio.com`. @@ -112,11 +112,13 @@ If using these variables, the above client initialization can be skipped. ### Send an SMS ```java +Twilio twilio = new Twilio(accountSid, authToken); + Message message = Message.creator( new PhoneNumber("+15558881234"), // To number new PhoneNumber("+15559994321"), // From number "Hello world!" // SMS body -).create(); +).create(twilio); System.out.println(message.getSid()); ``` @@ -124,13 +126,15 @@ System.out.println(message.getSid()); ### Make a Call ```java +Twilio twilio = new Twilio(accountSid, authToken); + Call call = Call.creator( new PhoneNumber("+15558881234"), // To number new PhoneNumber("+15559994321"), // From number // Read TwiML at this URL when a call connects (hold music) new URI("http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient") -).create(); +).create(twilio); System.out.println(call.getSid()); ``` @@ -141,11 +145,13 @@ System.out.println(call.getSid()); import com.twilio.exception.ApiException; try { + Twilio twilio = new Twilio(accountSid, authToken); + Message message = Message.creator( new PhoneNumber("+15558881234"), // To number new PhoneNumber("+15559994321"), // From number "Hello world!" // SMS body - ).create(); + ).create(twilio); System.out.println(message.getSid()); } catch (final ApiException e) { diff --git a/src/main/java/com/twilio/Twilio.java b/src/main/java/com/twilio/Twilio.java index d4d4c2b0eb..ad44679692 100644 --- a/src/main/java/com/twilio/Twilio.java +++ b/src/main/java/com/twilio/Twilio.java @@ -12,27 +12,21 @@ import java.util.Objects; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.io.File; + /** - * Singleton class to initialize Twilio environment. + * Class to initialize Twilio environment. */ -public class Twilio { - - public static final String VERSION = "8.27.0"; - public static final String JAVA_VERSION = System.getProperty("java.version"); - - private static String username = System.getenv("TWILIO_ACCOUNT_SID"); - private static String password = System.getenv("TWILIO_AUTH_TOKEN"); - private static String accountSid; // username used if this is null - private static String region = System.getenv("TWILIO_REGION"); - private static String edge = System.getenv("TWILIO_EDGE"); - private static volatile TwilioRestClient restClient; +public class Twilio implements TwilioAPI { + + private String username = System.getenv("TWILIO_ACCOUNT_SID"); + private String password = System.getenv("TWILIO_AUTH_TOKEN"); + private String accountSid; // username used if this is null + private String region = System.getenv("TWILIO_REGION"); + private String edge = System.getenv("TWILIO_EDGE"); + private volatile TwilioRestClient restClient; private static volatile ExecutorService executorService; - private Twilio() { - } - /* * Ensures that the ExecutorService is shutdown when the JVM exits. */ @@ -53,9 +47,9 @@ public void run() { * @param username account to use * @param password auth token for the account */ - public static synchronized void init(final String username, final String password) { - Twilio.setUsername(username); - Twilio.setPassword(password); + public Twilio(final String username, final String password) { + setUsername(username); + setPassword(password); } /** @@ -65,90 +59,78 @@ public static synchronized void init(final String username, final String passwor * @param password auth token for the account * @param accountSid account sid to use */ - public static synchronized void init(final String username, final String password, final String accountSid) { - Twilio.setUsername(username); - Twilio.setPassword(password); - Twilio.setAccountSid(accountSid); + public Twilio(final String username, final String password, final String accountSid) { + setUsername(username); + setPassword(password); + setAccountSid(accountSid); } + /** - * Set the username. - * - * @param username account to use - * @throws AuthenticationException if username is null + * {@inheritdoc} */ - public static synchronized void setUsername(final String username) { + public synchronized void setUsername(final String username) { if (username == null) { throw new AuthenticationException("Username can not be null"); } - if (!username.equals(Twilio.username)) { - Twilio.invalidate(); + if (!username.equals(this.username)) { + this.invalidate(); } - Twilio.username = username; + this.username = username; } /** - * Set the auth token. - * - * @param password auth token to use - * @throws AuthenticationException if password is null + * {@inheritdoc} */ - public static synchronized void setPassword(final String password) { + public synchronized void setPassword(final String password) { if (password == null) { throw new AuthenticationException("Password can not be null"); } - if (!password.equals(Twilio.password)) { - Twilio.invalidate(); + if (!password.equals(this.password)) { + this.invalidate(); } - Twilio.password = password; + this.password = password; } /** - * Set the account sid. - * - * @param accountSid account sid to use - * @throws AuthenticationException if account sid is null + * {@inheritdoc} */ - public static synchronized void setAccountSid(final String accountSid) { + public synchronized void setAccountSid(final String accountSid) { if (accountSid == null) { throw new AuthenticationException("AccountSid can not be null"); } - if (!accountSid.equals(Twilio.accountSid)) { - Twilio.invalidate(); + if (!accountSid.equals(this.accountSid)) { + this.invalidate(); } - Twilio.accountSid = accountSid; + this.accountSid = accountSid; } /** - * Set the region. - * - * @param region region to make request + * {@inheritdoc} */ - public static synchronized void setRegion(final String region) { - if (!Objects.equals(region, Twilio.region)) { - Twilio.invalidate(); + public synchronized void setRegion(final String region) { + if (!Objects.equals(region, this.region)) { + this.invalidate(); } - Twilio.region = region; + this.region = region; } /** - * Set the edge. - * - * @param edge edge to make request + * {@inheritdoc} */ - public static synchronized void setEdge(final String edge) { - if (!Objects.equals(edge, Twilio.edge)) { - Twilio.invalidate(); + public synchronized void setEdge(final String edge) { + if (!Objects.equals(edge, this.edge)) { + this.invalidate(); } - Twilio.edge = edge; + this.edge = edge; } /** @@ -157,33 +139,29 @@ public static synchronized void setEdge(final String edge) { * @return the Twilio Rest Client * @throws AuthenticationException if initialization required and either accountSid or authToken is null */ - public static TwilioRestClient getRestClient() { - if (Twilio.restClient == null) { - synchronized (Twilio.class) { - if (Twilio.restClient == null) { - Twilio.restClient = buildRestClient(); - } - } + public synchronized TwilioRestClient getRestClient() { + if (restClient == null) { + restClient = buildRestClient(); } - return Twilio.restClient; + return restClient; } - private static TwilioRestClient buildRestClient() { - if (Twilio.username == null || Twilio.password == null) { + private TwilioRestClient buildRestClient() { + if (this.username == null || this.password == null) { throw new AuthenticationException( "TwilioRestClient was used before AccountSid and AuthToken were set, please call Twilio.init()" ); } - TwilioRestClient.Builder builder = new TwilioRestClient.Builder(Twilio.username, Twilio.password); + TwilioRestClient.Builder builder = new TwilioRestClient.Builder(this.username, this.password); - if (Twilio.accountSid != null) { - builder.accountSid(Twilio.accountSid); + if (this.accountSid != null) { + builder.accountSid(this.accountSid); } - builder.region(Twilio.region); - builder.edge(Twilio.edge); + builder.region(this.region); + builder.edge(this.edge); return builder.build(); } @@ -193,10 +171,8 @@ private static TwilioRestClient buildRestClient() { * * @param restClient rest client to use */ - public static void setRestClient(final TwilioRestClient restClient) { - synchronized (Twilio.class) { - Twilio.restClient = restClient; - } + public synchronized void setRestClient(final TwilioRestClient restClient) { + this.restClient = restClient; } /** @@ -206,11 +182,7 @@ public static void setRestClient(final TwilioRestClient restClient) { */ public static ExecutorService getExecutorService() { if (Twilio.executorService == null) { - synchronized (Twilio.class) { - if (Twilio.executorService == null) { - Twilio.executorService = Executors.newCachedThreadPool(); - } - } + Twilio.executorService = Executors.newCachedThreadPool(); } return Twilio.executorService; } @@ -221,9 +193,7 @@ public static ExecutorService getExecutorService() { * @param executorService executor service to use */ public static void setExecutorService(final ExecutorService executorService) { - synchronized (Twilio.class) { - Twilio.executorService = executorService; - } + Twilio.executorService = executorService; } /** @@ -251,16 +221,16 @@ public static void validateSslCertificate() { /** * Invalidates the volatile state held in the Twilio singleton. */ - private static void invalidate() { - Twilio.restClient = null; + private void invalidate() { + this.restClient = null; } /** - * Attempts to gracefully shutdown the ExecutorService if it is present. + * {@inheritdoc} */ - public static synchronized void destroy() { - if (executorService != null) { - executorService.shutdown(); + public synchronized void destroy() { + if (Twilio.executorService != null) { + Twilio.executorService.shutdown(); } } } diff --git a/src/main/java/com/twilio/TwilioAPI.java b/src/main/java/com/twilio/TwilioAPI.java new file mode 100644 index 0000000000..f3c5600b53 --- /dev/null +++ b/src/main/java/com/twilio/TwilioAPI.java @@ -0,0 +1,57 @@ +package com.twilio; + +import com.twilio.exception.AuthenticationException; +import com.twilio.exception.CertificateValidationException; +import com.twilio.http.*; + +import java.util.concurrent.ExecutorService; + +interface TwilioAPI { + + String VERSION = "9.0.0"; + String JAVA_VERSION = System.getProperty("java.version"); + + /** + * Set the username. + * + * @param username account to use + * @throws AuthenticationException if username is null + */ + void setUsername(final String username); + + /** + * Set the auth token. + * + * @param password auth token to use + * @throws AuthenticationException if password is null + */ + void setPassword(final String password); + + /** + * Set the account sid. + * + * @param accountSid account sid to use + * @throws AuthenticationException if account sid is null + */ + void setAccountSid(final String accountSid); + + /** + * Set the region. + * + * @param region region to make request + */ + void setRegion(final String region); + + /** + * Set the edge. + * + * @param edge edge to make request + */ + void setEdge(final String edge); + + /** + * Attempts to gracefully shutdown the ExecutorService if it is present. + */ + void destroy(); + +} diff --git a/src/main/java/com/twilio/base/Creator.java b/src/main/java/com/twilio/base/Creator.java index 1008854c0a..5fe7333fd0 100644 --- a/src/main/java/com/twilio/base/Creator.java +++ b/src/main/java/com/twilio/base/Creator.java @@ -15,10 +15,11 @@ public abstract class Creator { /** * Execute an async request using default client. * + * @param tw Twilio object * @return future that resolves to requested object */ - public CompletableFuture createAsync() { - return createAsync(Twilio.getRestClient()); + public CompletableFuture createAsync(Twilio tw) { + return createAsync(tw.getRestClient()); } /** @@ -34,10 +35,11 @@ public CompletableFuture createAsync(final TwilioRestClient client) { /** * Execute a request using default client. * + * @param tw Twilio object * @return Requested object */ - public T create() { - return create(Twilio.getRestClient()); + public T create(Twilio tw) { + return create(tw.getRestClient()); } /** diff --git a/src/main/java/com/twilio/base/Deleter.java b/src/main/java/com/twilio/base/Deleter.java index f6149eb52b..8a6cea3d2b 100644 --- a/src/main/java/com/twilio/base/Deleter.java +++ b/src/main/java/com/twilio/base/Deleter.java @@ -15,10 +15,11 @@ public abstract class Deleter { /** * Execute an async request using default client. * + * @param tw Twilio object * @return future that resolves to true if the object was deleted */ - public CompletableFuture deleteAsync() { - return deleteAsync(Twilio.getRestClient()); + public CompletableFuture deleteAsync(Twilio tw) { + return deleteAsync(tw.getRestClient()); } /** @@ -34,10 +35,11 @@ public CompletableFuture deleteAsync(final TwilioRestClient client) { /** * Execute a request using default client. * + * @param tw Twilio object * @return true if the object was deleted */ - public boolean delete() { - return delete(Twilio.getRestClient()); + public boolean delete(Twilio tw) { + return delete(tw.getRestClient()); } /** diff --git a/src/main/java/com/twilio/base/Fetcher.java b/src/main/java/com/twilio/base/Fetcher.java index 57a724509a..e4356f31ee 100644 --- a/src/main/java/com/twilio/base/Fetcher.java +++ b/src/main/java/com/twilio/base/Fetcher.java @@ -15,10 +15,11 @@ public abstract class Fetcher { /** * Execute an async request using default client. * + * @param tw Twilio object * @return future that resolves to requested object */ - public CompletableFuture fetchAsync() { - return fetchAsync(Twilio.getRestClient()); + public CompletableFuture fetchAsync(Twilio tw) { + return fetchAsync(tw.getRestClient()); } /** @@ -34,10 +35,11 @@ public CompletableFuture fetchAsync(final TwilioRestClient client) { /** * Execute a request using default client. * + * @param tw Twilio object * @return Requested object */ - public T fetch() { - return fetch(Twilio.getRestClient()); + public T fetch(Twilio tw) { + return fetch(tw.getRestClient()); } /** diff --git a/src/main/java/com/twilio/base/Reader.java b/src/main/java/com/twilio/base/Reader.java index 37bc5b60ce..d3f3abadcb 100644 --- a/src/main/java/com/twilio/base/Reader.java +++ b/src/main/java/com/twilio/base/Reader.java @@ -18,10 +18,11 @@ public abstract class Reader { /** * Execute a request using default client. * + * @param tw Twilio object * @return ResourceSet of objects */ - public ResourceSet read() { - return read(Twilio.getRestClient()); + public ResourceSet read(Twilio tw) { + return read(tw.getRestClient()); } /** @@ -35,10 +36,11 @@ public ResourceSet read() { /** * Execute an async request using default client. * + * @param tw Twilio object * @return future that resolves to the ResourceSet of objects */ - public CompletableFuture> readAsync() { - return readAsync(Twilio.getRestClient()); + public CompletableFuture> readAsync(Twilio tw) { + return readAsync(tw.getRestClient()); } /** @@ -54,10 +56,11 @@ public CompletableFuture> readAsync(final TwilioRestClient client /** * Fetch the first page of resources. * + * @param tw Twilio object * @return Page containing the first pageSize of resources */ - public Page firstPage() { - return firstPage(Twilio.getRestClient()); + public Page firstPage(Twilio tw) { + return firstPage(tw.getRestClient()); } /** @@ -72,10 +75,11 @@ public Page firstPage() { * Retrieve the target page of resources. * * @param targetUrl API-generated URL for the requested results page + * @param tw Twilio object * @return Page containing the target pageSize of resources */ - public Page getPage(final String targetUrl) { - return getPage(targetUrl, Twilio.getRestClient()); + public Page getPage(final String targetUrl, Twilio tw) { + return getPage(targetUrl, tw.getRestClient()); } /** @@ -91,10 +95,11 @@ public Page getPage(final String targetUrl) { * Fetch the following page of resources. * * @param page current page of resources + * @param tw Twilio object * @return Page containing the next pageSize of resources */ - public Page nextPage(final Page page) { - return nextPage(page, Twilio.getRestClient()); + public Page nextPage(final Page page, Twilio tw) { + return nextPage(page, tw.getRestClient()); } /** @@ -110,10 +115,11 @@ public Page nextPage(final Page page) { * Fetch the prior page of resources. * * @param page current page of resources + * @param tw Twilio object * @return Page containing the previous pageSize of resources */ - public Page previousPage(final Page page) { - return previousPage(page, Twilio.getRestClient()); + public Page previousPage(final Page page, Twilio tw) { + return previousPage(page, tw.getRestClient()); } /** diff --git a/src/main/java/com/twilio/base/Updater.java b/src/main/java/com/twilio/base/Updater.java index 8a474c6ea6..f96957a672 100644 --- a/src/main/java/com/twilio/base/Updater.java +++ b/src/main/java/com/twilio/base/Updater.java @@ -15,10 +15,11 @@ public abstract class Updater { /** * Execute an async request using default client. * + * @param tw Twilio object * @return future that resolves to requested object */ - public CompletableFuture updateAsync() { - return updateAsync(Twilio.getRestClient()); + public CompletableFuture updateAsync(Twilio tw) { + return updateAsync(tw.getRestClient()); } /** @@ -34,10 +35,11 @@ public CompletableFuture updateAsync(final TwilioRestClient client) { /** * Execute a request using default client. * + * @param tw Twilio object * @return Requested object */ - public T update() { - return update(Twilio.getRestClient()); + public T update(Twilio tw) { + return update(tw.getRestClient()); } /** diff --git a/src/main/java/com/twilio/example/Example.java b/src/main/java/com/twilio/example/Example.java index b0fed66190..aec15cd765 100644 --- a/src/main/java/com/twilio/example/Example.java +++ b/src/main/java/com/twilio/example/Example.java @@ -28,6 +28,8 @@ public class Example { public static final PhoneNumber PHONE_NUMBER = new PhoneNumber("+18885551234"); + public static Twilio tw; + /** * Example Twilio usage. * @@ -36,9 +38,9 @@ public class Example { */ public static void main(String[] args) throws TwiMLException, URISyntaxException { - Twilio.init(ACCOUNT_SID, AUTH_TOKEN); + tw = new Twilio(ACCOUNT_SID, AUTH_TOKEN); - Iterable usage = Record.reader().read(); + Iterable usage = Record.reader().read(tw); for (Record record : usage) { System.out.println(record); } @@ -53,7 +55,7 @@ public static void main(String[] args) throws TwiMLException, URISyntaxException PHONE_NUMBER, number.getPhoneNumber(), "Hello world!" - ).create(); + ).create(tw); System.out.println(message.getSid()); System.out.println(message.getBody()); @@ -64,18 +66,18 @@ public static void main(String[] args) throws TwiMLException, URISyntaxException PHONE_NUMBER, number.getPhoneNumber(), URI.create("https://twilio.com") - ).create(); + ).create(tw); System.out.println(call.getSid()); // Print all the messages - Iterable messages = Message.reader().read(); + Iterable messages = Message.reader().read(tw); for (Message m : messages) { System.out.println(m.getSid()); System.out.println(m.getBody()); } // Get some calls - Iterable calls = Call.reader().pageSize(2).read(); + Iterable calls = Call.reader().pageSize(2).read(tw); for (Call c : calls) { System.out.println(c.getSid()); } @@ -83,7 +85,7 @@ public static void main(String[] args) throws TwiMLException, URISyntaxException Trunk trunk = new TrunkCreator() .setFriendlyName("shiny trunk") .setSecure(false) - .create(); + .create(tw); System.out.println(trunk); @@ -97,7 +99,7 @@ public static void main(String[] args) throws TwiMLException, URISyntaxException private static IncomingPhoneNumber buyNumber() { // Look up some phone numbers - Iterable numbers = Local.reader(ACCOUNT_SID, "US").read(); + Iterable numbers = Local.reader(ACCOUNT_SID, "US").read(tw); // Buy the first phone number Iterator iter = numbers.iterator(); @@ -106,7 +108,7 @@ private static IncomingPhoneNumber buyNumber() { return IncomingPhoneNumber.creator( ACCOUNT_SID, local.getPhoneNumber() - ).create(); + ).create(tw); } return null; diff --git a/src/main/java/com/twilio/example/resource/CallCreatorExample.java b/src/main/java/com/twilio/example/resource/CallCreatorExample.java index b3c9cb4fd1..1dd80a90e6 100644 --- a/src/main/java/com/twilio/example/resource/CallCreatorExample.java +++ b/src/main/java/com/twilio/example/resource/CallCreatorExample.java @@ -14,10 +14,11 @@ * Example for making a call. */ public class CallCreatorExample { + public static Twilio tw; @SuppressWarnings("checkstyle:javadocmethod") public static void main(final String[] args) { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); try { @@ -29,7 +30,7 @@ public static void main(final String[] args) { new URI("http://twimlbin.com/4397e62f") ); - Call call = creator.create(); + Call call = creator.create(tw); System.out.println(call.getSid()); System.out.println(call.getStatus().toString()); diff --git a/src/main/java/com/twilio/example/resource/CallDeleterExample.java b/src/main/java/com/twilio/example/resource/CallDeleterExample.java index 27a628c2b7..12b9b6d9a6 100644 --- a/src/main/java/com/twilio/example/resource/CallDeleterExample.java +++ b/src/main/java/com/twilio/example/resource/CallDeleterExample.java @@ -13,12 +13,12 @@ public class CallDeleterExample { @SuppressWarnings("checkstyle:javadocmethod") public static void main(final String[] args) { - Twilio.init("AC123", "AUTH TOKEN"); + Twilio tw = new Twilio("AC123", "AUTH TOKEN"); try { CallDeleter deleter = Call.deleter("AC123", "CA123"); - deleter.delete(); + deleter.delete(tw); } catch (ApiException e) { diff --git a/src/main/java/com/twilio/example/resource/CallFetcherExample.java b/src/main/java/com/twilio/example/resource/CallFetcherExample.java index a3ed8b5a7a..1b26919de2 100644 --- a/src/main/java/com/twilio/example/resource/CallFetcherExample.java +++ b/src/main/java/com/twilio/example/resource/CallFetcherExample.java @@ -12,12 +12,12 @@ public class CallFetcherExample { @SuppressWarnings("checkstyle:javadocmethod") public static void main(String[] args) { - Twilio.init("AC123", "AUTH TOKEN"); + Twilio tw = new Twilio("AC123", "AUTH TOKEN"); try { CallFetcher fetcher = Call.fetcher("AC123", "CA123"); - Call call = fetcher.fetch(); + Call call = fetcher.fetch(tw); System.out.print(call.getSid()); diff --git a/src/main/java/com/twilio/example/resource/CallReaderExample.java b/src/main/java/com/twilio/example/resource/CallReaderExample.java index 9f9c31f33b..b272e2fde9 100644 --- a/src/main/java/com/twilio/example/resource/CallReaderExample.java +++ b/src/main/java/com/twilio/example/resource/CallReaderExample.java @@ -13,12 +13,12 @@ public class CallReaderExample { @SuppressWarnings("checkstyle:javadocmethod") public static void main(final String[] args) { - Twilio.init("AC123", "AUTH TOKEN"); + Twilio tw = new Twilio("AC123", "AUTH TOKEN"); try { CallReader reader = Call.reader("AC123"); - ResourceSet calls = reader.read(); + ResourceSet calls = reader.read(tw); int idx = 1; for (Call call : calls) { diff --git a/src/main/java/com/twilio/example/resource/CallUpdaterExample.java b/src/main/java/com/twilio/example/resource/CallUpdaterExample.java index 76298d5310..22d21a22ec 100644 --- a/src/main/java/com/twilio/example/resource/CallUpdaterExample.java +++ b/src/main/java/com/twilio/example/resource/CallUpdaterExample.java @@ -15,10 +15,12 @@ * Update a call. */ public class CallUpdaterExample { + public static Twilio tw; + @SuppressWarnings("checkstyle:javadocmethod") public static void main(final String[] args) { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); try { @@ -28,7 +30,7 @@ public static void main(final String[] args) { new PhoneNumber("+14154888928"), new URI("http://twimlbin.com/cc413d9d") ); - Call call = creator.create(); + Call call = creator.create(tw); System.out.println(call.getSid()); System.out.println(call.getStatus()); @@ -44,7 +46,7 @@ public static void main(final String[] args) { "AC123", call.getSid() ).setUrl(new URI("http://twimlbin.com/4397e62f")); - Call updated = updater.update(); + Call updated = updater.update(tw); System.out.println(updated.getSid()); System.out.println(updated.getStatus()); diff --git a/src/test/java/com/twilio/TwilioTest.java b/src/test/java/com/twilio/TwilioTest.java index d77f33e62f..a3e8b542de 100644 --- a/src/test/java/com/twilio/TwilioTest.java +++ b/src/test/java/com/twilio/TwilioTest.java @@ -9,6 +9,7 @@ import com.twilio.http.Response; import com.twilio.http.TwilioRestClient; +import org.junit.Before; import org.junit.Test; import java.util.List; @@ -18,13 +19,12 @@ import mockit.Mocked; import mockit.NonStrictExpectations; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; public class TwilioTest { + private Twilio tw; + public static String serialize(Object object) { return object.toString(); } @@ -37,6 +37,11 @@ public static String serialize(List list) { @Mocked private NetworkHttpClient networkHttpClient; + @Before + public void setUp() throws Exception { + tw = new Twilio("AC123", "AUTH TOKEN"); + } + @Test public void testGetExecutorService() { assertNotNull(Twilio.getExecutorService()); @@ -44,23 +49,23 @@ public void testGetExecutorService() { @Test(expected = AuthenticationException.class) public void testGetRestClientNullAccountSid() { - Twilio.setRestClient(null); - Twilio.setUsername(null); - Twilio.setPassword(null); + tw.setRestClient(null); + tw.setUsername(null); + tw.setPassword(null); - Twilio.getRestClient(); + tw.getRestClient(); fail("AuthenticationException was expected"); } @Test(expected = AuthenticationException.class) public void testSetAccountSidNull() { - Twilio.setUsername(null); + tw.setUsername(null); fail("AuthenticationException was expected"); } @Test(expected = AuthenticationException.class) public void testSetAuthTokenNull() { - Twilio.setPassword(null); + tw.setPassword(null); fail("AuthenticationException was expected"); } @@ -75,15 +80,15 @@ public void testSetExecutorService() { public void testDestroyExecutorService() { ExecutorService executorService = Executors.newCachedThreadPool(); Twilio.setExecutorService(executorService); - Twilio.destroy(); + tw.destroy(); assertTrue(Twilio.getExecutorService().isShutdown()); } @Test public void testSetRestClient() { TwilioRestClient twilioRestClient = new TwilioRestClient.Builder("AC123", "AUTH TOKEN").build(); - Twilio.setRestClient(twilioRestClient); - assertEquals(twilioRestClient, Twilio.getRestClient()); + tw.setRestClient(twilioRestClient); + assertEquals(twilioRestClient, tw.getRestClient()); } @Test @@ -131,4 +136,12 @@ public void testValidateSslCertificateSuccess() { Twilio.validateSslCertificate(); } + + @Test + public void testMultiTenantUse() { + Twilio tw1 = new Twilio("usr1", "pwd1"); + Twilio tw2 = new Twilio("usr2", "pwd2"); + + assertNotEquals(tw1.getRestClient(), tw2.getRestClient()); + } } diff --git a/src/test/java/com/twilio/http/TwilioRestClientTest.java b/src/test/java/com/twilio/http/TwilioRestClientTest.java index 7d2b9847c2..09f298638c 100644 --- a/src/test/java/com/twilio/http/TwilioRestClientTest.java +++ b/src/test/java/com/twilio/http/TwilioRestClientTest.java @@ -14,11 +14,12 @@ public class TwilioRestClientTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } - @Test public void testFetchRedirect() { new Expectations() {{ @@ -30,7 +31,7 @@ public void testFetchRedirect() { result = new Response("{\"redirect_to\": \"somewhere\"}", 307); }}; - final Message response = Message.fetcher("AC123", "MM123").fetch(); + final Message response = Message.fetcher("AC123", "MM123").fetch(tw); assertNotNull(response); } } diff --git a/src/test/java/com/twilio/rest/accounts/v1/AuthTokenPromotionTest.java b/src/test/java/com/twilio/rest/accounts/v1/AuthTokenPromotionTest.java index d300a826c9..6a63b72b3b 100644 --- a/src/test/java/com/twilio/rest/accounts/v1/AuthTokenPromotionTest.java +++ b/src/test/java/com/twilio/rest/accounts/v1/AuthTokenPromotionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AuthTokenPromotionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - AuthTokenPromotion.updater().update(); + AuthTokenPromotion.updater().update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +63,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - AuthTokenPromotion.updater().update(); + AuthTokenPromotion.updater().update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/accounts/v1/SecondaryAuthTokenTest.java b/src/test/java/com/twilio/rest/accounts/v1/SecondaryAuthTokenTest.java index 0b03d13436..5ed78aa2ec 100644 --- a/src/test/java/com/twilio/rest/accounts/v1/SecondaryAuthTokenTest.java +++ b/src/test/java/com/twilio/rest/accounts/v1/SecondaryAuthTokenTest.java @@ -31,9 +31,11 @@ public class SecondaryAuthTokenTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - SecondaryAuthToken.creator().create(); + SecondaryAuthToken.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SecondaryAuthToken.creator().create(); + SecondaryAuthToken.creator().create(tw); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - SecondaryAuthToken.deleter().delete(); + SecondaryAuthToken.deleter().delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SecondaryAuthToken.deleter().delete(); + SecondaryAuthToken.deleter().delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/accounts/v1/credential/AwsTest.java b/src/test/java/com/twilio/rest/accounts/v1/credential/AwsTest.java index 9e56da7a35..41619e11c4 100644 --- a/src/test/java/com/twilio/rest/accounts/v1/credential/AwsTest.java +++ b/src/test/java/com/twilio/rest/accounts/v1/credential/AwsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AwsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Aws.reader().read(); + Aws.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Aws.reader().read()); + assertNotNull(Aws.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Aws.reader().read()); + assertNotNull(Aws.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Aws.creator("AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY").create(); + Aws.creator("AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Aws.creator("AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY").create(); + Aws.creator("AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Aws.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Aws.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Aws.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Aws.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Aws.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Aws.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Aws.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Aws.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Aws.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Aws.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Aws.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Aws.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/accounts/v1/credential/PublicKeyTest.java b/src/test/java/com/twilio/rest/accounts/v1/credential/PublicKeyTest.java index c12d03da46..c59cfbf9b7 100644 --- a/src/test/java/com/twilio/rest/accounts/v1/credential/PublicKeyTest.java +++ b/src/test/java/com/twilio/rest/accounts/v1/credential/PublicKeyTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class PublicKeyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - PublicKey.reader().read(); + PublicKey.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(PublicKey.reader().read()); + assertNotNull(PublicKey.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(PublicKey.reader().read()); + assertNotNull(PublicKey.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - PublicKey.creator("publickey").create(); + PublicKey.creator("publickey").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - PublicKey.creator("publickey").create(); + PublicKey.creator("publickey").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - PublicKey.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PublicKey.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PublicKey.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PublicKey.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - PublicKey.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + PublicKey.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - PublicKey.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + PublicKey.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - PublicKey.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PublicKey.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - PublicKey.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PublicKey.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/AccountTest.java b/src/test/java/com/twilio/rest/api/v2010/AccountTest.java index f0add889d4..1ae85becdb 100644 --- a/src/test/java/com/twilio/rest/api/v2010/AccountTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/AccountTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AccountTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Account.creator().create(); + Account.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Account.creator().create(); + Account.creator().create(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Account.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Account.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Account.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Account.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - Account.reader().read(); + Account.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Account.reader().read()); + assertNotNull(Account.reader().read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Account.reader().read()); + assertNotNull(Account.reader().read(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Account.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Account.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Account.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Account.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -185,6 +183,6 @@ public void testUpdateWithNumericStatusResponse() { result = new ObjectMapper(); }}; - Account.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Account.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/AddressTest.java b/src/test/java/com/twilio/rest/api/v2010/account/AddressTest.java index 2d51d692c9..1b85072660 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/AddressTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/AddressTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AddressTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -56,7 +54,7 @@ public void testCreateRequest() { }}; try { - Address.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "customer_name", "street", "city", "region", "postal_code", "US").create(); + Address.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "customer_name", "street", "city", "region", "postal_code", "US").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -70,7 +68,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Address.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "customer_name", "street", "city", "region", "postal_code", "US").create(); + Address.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "customer_name", "street", "city", "region", "postal_code", "US").create(tw); } @Test @@ -88,7 +86,7 @@ public void testDeleteRequest() { }}; try { - Address.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Address.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -102,7 +100,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Address.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Address.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -120,7 +118,7 @@ public void testFetchRequest() { }}; try { - Address.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Address.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -134,7 +132,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Address.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Address.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -152,7 +150,7 @@ public void testUpdateRequest() { }}; try { - Address.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Address.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -166,7 +164,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Address.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Address.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -184,7 +182,7 @@ public void testReadRequest() { }}; try { - Address.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Address.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -198,7 +196,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Address.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Address.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -210,6 +208,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Address.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Address.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/ApplicationTest.java b/src/test/java/com/twilio/rest/api/v2010/account/ApplicationTest.java index d2168c262a..7eb28f9af7 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/ApplicationTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/ApplicationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ApplicationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Application.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Application.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Application.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Application.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Application.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Application.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Application.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Application.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testFetchRequest() { }}; try { - Application.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Application.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Application.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Application.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Application.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Application.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Application.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Application.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Application.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Application.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Application.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Application.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Application.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Application.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "APXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/AuthorizedConnectAppTest.java b/src/test/java/com/twilio/rest/api/v2010/account/AuthorizedConnectAppTest.java index 4f97d0eb96..0f901012d3 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/AuthorizedConnectAppTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/AuthorizedConnectAppTest.java @@ -31,9 +31,11 @@ public class AuthorizedConnectAppTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - AuthorizedConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AuthorizedConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthorizedConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AuthorizedConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AuthorizedConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AuthorizedConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthorizedConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthorizedConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthorizedConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthorizedConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryTest.java b/src/test/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryTest.java index 2c4efe4ef9..eb7b2604c3 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryTest.java @@ -31,9 +31,11 @@ public class AvailablePhoneNumberCountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - AvailablePhoneNumberCountry.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AvailablePhoneNumberCountry.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailablePhoneNumberCountry.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AvailablePhoneNumberCountry.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailablePhoneNumberCountry.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AvailablePhoneNumberCountry.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - AvailablePhoneNumberCountry.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").fetch(); + AvailablePhoneNumberCountry.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailablePhoneNumberCountry.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").fetch()); + assertNotNull(AvailablePhoneNumberCountry.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/BalanceTest.java b/src/test/java/com/twilio/rest/api/v2010/account/BalanceTest.java index e2e6bb8514..f517fdd3ff 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/BalanceTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/BalanceTest.java @@ -31,9 +31,11 @@ public class BalanceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Balance.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Balance.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Balance.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Balance.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/CallTest.java b/src/test/java/com/twilio/rest/api/v2010/account/CallTest.java index 0bc941eb38..a230b1875d 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/CallTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/CallTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class CallTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +53,7 @@ public void testCreateRequest() { }}; try { - Call.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), URI.create("https://example.com")).create(); + Call.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), URI.create("https://example.com")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Call.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), URI.create("https://example.com")).create(); + Call.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), URI.create("https://example.com")).create(tw); } @Test @@ -79,7 +79,7 @@ public void testCreateWithTwimlResponse() { result = new ObjectMapper(); }}; - Call.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), URI.create("https://example.com")).create(); + Call.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), URI.create("https://example.com")).create(tw); } @Test @@ -97,7 +97,7 @@ public void testDeleteRequest() { }}; try { - Call.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Call.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -111,7 +111,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Call.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Call.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -129,7 +129,7 @@ public void testFetchRequest() { }}; try { - Call.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Call.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Call.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Call.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -161,7 +161,7 @@ public void testReadRequest() { }}; try { - Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,7 +175,7 @@ public void testReadFullPage1Response() { result = new ObjectMapper(); }}; - assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -187,7 +187,7 @@ public void testReadFullPage2Response() { result = new ObjectMapper(); }}; - assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -199,7 +199,7 @@ public void testReadEmptyDatesGreaterResponse() { result = new ObjectMapper(); }}; - assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -211,7 +211,7 @@ public void testReadEmptyDatesLessResponse() { result = new ObjectMapper(); }}; - assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -223,7 +223,7 @@ public void testReadEmptyDateFunDateFormatsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Call.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -241,7 +241,7 @@ public void testUpdateRequest() { }}; try { - Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -255,7 +255,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -267,7 +267,7 @@ public void testCancelResponse() { result = new ObjectMapper(); }}; - Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -279,7 +279,7 @@ public void testPosttwimlResponse() { result = new ObjectMapper(); }}; - Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -291,6 +291,6 @@ public void testUpdatetimelimitResponse() { result = new ObjectMapper(); }}; - Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Call.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/ConferenceTest.java b/src/test/java/com/twilio/rest/api/v2010/account/ConferenceTest.java index a657ae5ce3..215bfe79da 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/ConferenceTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/ConferenceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConferenceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchValidMixerZoneResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +75,7 @@ public void testFetchValidRegionInProgressResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -89,7 +87,7 @@ public void testFetchWithoutMixerZoneIntegerStatusResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -101,7 +99,7 @@ public void testFetchUnknownMixerZoneInitIntegerStatusResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conference.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -119,7 +117,7 @@ public void testReadRequest() { }}; try { - Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -133,7 +131,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -145,7 +143,7 @@ public void testReadNextResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -157,7 +155,7 @@ public void testReadPreviousResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -169,7 +167,7 @@ public void testReadMyroomResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -181,7 +179,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -193,7 +191,7 @@ public void testReadDateCreatedEqualsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -205,7 +203,7 @@ public void testReadDateCreatedOnOrAfterResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conference.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -223,7 +221,7 @@ public void testUpdateRequest() { }}; try { - Conference.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Conference.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -237,7 +235,7 @@ public void testUpdateEndConferenceResponse() { result = new ObjectMapper(); }}; - Conference.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Conference.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -249,6 +247,6 @@ public void testAnnounceToConferenceResponse() { result = new ObjectMapper(); }}; - Conference.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Conference.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/ConnectAppTest.java b/src/test/java/com/twilio/rest/api/v2010/account/ConnectAppTest.java index c15927e301..91c91b0c99 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/ConnectAppTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/ConnectAppTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConnectAppTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - ConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ConnectApp.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - ConnectApp.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ConnectApp.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ConnectApp.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ConnectApp.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - ConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ConnectApp.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +157,7 @@ public void testDeleteRequest() { }}; try { - ConnectApp.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ConnectApp.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +171,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ConnectApp.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ConnectApp.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumberTest.java b/src/test/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumberTest.java index 16eae5012c..ad161809a6 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumberTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/IncomingPhoneNumberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class IncomingPhoneNumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - IncomingPhoneNumber.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + IncomingPhoneNumber.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - IncomingPhoneNumber.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + IncomingPhoneNumber.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - IncomingPhoneNumber.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IncomingPhoneNumber.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IncomingPhoneNumber.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IncomingPhoneNumber.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - IncomingPhoneNumber.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IncomingPhoneNumber.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - IncomingPhoneNumber.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IncomingPhoneNumber.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - IncomingPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + IncomingPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IncomingPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IncomingPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IncomingPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IncomingPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testCreateRequest() { }}; try { - IncomingPhoneNumber.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + IncomingPhoneNumber.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - IncomingPhoneNumber.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + IncomingPhoneNumber.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/KeyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/KeyTest.java index 86a736a8db..503c26f9a4 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/KeyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/KeyTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class KeyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Key.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Key.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Key.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Key.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Key.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Key.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Key.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Key.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Key.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Key.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Key.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Key.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Key.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Key.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Key.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Key.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +171,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Key.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Key.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/MessageTest.java b/src/test/java/com/twilio/rest/api/v2010/account/MessageTest.java index fac960487b..080c740436 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/MessageTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +51,7 @@ public void testCreateRequest() { }}; try { - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +65,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -79,7 +77,7 @@ public void testCreateWoServiceResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -91,7 +89,7 @@ public void testCreateWithMessagingServiceResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -103,7 +101,7 @@ public void testCreateWithQueuedStatusResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateScheduledMessageSmsResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -127,7 +125,7 @@ public void testCreateScheduledMessageMmsResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -139,7 +137,7 @@ public void testCreateScheduledMessageWhatsappResponse() { result = new ObjectMapper(); }}; - Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(); + Message.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661"), "body").create(tw); } @Test @@ -157,7 +155,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Message.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -171,7 +169,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Message.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -189,7 +187,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -203,7 +201,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -221,7 +219,7 @@ public void testReadRequest() { }}; try { - Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -235,7 +233,7 @@ public void testReadFullPage1Response() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -247,7 +245,7 @@ public void testReadEmptySentdateLessResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -259,7 +257,7 @@ public void testReadEmptySentdateEqualsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -271,7 +269,7 @@ public void testReadEmptySentdateGreaterResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -283,7 +281,7 @@ public void testReadEmptySentdateGreaterFormat1Response() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -295,7 +293,7 @@ public void testReadEmptySentdateGreaterFormat2Response() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -307,7 +305,7 @@ public void testReadEmptySentdateGreaterFormat3Response() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -325,7 +323,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -339,7 +337,7 @@ public void testRedactBodyResponse() { result = new ObjectMapper(); }}; - Message.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -351,6 +349,6 @@ public void testCancelMessageResponse() { result = new ObjectMapper(); }}; - Message.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/NewKeyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/NewKeyTest.java index 78a954be00..c2e412023a 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/NewKeyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/NewKeyTest.java @@ -31,9 +31,11 @@ public class NewKeyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - NewKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + NewKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - NewKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + NewKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/NewSigningKeyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/NewSigningKeyTest.java index 9a5693d9a0..af1ed03a56 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/NewSigningKeyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/NewSigningKeyTest.java @@ -31,9 +31,11 @@ public class NewSigningKeyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - NewSigningKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + NewSigningKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - NewSigningKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + NewSigningKey.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/NotificationTest.java b/src/test/java/com/twilio/rest/api/v2010/account/NotificationTest.java index db75a93f1c..730257914f 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/NotificationTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/NotificationTest.java @@ -31,9 +31,11 @@ public class NotificationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/OutgoingCallerIdTest.java b/src/test/java/com/twilio/rest/api/v2010/account/OutgoingCallerIdTest.java index 945272b868..50c2ceac3f 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/OutgoingCallerIdTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/OutgoingCallerIdTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class OutgoingCallerIdTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - OutgoingCallerId.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + OutgoingCallerId.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(OutgoingCallerId.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(OutgoingCallerId.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - OutgoingCallerId.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + OutgoingCallerId.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - OutgoingCallerId.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + OutgoingCallerId.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - OutgoingCallerId.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + OutgoingCallerId.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - OutgoingCallerId.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + OutgoingCallerId.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - OutgoingCallerId.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + OutgoingCallerId.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(OutgoingCallerId.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(OutgoingCallerId.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +171,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(OutgoingCallerId.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(OutgoingCallerId.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/QueueTest.java b/src/test/java/com/twilio/rest/api/v2010/account/QueueTest.java index 706771f2f2..b02fdfdc61 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/QueueTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/QueueTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class QueueTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Queue.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Queue.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Queue.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Queue.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Queue.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Queue.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Queue.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Queue.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Queue.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Queue.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Queue.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Queue.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Queue.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Queue.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Queue.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Queue.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Queue.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Queue.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testCreateRequest() { }}; try { - Queue.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Queue.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Queue.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Queue.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/RecordingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/RecordingTest.java index 33d03fb56a..74d7667a44 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/RecordingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/RecordingTest.java @@ -31,9 +31,11 @@ public class RecordingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +143,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/ShortCodeTest.java b/src/test/java/com/twilio/rest/api/v2010/account/ShortCodeTest.java index dea20ab58b..f672adf5cd 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/ShortCodeTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/ShortCodeTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ShortCodeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - ShortCode.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ShortCode.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ShortCode.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - ShortCode.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ShortCode.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ShortCode.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ShortCode.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - ShortCode.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ShortCode.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ShortCode.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +139,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ShortCode.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/SigningKeyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/SigningKeyTest.java index 8864e9a0cb..69ab99a05a 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/SigningKeyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/SigningKeyTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SigningKeyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SigningKey.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SigningKey.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SigningKey.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SigningKey.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - SigningKey.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SigningKey.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SigningKey.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SigningKey.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - SigningKey.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SigningKey.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SigningKey.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SigningKey.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - SigningKey.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SigningKey.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SigningKey.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SigningKey.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +171,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SigningKey.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SigningKey.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/TokenTest.java b/src/test/java/com/twilio/rest/api/v2010/account/TokenTest.java index 0df3090d12..9249edef9e 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/TokenTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/TokenTest.java @@ -31,9 +31,11 @@ public class TokenTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Token.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Token.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Token.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Token.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/TranscriptionTest.java b/src/test/java/com/twilio/rest/api/v2010/account/TranscriptionTest.java index e35157c5c5..a4cea2a33e 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/TranscriptionTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/TranscriptionTest.java @@ -31,9 +31,11 @@ public class TranscriptionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +143,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/ValidationRequestTest.java b/src/test/java/com/twilio/rest/api/v2010/account/ValidationRequestTest.java index dc9ae9b9d8..c486a30b48 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/ValidationRequestTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/ValidationRequestTest.java @@ -31,9 +31,11 @@ public class ValidationRequestTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - ValidationRequest.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + ValidationRequest.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ValidationRequest.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + ValidationRequest.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/address/DependentPhoneNumberTest.java b/src/test/java/com/twilio/rest/api/v2010/account/address/DependentPhoneNumberTest.java index 7e09d49e95..6663d13e2e 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/address/DependentPhoneNumberTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/address/DependentPhoneNumberTest.java @@ -31,9 +31,11 @@ public class DependentPhoneNumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - DependentPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DependentPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(DependentPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DependentPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(DependentPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DependentPhoneNumber.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/LocalTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/LocalTest.java index 6697ed6c8e..3cf297bb6a 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/LocalTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/LocalTest.java @@ -31,9 +31,11 @@ public class LocalTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MachineToMachineTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MachineToMachineTest.java index cfc437926e..b051858fd7 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MachineToMachineTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MachineToMachineTest.java @@ -31,9 +31,11 @@ public class MachineToMachineTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - MachineToMachine.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + MachineToMachine.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(MachineToMachine.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(MachineToMachine.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(MachineToMachine.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(MachineToMachine.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MobileTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MobileTest.java index 8fb03152fe..555e6966cc 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MobileTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/MobileTest.java @@ -31,9 +31,11 @@ public class MobileTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/NationalTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/NationalTest.java index 5be8c38d5b..c3dfebf5a6 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/NationalTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/NationalTest.java @@ -31,9 +31,11 @@ public class NationalTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - National.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + National.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(National.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(National.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(National.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(National.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/SharedCostTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/SharedCostTest.java index 2f8d9c7167..a20b4a56a2 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/SharedCostTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/SharedCostTest.java @@ -31,9 +31,11 @@ public class SharedCostTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - SharedCost.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + SharedCost.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SharedCost.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(SharedCost.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SharedCost.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(SharedCost.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/TollFreeTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/TollFreeTest.java index a5ac56e4be..c5a700e89d 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/TollFreeTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/TollFreeTest.java @@ -31,9 +31,11 @@ public class TollFreeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/VoipTest.java b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/VoipTest.java index d5219b8349..3780f8cfa0 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/VoipTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/availablephonenumbercountry/VoipTest.java @@ -31,9 +31,11 @@ public class VoipTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Voip.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(); + Voip.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Voip.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(Voip.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Voip.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read()); + assertNotNull(Voip.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/EventTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/EventTest.java index b6e1c19965..9b69a7e53e 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/EventTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/EventTest.java @@ -31,9 +31,11 @@ public class EventTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Event.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Event.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Event.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Event.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackSummaryTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackSummaryTest.java index 3602f2253e..7769480c7d 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackSummaryTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackSummaryTest.java @@ -31,9 +31,11 @@ public class FeedbackSummaryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - FeedbackSummary.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", DateConverter.localDateFromString("2008-01-02"), DateConverter.localDateFromString("2008-01-02")).create(); + FeedbackSummary.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", DateConverter.localDateFromString("2008-01-02"), DateConverter.localDateFromString("2008-01-02")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - FeedbackSummary.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", DateConverter.localDateFromString("2008-01-02"), DateConverter.localDateFromString("2008-01-02")).create(); + FeedbackSummary.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", DateConverter.localDateFromString("2008-01-02"), DateConverter.localDateFromString("2008-01-02")).create(tw); } @Test @@ -84,7 +86,7 @@ public void testFetchRequest() { }}; try { - FeedbackSummary.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FeedbackSummary.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +100,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FeedbackSummary.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FeedbackSummary.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +118,7 @@ public void testDeleteRequest() { }}; try { - FeedbackSummary.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FeedbackSummary.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,6 +132,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FeedbackSummary.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FeedbackSummary.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackTest.java index 3ae3034c33..2cf5352b4c 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/FeedbackTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FeedbackTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Feedback.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Feedback.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Feedback.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Feedback.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).create(); + Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).create(); + Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).create(tw); } @Test @@ -115,7 +113,7 @@ public void testUpdateRequest() { }}; try { - Feedback.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Feedback.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +127,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Feedback.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Feedback.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/NotificationTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/NotificationTest.java index f5ca8b6722..df58997841 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/NotificationTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/NotificationTest.java @@ -31,9 +31,11 @@ public class NotificationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Notification.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Notification.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/PaymentTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/PaymentTest.java index 81b4060bbe..9649ebb995 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/PaymentTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/PaymentTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class PaymentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +52,7 @@ public void testCreateRequest() { }}; try { - Payment.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).create(); + Payment.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +66,7 @@ public void testStartPaymentSessionSuccessResponse() { result = new ObjectMapper(); }}; - Payment.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).create(); + Payment.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).create(tw); } @Test @@ -85,7 +85,7 @@ public void testUpdateRequest() { }}; try { - Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(); + Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +99,7 @@ public void testCollectCreditCardNumberResponse() { result = new ObjectMapper(); }}; - Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(); + Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(tw); } @Test @@ -111,7 +111,7 @@ public void testCollectCreditCardExpiryDateResponse() { result = new ObjectMapper(); }}; - Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(); + Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(tw); } @Test @@ -123,6 +123,6 @@ public void testCompletePaymentResponse() { result = new ObjectMapper(); }}; - Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(); + Payment.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "idempotency_key", URI.create("https://example.com")).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/RecordingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/RecordingTest.java index ed2138f678..dff8279ca3 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/RecordingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/RecordingTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RecordingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Recording.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Recording.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Recording.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Recording.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(); + Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(); + Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(tw); } @Test @@ -115,7 +113,7 @@ public void testFetchRequest() { }}; try { - Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +145,7 @@ public void testDeleteRequest() { }}; try { - Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -179,7 +177,7 @@ public void testReadRequest() { }}; try { - Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,7 +191,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -205,6 +203,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/SiprecTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/SiprecTest.java index e806e64c60..e5d23f262f 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/SiprecTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/SiprecTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SiprecTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Siprec.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Siprec.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateNoArgsResponse() { result = new ObjectMapper(); }}; - Siprec.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Siprec.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateWithArgsResponse() { result = new ObjectMapper(); }}; - Siprec.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Siprec.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -95,7 +93,7 @@ public void testUpdateRequest() { }}; try { - Siprec.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Siprec.UpdateStatus.STOPPED).update(); + Siprec.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Siprec.UpdateStatus.STOPPED).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testUpdateBySidResponse() { result = new ObjectMapper(); }}; - Siprec.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Siprec.UpdateStatus.STOPPED).update(); + Siprec.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Siprec.UpdateStatus.STOPPED).update(tw); } @Test @@ -121,6 +119,6 @@ public void testUpdateByNameResponse() { result = new ObjectMapper(); }}; - Siprec.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Siprec.UpdateStatus.STOPPED).update(); + Siprec.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Siprec.UpdateStatus.STOPPED).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/call/StreamTest.java b/src/test/java/com/twilio/rest/api/v2010/account/call/StreamTest.java index aba0c37697..758abc731a 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/call/StreamTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/call/StreamTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class StreamTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Stream.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Stream.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateNoArgsResponse() { result = new ObjectMapper(); }}; - Stream.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Stream.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateWithArgsResponse() { result = new ObjectMapper(); }}; - Stream.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Stream.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -95,7 +93,7 @@ public void testUpdateRequest() { }}; try { - Stream.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Stream.UpdateStatus.STOPPED).update(); + Stream.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Stream.UpdateStatus.STOPPED).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testUpdateBySidResponse() { result = new ObjectMapper(); }}; - Stream.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Stream.UpdateStatus.STOPPED).update(); + Stream.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Stream.UpdateStatus.STOPPED).update(tw); } @Test @@ -121,6 +119,6 @@ public void testUpdateByNameResponse() { result = new ObjectMapper(); }}; - Stream.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Stream.UpdateStatus.STOPPED).update(); + Stream.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Stream.UpdateStatus.STOPPED).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/conference/ParticipantTest.java b/src/test/java/com/twilio/rest/api/v2010/account/conference/ParticipantTest.java index 9c34202f54..eadcb02f5c 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/conference/ParticipantTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/conference/ParticipantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Participant.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Participant.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +75,7 @@ public void testFetchByLabelResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +93,7 @@ public void testUpdateRequest() { }}; try { - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testMuteParticipantResponse() { result = new ObjectMapper(); }}; - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -121,7 +119,7 @@ public void testMuteParticipantByLabelResponse() { result = new ObjectMapper(); }}; - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -133,7 +131,7 @@ public void testHoldParticipantWithMusicResponse() { result = new ObjectMapper(); }}; - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -145,7 +143,7 @@ public void testAnnounceToParticipantResponse() { result = new ObjectMapper(); }}; - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -157,7 +155,7 @@ public void testModifyParticipantResponse() { result = new ObjectMapper(); }}; - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -169,7 +167,7 @@ public void testModifyParticipantByLabelResponse() { result = new ObjectMapper(); }}; - Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -188,7 +186,7 @@ public void testCreateRequest() { }}; try { - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -202,7 +200,7 @@ public void testCreateWithSidResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -214,7 +212,7 @@ public void testCreateWithFriendlyNameResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -226,7 +224,7 @@ public void testCreateWithSidAsCoachResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -238,7 +236,7 @@ public void testCreateWithNonE164NumberResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -250,7 +248,7 @@ public void testCreateWithFriendlyNameJitterBufferSizeResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -262,7 +260,7 @@ public void testCreateWithFriendlyNameByocResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -274,7 +272,7 @@ public void testCreateWithFriendlyNameCallerIdResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -286,7 +284,7 @@ public void testCreateWithFriendlyNameReasonResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -298,7 +296,7 @@ public void testCreateWithFriendlyNameRecordingTrackResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -310,7 +308,7 @@ public void testCreateWithFromToClientResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -322,7 +320,7 @@ public void testCreateWithFromToSipResponse() { result = new ObjectMapper(); }}; - Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(); + Participant.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661"), new com.twilio.type.PhoneNumber("+15558675310")).create(tw); } @Test @@ -340,7 +338,7 @@ public void testDeleteRequest() { }}; try { - Participant.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Participant.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -354,7 +352,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Participant.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Participant.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -366,7 +364,7 @@ public void testDeleteByLabelResponse() { result = new ObjectMapper(); }}; - Participant.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Participant.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -384,7 +382,7 @@ public void testReadRequest() { }}; try { - Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -398,7 +396,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -410,7 +408,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -422,7 +420,7 @@ public void testReadNextResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -434,6 +432,6 @@ public void testReadPreviousResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/conference/RecordingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/conference/RecordingTest.java index 1e149c7aaa..1f5b4ebf93 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/conference/RecordingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/conference/RecordingTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RecordingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(); + Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(); + Recording.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Recording.Status.IN_PROGRESS).update(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Recording.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +171,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Recording.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/AssignedAddOnTest.java b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/AssignedAddOnTest.java index 488bc93598..dc18fc0ada 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/AssignedAddOnTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/AssignedAddOnTest.java @@ -31,9 +31,11 @@ public class AssignedAddOnTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - AssignedAddOn.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AssignedAddOn.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssignedAddOn.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AssignedAddOn.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AssignedAddOn.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AssignedAddOn.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssignedAddOn.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AssignedAddOn.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssignedAddOn.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AssignedAddOn.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testCreateRequest() { }}; try { - AssignedAddOn.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AssignedAddOn.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AssignedAddOn.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AssignedAddOn.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - AssignedAddOn.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AssignedAddOn.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AssignedAddOn.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AssignedAddOn.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalTest.java b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalTest.java index ce8a1f4209..f5ba96e20a 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/LocalTest.java @@ -31,9 +31,11 @@ public class LocalTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Local.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testCreateRequest() { }}; try { - Local.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + Local.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Local.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + Local.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileTest.java b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileTest.java index 3f05631aa7..6efa7f1c4a 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/MobileTest.java @@ -31,9 +31,11 @@ public class MobileTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Mobile.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testCreateRequest() { }}; try { - Mobile.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + Mobile.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Mobile.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + Mobile.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeTest.java b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeTest.java index 6f04ea590d..0f6c0d7d07 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/TollFreeTest.java @@ -31,9 +31,11 @@ public class TollFreeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TollFree.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testCreateRequest() { }}; try { - TollFree.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + TollFree.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TollFree.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(); + TollFree.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/assignedaddon/AssignedAddOnExtensionTest.java b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/assignedaddon/AssignedAddOnExtensionTest.java index 4bdd60101e..985a09ff13 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/assignedaddon/AssignedAddOnExtensionTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/incomingphonenumber/assignedaddon/AssignedAddOnExtensionTest.java @@ -31,9 +31,11 @@ public class AssignedAddOnExtensionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - AssignedAddOnExtension.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AssignedAddOnExtension.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssignedAddOnExtension.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AssignedAddOnExtension.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AssignedAddOnExtension.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AssignedAddOnExtension.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssignedAddOnExtension.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AssignedAddOnExtension.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssignedAddOnExtension.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AssignedAddOnExtension.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/message/FeedbackTest.java b/src/test/java/com/twilio/rest/api/v2010/account/message/FeedbackTest.java index 40fedb5785..72f29571dc 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/message/FeedbackTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/message/FeedbackTest.java @@ -31,9 +31,11 @@ public class FeedbackTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Feedback.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/message/MediaTest.java b/src/test/java/com/twilio/rest/api/v2010/account/message/MediaTest.java index 24b7d1d9cb..b368bda715 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/message/MediaTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/message/MediaTest.java @@ -31,9 +31,11 @@ public class MediaTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testDeleteRequest() { }}; try { - Media.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Media.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Media.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Media.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Media.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Media.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Media.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Media.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Media.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Media.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Media.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Media.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +143,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Media.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Media.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/queue/MemberTest.java b/src/test/java/com/twilio/rest/api/v2010/account/queue/MemberTest.java index 3ea17f3a12..dc29c86977 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/queue/MemberTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/queue/MemberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class MemberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +51,7 @@ public void testFetchRequest() { }}; try { - Member.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Member.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +65,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Member.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +77,7 @@ public void testFetchFrontResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Member.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +95,7 @@ public void testUpdateRequest() { }}; try { - Member.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).update(); + Member.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +109,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Member.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).update(); + Member.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).update(tw); } @Test @@ -121,7 +121,7 @@ public void testDequeueFrontResponse() { result = new ObjectMapper(); }}; - Member.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).update(); + Member.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).update(tw); } @Test @@ -139,7 +139,7 @@ public void testReadRequest() { }}; try { - Member.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Member.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -153,7 +153,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -165,6 +165,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/recording/AddOnResultTest.java b/src/test/java/com/twilio/rest/api/v2010/account/recording/AddOnResultTest.java index a2b5672ee0..c1d9881478 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/recording/AddOnResultTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/recording/AddOnResultTest.java @@ -31,9 +31,11 @@ public class AddOnResultTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - AddOnResult.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AddOnResult.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AddOnResult.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AddOnResult.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AddOnResult.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AddOnResult.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AddOnResult.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AddOnResult.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AddOnResult.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AddOnResult.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - AddOnResult.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AddOnResult.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AddOnResult.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AddOnResult.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/recording/TranscriptionTest.java b/src/test/java/com/twilio/rest/api/v2010/account/recording/TranscriptionTest.java index b7c65c438d..5ff866f3a8 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/recording/TranscriptionTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/recording/TranscriptionTest.java @@ -31,9 +31,11 @@ public class TranscriptionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Transcription.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Transcription.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +143,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Transcription.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/recording/addonresult/PayloadTest.java b/src/test/java/com/twilio/rest/api/v2010/account/recording/addonresult/PayloadTest.java index d9b8149191..2730278855 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/recording/addonresult/PayloadTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/recording/addonresult/PayloadTest.java @@ -31,9 +31,11 @@ public class PayloadTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Payload.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Payload.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Payload.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Payload.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Payload.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Payload.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Payload.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Payload.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Payload.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Payload.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - Payload.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Payload.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Payload.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Payload.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/CredentialListTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/CredentialListTest.java index 23b8db6481..91e1665877 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/CredentialListTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/CredentialListTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialListTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - CredentialList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + CredentialList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CredentialList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CredentialList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - CredentialList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + CredentialList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CredentialList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + CredentialList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - CredentialList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CredentialList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CredentialList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - CredentialList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + CredentialList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - CredentialList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + CredentialList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - CredentialList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CredentialList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CredentialList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CredentialList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/DomainTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/DomainTest.java index 7f2f81b944..87095e48a7 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/DomainTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/DomainTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DomainTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Domain.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Domain.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Domain.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Domain.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Domain.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Domain.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Domain.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "domain_name").create(); + Domain.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "domain_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Domain.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "domain_name").create(); + Domain.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "domain_name").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Domain.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Domain.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Domain.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Domain.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Domain.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Domain.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Domain.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Domain.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Domain.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Domain.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Domain.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Domain.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/IpAccessControlListTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/IpAccessControlListTest.java index 7e9648c73a..d19b101ecb 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/IpAccessControlListTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/IpAccessControlListTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class IpAccessControlListTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - IpAccessControlList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + IpAccessControlList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAccessControlList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAccessControlList.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - IpAccessControlList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + IpAccessControlList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - IpAccessControlList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + IpAccessControlList.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - IpAccessControlList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IpAccessControlList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IpAccessControlList.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - IpAccessControlList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + IpAccessControlList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - IpAccessControlList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + IpAccessControlList.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - IpAccessControlList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAccessControlList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - IpAccessControlList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAccessControlList.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/credentiallist/CredentialTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/credentiallist/CredentialTest.java index 5411b64742..6e9557ff61 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/credentiallist/CredentialTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/credentiallist/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Credential.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Credential.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Credential.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Credential.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -96,7 +94,7 @@ public void testCreateRequest() { }}; try { - Credential.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "username", "password").create(); + Credential.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "username", "password").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -110,7 +108,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "username", "password").create(); + Credential.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "username", "password").create(tw); } @Test @@ -128,7 +126,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/CredentialListMappingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/CredentialListMappingTest.java index fe2d043342..83a52170d6 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/CredentialListMappingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/CredentialListMappingTest.java @@ -31,9 +31,11 @@ public class CredentialListMappingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - CredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - CredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + CredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - CredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - CredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/IpAccessControlListMappingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/IpAccessControlListMappingTest.java index 9a6681c689..fc44d4685d 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/IpAccessControlListMappingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/IpAccessControlListMappingTest.java @@ -31,9 +31,11 @@ public class IpAccessControlListMappingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - IpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - IpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + IpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - IpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + IpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - IpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + IpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +143,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - IpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - IpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsCredentialListMappingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsCredentialListMappingTest.java index 1f1280b9d3..a6b01d8570 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsCredentialListMappingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsCredentialListMappingTest.java @@ -31,9 +31,11 @@ public class AuthCallsCredentialListMappingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - AuthCallsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AuthCallsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AuthCallsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AuthCallsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AuthCallsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AuthCallsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthCallsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthCallsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthCallsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthCallsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - AuthCallsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AuthCallsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthCallsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AuthCallsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - AuthCallsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AuthCallsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AuthCallsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AuthCallsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsIpAccessControlListMappingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsIpAccessControlListMappingTest.java index 233f4ed2f1..3becd7f9e0 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsIpAccessControlListMappingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtypecalls/AuthCallsIpAccessControlListMappingTest.java @@ -31,9 +31,11 @@ public class AuthCallsIpAccessControlListMappingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - AuthCallsIpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AuthCallsIpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AuthCallsIpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AuthCallsIpAccessControlListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AuthCallsIpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AuthCallsIpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthCallsIpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthCallsIpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthCallsIpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthCallsIpAccessControlListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - AuthCallsIpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AuthCallsIpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthCallsIpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AuthCallsIpAccessControlListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - AuthCallsIpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AuthCallsIpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AuthCallsIpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AuthCallsIpAccessControlListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtyperegistrations/AuthRegistrationsCredentialListMappingTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtyperegistrations/AuthRegistrationsCredentialListMappingTest.java index c9c4858f95..9d2c74cccd 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtyperegistrations/AuthRegistrationsCredentialListMappingTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/domain/authtypes/authtyperegistrations/AuthRegistrationsCredentialListMappingTest.java @@ -31,9 +31,11 @@ public class AuthRegistrationsCredentialListMappingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - AuthRegistrationsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AuthRegistrationsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AuthRegistrationsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + AuthRegistrationsCredentialListMapping.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AuthRegistrationsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AuthRegistrationsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthRegistrationsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthRegistrationsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthRegistrationsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AuthRegistrationsCredentialListMapping.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - AuthRegistrationsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AuthRegistrationsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthRegistrationsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AuthRegistrationsCredentialListMapping.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - AuthRegistrationsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AuthRegistrationsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AuthRegistrationsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AuthRegistrationsCredentialListMapping.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/sip/ipaccesscontrollist/IpAddressTest.java b/src/test/java/com/twilio/rest/api/v2010/account/sip/ipaccesscontrollist/IpAddressTest.java index a193527e40..2443849097 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/sip/ipaccesscontrollist/IpAddressTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/sip/ipaccesscontrollist/IpAddressTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class IpAddressTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - IpAddress.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + IpAddress.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAddress.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAddress.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAddress.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAddress.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -96,7 +94,7 @@ public void testCreateRequest() { }}; try { - IpAddress.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "ip_address").create(); + IpAddress.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "ip_address").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -110,7 +108,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - IpAddress.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "ip_address").create(); + IpAddress.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "ip_address").create(tw); } @Test @@ -128,7 +126,7 @@ public void testFetchRequest() { }}; try { - IpAddress.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IpAddress.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAddress.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IpAddress.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - IpAddress.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + IpAddress.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - IpAddress.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + IpAddress.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - IpAddress.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAddress.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - IpAddress.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAddress.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/RecordTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/RecordTest.java index 8aa857d8bb..a4f4b48854 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/RecordTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/RecordTest.java @@ -31,9 +31,11 @@ public class RecordTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Record.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Record.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Record.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Record.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Record.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Record.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/TriggerTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/TriggerTest.java index 3f91efac63..eaa665c930 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/TriggerTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/TriggerTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class TriggerTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +51,7 @@ public void testFetchRequest() { }}; try { - Trigger.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Trigger.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +65,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Trigger.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Trigger.fetcher("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +83,7 @@ public void testUpdateRequest() { }}; try { - Trigger.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Trigger.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +97,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Trigger.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Trigger.updater("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +115,7 @@ public void testDeleteRequest() { }}; try { - Trigger.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Trigger.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +129,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Trigger.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Trigger.deleter("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -149,7 +149,7 @@ public void testCreateRequest() { }}; try { - Trigger.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com"), "trigger_value", Trigger.UsageCategory.A2P_REGISTRATION_FEES).create(); + Trigger.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com"), "trigger_value", Trigger.UsageCategory.A2P_REGISTRATION_FEES).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +163,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Trigger.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com"), "trigger_value", Trigger.UsageCategory.A2P_REGISTRATION_FEES).create(); + Trigger.creator("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com"), "trigger_value", Trigger.UsageCategory.A2P_REGISTRATION_FEES).create(tw); } @Test @@ -181,7 +181,7 @@ public void testReadRequest() { }}; try { - Trigger.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Trigger.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -195,7 +195,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Trigger.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Trigger.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -207,6 +207,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Trigger.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Trigger.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/AllTimeTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/AllTimeTest.java index bfd3253cc9..4549ea3476 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/AllTimeTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/AllTimeTest.java @@ -31,9 +31,11 @@ public class AllTimeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - AllTime.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AllTime.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AllTime.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AllTime.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AllTime.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AllTime.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/DailyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/DailyTest.java index 8c69d890c1..a46bcd52bb 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/DailyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/DailyTest.java @@ -31,9 +31,11 @@ public class DailyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Daily.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Daily.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Daily.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Daily.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Daily.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Daily.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/LastMonthTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/LastMonthTest.java index d9a1c17cf8..6f356dcdce 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/LastMonthTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/LastMonthTest.java @@ -31,9 +31,11 @@ public class LastMonthTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - LastMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + LastMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(LastMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(LastMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(LastMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(LastMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/MonthlyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/MonthlyTest.java index 8fcf60dc00..4134e8d64f 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/MonthlyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/MonthlyTest.java @@ -31,9 +31,11 @@ public class MonthlyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Monthly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Monthly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Monthly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Monthly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Monthly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Monthly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/ThisMonthTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/ThisMonthTest.java index 3c3ca168d1..ae4bfea161 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/ThisMonthTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/ThisMonthTest.java @@ -31,9 +31,11 @@ public class ThisMonthTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ThisMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ThisMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ThisMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ThisMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ThisMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ThisMonth.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/TodayTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/TodayTest.java index 6b90cb5e2e..4df8a2d6a2 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/TodayTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/TodayTest.java @@ -31,9 +31,11 @@ public class TodayTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Today.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Today.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Today.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Today.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Today.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Today.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YearlyTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YearlyTest.java index da846f7da3..5b7568b802 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YearlyTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YearlyTest.java @@ -31,9 +31,11 @@ public class YearlyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Yearly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Yearly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Yearly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Yearly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Yearly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Yearly.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YesterdayTest.java b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YesterdayTest.java index af4b6d4049..aff53a3db3 100644 --- a/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YesterdayTest.java +++ b/src/test/java/com/twilio/rest/api/v2010/account/usage/record/YesterdayTest.java @@ -31,9 +31,11 @@ public class YesterdayTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Yesterday.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Yesterday.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Yesterday.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Yesterday.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Yesterday.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Yesterday.reader("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/AssistantTest.java b/src/test/java/com/twilio/rest/autopilot/v1/AssistantTest.java index 61e8011ea7..e6756e91c9 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/AssistantTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/AssistantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AssistantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Assistant.reader().read(); + Assistant.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Assistant.reader().read()); + assertNotNull(Assistant.reader().read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Assistant.reader().read()); + assertNotNull(Assistant.reader().read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Assistant.creator().create(); + Assistant.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Assistant.creator().create(); + Assistant.creator().create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/RestoreAssistantTest.java b/src/test/java/com/twilio/rest/autopilot/v1/RestoreAssistantTest.java index 6ca2a24020..13163103c6 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/RestoreAssistantTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/RestoreAssistantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RestoreAssistantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - RestoreAssistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RestoreAssistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +63,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - RestoreAssistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RestoreAssistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/DefaultsTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/DefaultsTest.java index ba8f912d1d..ca049e641b 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/DefaultsTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/DefaultsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DefaultsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Defaults.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Defaults.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Defaults.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Defaults.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Defaults.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Defaults.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Defaults.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Defaults.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/DialogueTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/DialogueTest.java index 2ef4ad5979..4a7d15b3ea 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/DialogueTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/DialogueTest.java @@ -31,9 +31,11 @@ public class DialogueTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeTest.java index d6a419552e..06941375eb 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/FieldTypeTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FieldTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildTest.java index 5795f6aa5d..0aa47260b2 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/ModelBuildTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ModelBuildTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/QueryTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/QueryTest.java index e48a133d17..9d6fe613dd 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/QueryTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/QueryTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class QueryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +126,7 @@ public void testCreateRequest() { }}; try { - Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(); + Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(); + Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(tw); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetTest.java index 9433518712..200fc5ecb3 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/StyleSheetTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class StyleSheetTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/TaskTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/TaskTest.java index 4790a3b627..5cf437f512 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/TaskTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/TaskTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/WebhookTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/WebhookTest.java index 4a0c67454c..3612b5d11d 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/WebhookTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +51,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +65,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +83,7 @@ public void testReadRequest() { }}; try { - Webhook.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Webhook.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +97,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +109,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -129,7 +129,7 @@ public void testCreateRequest() { }}; try { - Webhook.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name", "events", URI.create("https://example.com")).create(); + Webhook.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name", "events", URI.create("https://example.com")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +143,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Webhook.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name", "events", URI.create("https://example.com")).create(); + Webhook.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name", "events", URI.create("https://example.com")).create(tw); } @Test @@ -161,7 +161,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,7 +175,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -193,7 +193,7 @@ public void testDeleteRequest() { }}; try { - Webhook.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +207,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Webhook.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueTest.java index e6ec7f780d..c674157ad4 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/fieldtype/FieldValueTest.java @@ -31,9 +31,11 @@ public class FieldValueTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +130,7 @@ public void testCreateRequest() { }}; try { - FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(); + FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(); + FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(tw); } @Test @@ -160,7 +162,7 @@ public void testDeleteRequest() { }}; try { - FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,6 +176,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/FieldTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/FieldTest.java index 3b98e5f89e..a95852af75 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/FieldTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/FieldTest.java @@ -31,9 +31,11 @@ public class FieldTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +130,7 @@ public void testCreateRequest() { }}; try { - Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(); + Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(); + Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(tw); } @Test @@ -160,7 +162,7 @@ public void testDeleteRequest() { }}; try { - Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,6 +176,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/SampleTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/SampleTest.java index 3f49ed8437..d196060788 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/SampleTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/SampleTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SampleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +126,7 @@ public void testCreateRequest() { }}; try { - Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(); + Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(); + Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(tw); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsTest.java index c5a3a39314..b8c8e36541 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskActionsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskActionsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsTest.java b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsTest.java index 0df489f0cc..c03a14dda5 100644 --- a/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsTest.java +++ b/src/test/java/com/twilio/rest/autopilot/v1/assistant/task/TaskStatisticsTest.java @@ -31,9 +31,11 @@ public class TaskStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/bulkexports/v1/ExportConfigurationTest.java b/src/test/java/com/twilio/rest/bulkexports/v1/ExportConfigurationTest.java index d4373a9403..ea769df632 100644 --- a/src/test/java/com/twilio/rest/bulkexports/v1/ExportConfigurationTest.java +++ b/src/test/java/com/twilio/rest/bulkexports/v1/ExportConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ExportConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - ExportConfiguration.fetcher("resource_type").fetch(); + ExportConfiguration.fetcher("resource_type").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExportConfiguration.fetcher("resource_type").fetch()); + assertNotNull(ExportConfiguration.fetcher("resource_type").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - ExportConfiguration.updater("resource_type").update(); + ExportConfiguration.updater("resource_type").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ExportConfiguration.updater("resource_type").update(); + ExportConfiguration.updater("resource_type").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/bulkexports/v1/ExportTest.java b/src/test/java/com/twilio/rest/bulkexports/v1/ExportTest.java index 9093df7919..72b061837a 100644 --- a/src/test/java/com/twilio/rest/bulkexports/v1/ExportTest.java +++ b/src/test/java/com/twilio/rest/bulkexports/v1/ExportTest.java @@ -31,9 +31,11 @@ public class ExportTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Export.fetcher("resource_type").fetch(); + Export.fetcher("resource_type").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Export.fetcher("resource_type").fetch()); + assertNotNull(Export.fetcher("resource_type").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/bulkexports/v1/export/DayTest.java b/src/test/java/com/twilio/rest/bulkexports/v1/export/DayTest.java index 654c764958..d39275ce54 100644 --- a/src/test/java/com/twilio/rest/bulkexports/v1/export/DayTest.java +++ b/src/test/java/com/twilio/rest/bulkexports/v1/export/DayTest.java @@ -31,9 +31,11 @@ public class DayTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Day.fetcher("resource_type", "day").fetch(); + Day.fetcher("resource_type", "day").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Day.fetcher("resource_type", "day").fetch()); + assertNotNull(Day.fetcher("resource_type", "day").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Day.reader("resource_type").read(); + Day.reader("resource_type").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Day.reader("resource_type").read()); + assertNotNull(Day.reader("resource_type").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Day.reader("resource_type").read()); + assertNotNull(Day.reader("resource_type").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJobTest.java b/src/test/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJobTest.java index 3f706715c9..cef6ab4e8f 100644 --- a/src/test/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJobTest.java +++ b/src/test/java/com/twilio/rest/bulkexports/v1/export/ExportCustomJobTest.java @@ -31,9 +31,11 @@ public class ExportCustomJobTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ExportCustomJob.reader("resource_type").read(); + ExportCustomJob.reader("resource_type").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExportCustomJob.reader("resource_type").read()); + assertNotNull(ExportCustomJob.reader("resource_type").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExportCustomJob.reader("resource_type").read()); + assertNotNull(ExportCustomJob.reader("resource_type").read(tw)); } @Test @@ -97,7 +99,7 @@ public void testCreateRequest() { }}; try { - ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(); + ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -111,6 +113,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(); + ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/bulkexports/v1/export/JobTest.java b/src/test/java/com/twilio/rest/bulkexports/v1/export/JobTest.java index 952ce64d20..cca6c94e4e 100644 --- a/src/test/java/com/twilio/rest/bulkexports/v1/export/JobTest.java +++ b/src/test/java/com/twilio/rest/bulkexports/v1/export/JobTest.java @@ -31,9 +31,11 @@ public class JobTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/CredentialTest.java b/src/test/java/com/twilio/rest/chat/v1/CredentialTest.java index 4d70082339..e9342abb91 100644 --- a/src/test/java/com/twilio/rest/chat/v1/CredentialTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Credential.reader().read(); + Credential.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/ServiceTest.java b/src/test/java/com/twilio/rest/chat/v1/ServiceTest.java index 739a4ab863..1c6680c0f7 100644 --- a/src/test/java/com/twilio/rest/chat/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/ChannelTest.java b/src/test/java/com/twilio/rest/chat/v1/service/ChannelTest.java index 250553beef..248fb9304d 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/ChannelTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/ChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/RoleTest.java b/src/test/java/com/twilio/rest/chat/v1/service/RoleTest.java index e24d19e02b..99feb3318c 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/RoleTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/RoleTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class RoleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testFetchRequest() { }}; try { - Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +82,7 @@ public void testDeleteRequest() { }}; try { - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +96,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -117,7 +116,7 @@ public void testCreateRequest() { }}; try { - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); } @Test @@ -149,7 +148,7 @@ public void testReadRequest() { }}; try { - Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -175,7 +174,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -193,7 +192,7 @@ public void testUpdateRequest() { }}; try { - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +206,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/UserTest.java b/src/test/java/com/twilio/rest/chat/v1/service/UserTest.java index 66120f19d9..4a28301df3 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/UserTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/channel/InviteTest.java b/src/test/java/com/twilio/rest/chat/v1/service/channel/InviteTest.java index 527462ec47..21dcef9b23 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/channel/InviteTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/channel/InviteTest.java @@ -31,9 +31,11 @@ public class InviteTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +143,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/channel/MemberTest.java b/src/test/java/com/twilio/rest/chat/v1/service/channel/MemberTest.java index c8eaba776d..da21576ea0 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/channel/MemberTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/channel/MemberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MemberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +157,7 @@ public void testDeleteRequest() { }}; try { - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,7 +203,7 @@ public void testUpdateRoleSidResponse() { result = new ObjectMapper(); }}; - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -217,6 +215,6 @@ public void testUpdateLastConsumedMessageIndexResponse() { result = new ObjectMapper(); }}; - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/channel/MessageTest.java b/src/test/java/com/twilio/rest/chat/v1/service/channel/MessageTest.java index 7ccbb492ec..dc9c00daf4 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/channel/MessageTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/channel/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); } @Test @@ -109,7 +107,7 @@ public void testCreateWithAttributesResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); } @Test @@ -127,7 +125,7 @@ public void testReadRequest() { }}; try { - Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -153,7 +151,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -171,7 +169,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -185,7 +183,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -203,7 +201,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -217,6 +215,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v1/service/user/UserChannelTest.java b/src/test/java/com/twilio/rest/chat/v1/service/user/UserChannelTest.java index b53be3f2c2..7f7f949272 100644 --- a/src/test/java/com/twilio/rest/chat/v1/service/user/UserChannelTest.java +++ b/src/test/java/com/twilio/rest/chat/v1/service/user/UserChannelTest.java @@ -31,9 +31,11 @@ public class UserChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/CredentialTest.java b/src/test/java/com/twilio/rest/chat/v2/CredentialTest.java index 25ac9c2905..713298ab92 100644 --- a/src/test/java/com/twilio/rest/chat/v2/CredentialTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Credential.reader().read(); + Credential.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/ServiceTest.java b/src/test/java/com/twilio/rest/chat/v2/ServiceTest.java index ea37f0dc67..422a8b0850 100644 --- a/src/test/java/com/twilio/rest/chat/v2/ServiceTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/BindingTest.java b/src/test/java/com/twilio/rest/chat/v2/service/BindingTest.java index 228a3dda29..502df7452d 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/BindingTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/BindingTest.java @@ -31,9 +31,11 @@ public class BindingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/ChannelTest.java b/src/test/java/com/twilio/rest/chat/v2/service/ChannelTest.java index 7c678cc362..bdfd6f8123 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/ChannelTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/ChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/RoleTest.java b/src/test/java/com/twilio/rest/chat/v2/service/RoleTest.java index 9bd816dd2d..a74b545ba1 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/RoleTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/RoleTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class RoleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testFetchRequest() { }}; try { - Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +82,7 @@ public void testDeleteRequest() { }}; try { - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +96,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -117,7 +116,7 @@ public void testCreateRequest() { }}; try { - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); } @Test @@ -149,7 +148,7 @@ public void testReadRequest() { }}; try { - Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -175,7 +174,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -193,7 +192,7 @@ public void testUpdateRequest() { }}; try { - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +206,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/UserTest.java b/src/test/java/com/twilio/rest/chat/v2/service/UserTest.java index 48da69cd57..a6370e798a 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/UserTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/channel/InviteTest.java b/src/test/java/com/twilio/rest/chat/v2/service/channel/InviteTest.java index 01aa4dab6b..aefd4cef3e 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/channel/InviteTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/channel/InviteTest.java @@ -31,9 +31,11 @@ public class InviteTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +143,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/channel/MemberTest.java b/src/test/java/com/twilio/rest/chat/v2/service/channel/MemberTest.java index 0ef773be30..99997b7e61 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/channel/MemberTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/channel/MemberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MemberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -84,7 +82,7 @@ public void testCreateRequest() { }}; try { - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(tw); } @Test @@ -116,7 +114,7 @@ public void testReadRequest() { }}; try { - Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -142,7 +140,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -160,7 +158,7 @@ public void testDeleteRequest() { }}; try { - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateRoleSidResponse() { result = new ObjectMapper(); }}; - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/channel/MessageTest.java b/src/test/java/com/twilio/rest/chat/v2/service/channel/MessageTest.java index e19a701917..2710ee446f 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/channel/MessageTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/channel/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +75,7 @@ public void testFetchMediaResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -121,7 +119,7 @@ public void testCreateWithAllResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -133,7 +131,7 @@ public void testCreateMediaResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -151,7 +149,7 @@ public void testReadRequest() { }}; try { - Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -165,7 +163,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -177,7 +175,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -195,7 +193,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -209,7 +207,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -227,7 +225,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -241,6 +239,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/channel/WebhookTest.java b/src/test/java/com/twilio/rest/chat/v2/service/channel/WebhookTest.java index 86524074b9..a951631399 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/channel/WebhookTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/channel/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(); + Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(); + Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/user/UserBindingTest.java b/src/test/java/com/twilio/rest/chat/v2/service/user/UserBindingTest.java index 50282bc2ad..f551f5ad88 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/user/UserBindingTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/user/UserBindingTest.java @@ -31,9 +31,11 @@ public class UserBindingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/chat/v2/service/user/UserChannelTest.java b/src/test/java/com/twilio/rest/chat/v2/service/user/UserChannelTest.java index 938840c0bb..356d6414dc 100644 --- a/src/test/java/com/twilio/rest/chat/v2/service/user/UserChannelTest.java +++ b/src/test/java/com/twilio/rest/chat/v2/service/user/UserChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testDeleteRequest() { }}; try { - UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateNotificationLevelResponse() { result = new ObjectMapper(); }}; - UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -185,6 +183,6 @@ public void testUpdateLastConsumedMessageIndexResponse() { result = new ObjectMapper(); }}; - UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/AddressConfigurationTest.java b/src/test/java/com/twilio/rest/conversations/v1/AddressConfigurationTest.java index 5cb27c2808..3f470b7ff9 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/AddressConfigurationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/AddressConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AddressConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - AddressConfiguration.reader().read(); + AddressConfiguration.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadAllResponse() { result = new ObjectMapper(); }}; - assertNotNull(AddressConfiguration.reader().read()); + assertNotNull(AddressConfiguration.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadBlankResponse() { result = new ObjectMapper(); }}; - assertNotNull(AddressConfiguration.reader().read()); + assertNotNull(AddressConfiguration.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - AddressConfiguration.fetcher("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AddressConfiguration.fetcher("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AddressConfiguration.fetcher("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AddressConfiguration.fetcher("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -128,7 +126,7 @@ public void testCreateRequest() { }}; try { - AddressConfiguration.creator(AddressConfiguration.Type.SMS, "address").create(); + AddressConfiguration.creator(AddressConfiguration.Type.SMS, "address").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AddressConfiguration.creator(AddressConfiguration.Type.SMS, "address").create(); + AddressConfiguration.creator(AddressConfiguration.Type.SMS, "address").create(tw); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - AddressConfiguration.updater("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AddressConfiguration.updater("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - AddressConfiguration.updater("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AddressConfiguration.updater("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - AddressConfiguration.deleter("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AddressConfiguration.deleter("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AddressConfiguration.deleter("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AddressConfiguration.deleter("IGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/ConfigurationTest.java b/src/test/java/com/twilio/rest/conversations/v1/ConfigurationTest.java index 056c20233b..ecee6157ba 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/ConfigurationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/ConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Configuration.fetcher().fetch(); + Configuration.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Configuration.fetcher().fetch()); + assertNotNull(Configuration.fetcher().fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Configuration.updater().update(); + Configuration.updater().update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Configuration.updater().update(); + Configuration.updater().update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/ConversationTest.java b/src/test/java/com/twilio/rest/conversations/v1/ConversationTest.java index 9a2203d9e8..b5c649ee6e 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/ConversationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/ConversationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConversationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Conversation.creator().setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(); + Conversation.creator().setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Conversation.creator().setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(); + Conversation.creator().setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateNoTimersNoAttributesResponse() { result = new ObjectMapper(); }}; - Conversation.creator().setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(); + Conversation.creator().setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(tw); } @Test @@ -95,7 +93,7 @@ public void testUpdateRequest() { }}; try { - Conversation.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(); + Conversation.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Conversation.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(); + Conversation.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(tw); } @Test @@ -127,7 +125,7 @@ public void testDeleteRequest() { }}; try { - Conversation.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(); + Conversation.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Conversation.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(); + Conversation.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -159,7 +157,7 @@ public void testFetchRequest() { }}; try { - Conversation.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Conversation.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conversation.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conversation.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -191,7 +189,7 @@ public void testReadRequest() { }}; try { - Conversation.reader().read(); + Conversation.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conversation.reader().read()); + assertNotNull(Conversation.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/CredentialTest.java b/src/test/java/com/twilio/rest/conversations/v1/CredentialTest.java index c559e96e34..553bff555d 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/CredentialTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Credential.creator(Credential.PushType.APN).create(); + Credential.creator(Credential.PushType.APN).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator(Credential.PushType.APN).create(); + Credential.creator(Credential.PushType.APN).create(tw); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -179,7 +177,7 @@ public void testReadRequest() { }}; try { - Credential.reader().read(); + Credential.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,7 +191,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -205,6 +203,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/ParticipantConversationTest.java b/src/test/java/com/twilio/rest/conversations/v1/ParticipantConversationTest.java index 1a551b484a..09d641f913 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/ParticipantConversationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/ParticipantConversationTest.java @@ -31,9 +31,11 @@ public class ParticipantConversationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ParticipantConversation.reader().read(); + ParticipantConversation.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ParticipantConversation.reader().read()); + assertNotNull(ParticipantConversation.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullByIdentityResponse() { result = new ObjectMapper(); }}; - assertNotNull(ParticipantConversation.reader().read()); + assertNotNull(ParticipantConversation.reader().read(tw)); } @Test @@ -89,6 +91,6 @@ public void testReadFullByAddressResponse() { result = new ObjectMapper(); }}; - assertNotNull(ParticipantConversation.reader().read()); + assertNotNull(ParticipantConversation.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/RoleTest.java b/src/test/java/com/twilio/rest/conversations/v1/RoleTest.java index 98a8fc59fa..8de3e0d1ed 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/RoleTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/RoleTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class RoleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +52,7 @@ public void testCreateRequest() { }}; try { - Role.creator("friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(); + Role.creator("friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +66,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Role.creator("friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(); + Role.creator("friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(tw); } @Test @@ -85,7 +84,7 @@ public void testUpdateRequest() { }}; try { - Role.updater("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +98,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Role.updater("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); } @Test @@ -117,7 +116,7 @@ public void testDeleteRequest() { }}; try { - Role.deleter("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Role.deleter("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -149,7 +148,7 @@ public void testFetchRequest() { }}; try { - Role.fetcher("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Role.fetcher("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.fetcher("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Role.fetcher("RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -181,7 +180,7 @@ public void testReadRequest() { }}; try { - Role.reader().read(); + Role.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -195,7 +194,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader().read()); + assertNotNull(Role.reader().read(tw)); } @Test @@ -207,6 +206,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader().read()); + assertNotNull(Role.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/ServiceTest.java b/src/test/java/com/twilio/rest/conversations/v1/ServiceTest.java index dd72743cd8..d9b7d8557e 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/ServiceTest.java @@ -31,9 +31,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,6 +163,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/UserTest.java b/src/test/java/com/twilio/rest/conversations/v1/UserTest.java index 44fec263fb..97de6fac8f 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/UserTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - User.creator("identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - User.creator("identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); } @Test @@ -84,7 +82,7 @@ public void testUpdateRequest() { }}; try { - User.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); } @Test @@ -116,7 +114,7 @@ public void testDeleteRequest() { }}; try { - User.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(); + User.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - User.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(); + User.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -148,7 +146,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + User.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(User.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -180,7 +178,7 @@ public void testReadRequest() { }}; try { - User.reader().read(); + User.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,6 +192,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader().read()); + assertNotNull(User.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/configuration/WebhookTest.java b/src/test/java/com/twilio/rest/conversations/v1/configuration/WebhookTest.java index 40fd29ba02..3907287241 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/configuration/WebhookTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/configuration/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher().fetch(); + Webhook.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher().fetch()); + assertNotNull(Webhook.fetcher().fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater().update(); + Webhook.updater().update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater().update(); + Webhook.updater().update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/conversation/MessageTest.java b/src/test/java/com/twilio/rest/conversations/v1/conversation/MessageTest.java index a41e3405e3..5a7d40da12 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/conversation/MessageTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/conversation/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateWithMediaResponse() { result = new ObjectMapper(); }}; - Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -89,7 +87,7 @@ public void testCreateNoAttributesResponse() { result = new ObjectMapper(); }}; - Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -107,7 +105,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -121,7 +119,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Message.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); } @Test @@ -139,7 +137,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -153,7 +151,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -171,7 +169,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -185,7 +183,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -203,7 +201,7 @@ public void testReadRequest() { }}; try { - Message.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -217,7 +215,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -229,6 +227,6 @@ public void testReadLastMessageResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/conversation/ParticipantTest.java b/src/test/java/com/twilio/rest/conversations/v1/conversation/ParticipantTest.java index c04bf3592e..4d3836a709 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/conversation/ParticipantTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/conversation/ParticipantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateSmsResponse() { result = new ObjectMapper(); }}; - Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateChatResponse() { result = new ObjectMapper(); }}; - Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -89,7 +87,7 @@ public void testCreateGmmsResponse() { result = new ObjectMapper(); }}; - Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -101,7 +99,7 @@ public void testCreateGmmsChatNoAttributesResponse() { result = new ObjectMapper(); }}; - Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -113,7 +111,7 @@ public void testCreateGmmsSmsNoAttributesResponse() { result = new ObjectMapper(); }}; - Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -131,7 +129,7 @@ public void testUpdateRequest() { }}; try { - Participant.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(); + Participant.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -145,7 +143,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Participant.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(); + Participant.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(tw); } @Test @@ -157,7 +155,7 @@ public void testUpdateGmmsResponse() { result = new ObjectMapper(); }}; - Participant.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(); + Participant.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(tw); } @Test @@ -175,7 +173,7 @@ public void testDeleteRequest() { }}; try { - Participant.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(); + Participant.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -189,7 +187,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Participant.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(); + Participant.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -207,7 +205,7 @@ public void testFetchRequest() { }}; try { - Participant.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Participant.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -221,7 +219,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -239,7 +237,7 @@ public void testReadRequest() { }}; try { - Participant.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Participant.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -253,6 +251,6 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/conversation/WebhookTest.java b/src/test/java/com/twilio/rest/conversations/v1/conversation/WebhookTest.java index d064f5dcf0..eae0b79237 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/conversation/WebhookTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/conversation/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Webhook.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Webhook.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Webhook.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(); + Webhook.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Webhook.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(); + Webhook.creator("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Webhook.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Webhook.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/conversation/message/DeliveryReceiptTest.java b/src/test/java/com/twilio/rest/conversations/v1/conversation/message/DeliveryReceiptTest.java index 82918e2d7c..4781f929ae 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/conversation/message/DeliveryReceiptTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/conversation/message/DeliveryReceiptTest.java @@ -31,9 +31,11 @@ public class DeliveryReceiptTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - DeliveryReceipt.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + DeliveryReceipt.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(DeliveryReceipt.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(DeliveryReceipt.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - DeliveryReceipt.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DeliveryReceipt.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(DeliveryReceipt.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DeliveryReceipt.reader("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/BindingTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/BindingTest.java index a75fb6e011..86acb8a089 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/BindingTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/BindingTest.java @@ -31,9 +31,11 @@ public class BindingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testDeleteRequest() { }}; try { - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +143,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/ConfigurationTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/ConfigurationTest.java index 7044007623..db2ebbcffc 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/ConfigurationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/ConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Configuration.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Configuration.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Configuration.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Configuration.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Configuration.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Configuration.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Configuration.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Configuration.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/ConversationTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/ConversationTest.java index 1a978cf8b6..21715d335a 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/ConversationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/ConversationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConversationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Conversation.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(); + Conversation.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Conversation.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(); + Conversation.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateNoTimersNoAttributesResponse() { result = new ObjectMapper(); }}; - Conversation.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(); + Conversation.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).create(tw); } @Test @@ -95,7 +93,7 @@ public void testUpdateRequest() { }}; try { - Conversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(); + Conversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Conversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(); + Conversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).update(tw); } @Test @@ -127,7 +125,7 @@ public void testDeleteRequest() { }}; try { - Conversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(); + Conversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Conversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(); + Conversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Conversation.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -159,7 +157,7 @@ public void testFetchRequest() { }}; try { - Conversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Conversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -191,7 +189,7 @@ public void testReadRequest() { }}; try { - Conversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Conversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Conversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/ParticipantConversationTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/ParticipantConversationTest.java index 7716c8fa43..2c4885bfe7 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/ParticipantConversationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/ParticipantConversationTest.java @@ -31,9 +31,11 @@ public class ParticipantConversationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullByIdentityResponse() { result = new ObjectMapper(); }}; - assertNotNull(ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -89,6 +91,6 @@ public void testReadFullByAddressResponse() { result = new ObjectMapper(); }}; - assertNotNull(ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ParticipantConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/RoleTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/RoleTest.java index 5a2135fe14..28372127c0 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/RoleTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/RoleTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class RoleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +52,7 @@ public void testCreateRequest() { }}; try { - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +66,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CONVERSATION, Promoter.listOfOne("permission")).create(tw); } @Test @@ -85,7 +84,7 @@ public void testUpdateRequest() { }}; try { - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +98,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); } @Test @@ -117,7 +116,7 @@ public void testDeleteRequest() { }}; try { - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -149,7 +148,7 @@ public void testFetchRequest() { }}; try { - Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -181,7 +180,7 @@ public void testReadRequest() { }}; try { - Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -195,7 +194,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -207,6 +206,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/UserTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/UserTest.java index b7ea736ec4..6fa72918af 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/UserTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); } @Test @@ -84,7 +82,7 @@ public void testUpdateRequest() { }}; try { - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); } @Test @@ -116,7 +114,7 @@ public void testDeleteRequest() { }}; try { - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -148,7 +146,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -180,7 +178,7 @@ public void testReadRequest() { }}; try { - User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,6 +192,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/configuration/NotificationTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/configuration/NotificationTest.java index 35abe85919..ab6297d7ed 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/configuration/NotificationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/configuration/NotificationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class NotificationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - Notification.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Notification.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Notification.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Notification.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Notification.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Notification.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Notification.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Notification.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/configuration/WebhookTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/configuration/WebhookTest.java index 699d514eeb..6ae257a7e3 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/configuration/WebhookTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/configuration/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -109,6 +107,6 @@ public void testFetchEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/MessageTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/MessageTest.java index 5f7ccc1516..1ee340b1e2 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/MessageTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateWithMediaResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -89,7 +87,7 @@ public void testCreateNoAttributesResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -107,7 +105,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -121,7 +119,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); } @Test @@ -139,7 +137,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -153,7 +151,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -171,7 +169,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -185,7 +183,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -203,7 +201,7 @@ public void testReadRequest() { }}; try { - Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -217,7 +215,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -229,6 +227,6 @@ public void testReadLastMessageResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/ParticipantTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/ParticipantTest.java index 9e50363aa5..6f8d41e048 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/ParticipantTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/ParticipantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateSmsResponse() { result = new ObjectMapper(); }}; - Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateChatResponse() { result = new ObjectMapper(); }}; - Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -89,7 +87,7 @@ public void testCreateGmmsResponse() { result = new ObjectMapper(); }}; - Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -101,7 +99,7 @@ public void testCreateGmmsChatNoAttributesResponse() { result = new ObjectMapper(); }}; - Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -113,7 +111,7 @@ public void testCreateGmmsSmsNoAttributesResponse() { result = new ObjectMapper(); }}; - Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(); + Participant.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).create(tw); } @Test @@ -131,7 +129,7 @@ public void testUpdateRequest() { }}; try { - Participant.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(); + Participant.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -145,7 +143,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Participant.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(); + Participant.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(tw); } @Test @@ -157,7 +155,7 @@ public void testUpdateGmmsResponse() { result = new ObjectMapper(); }}; - Participant.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(); + Participant.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).update(tw); } @Test @@ -175,7 +173,7 @@ public void testDeleteRequest() { }}; try { - Participant.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(); + Participant.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -189,7 +187,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Participant.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(); + Participant.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Participant.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -207,7 +205,7 @@ public void testFetchRequest() { }}; try { - Participant.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Participant.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -221,7 +219,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -239,7 +237,7 @@ public void testReadRequest() { }}; try { - Participant.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Participant.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -253,6 +251,6 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/WebhookTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/WebhookTest.java index 2f47c0a631..a255650722 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/WebhookTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(); + Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(); + Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Target.WEBHOOK).create(tw); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -179,7 +177,7 @@ public void testReadRequest() { }}; try { - Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,7 +191,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -205,6 +203,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/message/DeliveryReceiptTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/message/DeliveryReceiptTest.java index ddd228782e..9f34a8b1d5 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/conversation/message/DeliveryReceiptTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/conversation/message/DeliveryReceiptTest.java @@ -31,9 +31,11 @@ public class DeliveryReceiptTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - DeliveryReceipt.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + DeliveryReceipt.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(DeliveryReceipt.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(DeliveryReceipt.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - DeliveryReceipt.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DeliveryReceipt.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(DeliveryReceipt.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DeliveryReceipt.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/service/user/UserConversationTest.java b/src/test/java/com/twilio/rest/conversations/v1/service/user/UserConversationTest.java index c0fd6ceb3d..8a5d03ccc3 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/service/user/UserConversationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/service/user/UserConversationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserConversationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - UserConversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserConversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - UserConversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserConversation.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - UserConversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserConversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UserConversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserConversation.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testFetchRequest() { }}; try { - UserConversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UserConversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserConversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UserConversation.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - UserConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +171,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserConversation.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/conversations/v1/user/UserConversationTest.java b/src/test/java/com/twilio/rest/conversations/v1/user/UserConversationTest.java index d2cbe790e1..8125aaab3e 100644 --- a/src/test/java/com/twilio/rest/conversations/v1/user/UserConversationTest.java +++ b/src/test/java/com/twilio/rest/conversations/v1/user/UserConversationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserConversationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testUpdateRequest() { }}; try { - UserConversation.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserConversation.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - UserConversation.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserConversation.updater("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - UserConversation.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserConversation.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UserConversation.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserConversation.deleter("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testFetchRequest() { }}; try { - UserConversation.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UserConversation.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserConversation.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UserConversation.fetcher("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - UserConversation.reader("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserConversation.reader("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserConversation.reader("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserConversation.reader("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +171,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserConversation.reader("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserConversation.reader("USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/EventTypeTest.java b/src/test/java/com/twilio/rest/events/v1/EventTypeTest.java index f0eb1c3714..b03a3ee469 100644 --- a/src/test/java/com/twilio/rest/events/v1/EventTypeTest.java +++ b/src/test/java/com/twilio/rest/events/v1/EventTypeTest.java @@ -31,9 +31,11 @@ public class EventTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - EventType.reader().read(); + EventType.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(EventType.reader().read()); + assertNotNull(EventType.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(EventType.reader().read()); + assertNotNull(EventType.reader().read(tw)); } @Test @@ -89,7 +91,7 @@ public void testReadResultsWithSchemaIdResponse() { result = new ObjectMapper(); }}; - assertNotNull(EventType.reader().read()); + assertNotNull(EventType.reader().read(tw)); } @Test @@ -107,7 +109,7 @@ public void testFetchRequest() { }}; try { - EventType.fetcher("type").fetch(); + EventType.fetcher("type").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -121,6 +123,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EventType.fetcher("type").fetch()); + assertNotNull(EventType.fetcher("type").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/SchemaTest.java b/src/test/java/com/twilio/rest/events/v1/SchemaTest.java index 2a9112a5ca..9b01aca92b 100644 --- a/src/test/java/com/twilio/rest/events/v1/SchemaTest.java +++ b/src/test/java/com/twilio/rest/events/v1/SchemaTest.java @@ -31,9 +31,11 @@ public class SchemaTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Schema.fetcher("id").fetch(); + Schema.fetcher("id").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Schema.fetcher("id").fetch()); + assertNotNull(Schema.fetcher("id").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/SinkTest.java b/src/test/java/com/twilio/rest/events/v1/SinkTest.java index c252c3c8ea..e98304b70c 100644 --- a/src/test/java/com/twilio/rest/events/v1/SinkTest.java +++ b/src/test/java/com/twilio/rest/events/v1/SinkTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SinkTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Sink.fetcher("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Sink.fetcher("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sink.fetcher("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Sink.fetcher("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -85,7 +83,7 @@ public void testCreateRequest() { }}; try { - Sink.creator("description", new java.util.HashMap(), Sink.SinkType.KINESIS).create(); + Sink.creator("description", new java.util.HashMap(), Sink.SinkType.KINESIS).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +97,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Sink.creator("description", new java.util.HashMap(), Sink.SinkType.KINESIS).create(); + Sink.creator("description", new java.util.HashMap(), Sink.SinkType.KINESIS).create(tw); } @Test @@ -111,7 +109,7 @@ public void testCreateSegmentResponse() { result = new ObjectMapper(); }}; - Sink.creator("description", new java.util.HashMap(), Sink.SinkType.KINESIS).create(); + Sink.creator("description", new java.util.HashMap(), Sink.SinkType.KINESIS).create(tw); } @Test @@ -129,7 +127,7 @@ public void testDeleteRequest() { }}; try { - Sink.deleter("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sink.deleter("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +141,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Sink.deleter("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sink.deleter("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -161,7 +159,7 @@ public void testReadRequest() { }}; try { - Sink.reader().read(); + Sink.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,7 +173,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sink.reader().read()); + assertNotNull(Sink.reader().read(tw)); } @Test @@ -187,7 +185,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sink.reader().read()); + assertNotNull(Sink.reader().read(tw)); } @Test @@ -199,7 +197,7 @@ public void testReadResultsInUseResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sink.reader().read()); + assertNotNull(Sink.reader().read(tw)); } @Test @@ -211,7 +209,7 @@ public void testReadResultsStatusResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sink.reader().read()); + assertNotNull(Sink.reader().read(tw)); } @Test @@ -229,7 +227,7 @@ public void testUpdateRequest() { }}; try { - Sink.updater("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description").update(); + Sink.updater("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -243,6 +241,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Sink.updater("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description").update(); + Sink.updater("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/SubscriptionTest.java b/src/test/java/com/twilio/rest/events/v1/SubscriptionTest.java index 01e0c40306..289e32ac87 100644 --- a/src/test/java/com/twilio/rest/events/v1/SubscriptionTest.java +++ b/src/test/java/com/twilio/rest/events/v1/SubscriptionTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class SubscriptionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testReadRequest() { }}; try { - Subscription.reader().read(); + Subscription.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Subscription.reader().read()); + assertNotNull(Subscription.reader().read(tw)); } @Test @@ -77,7 +76,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Subscription.reader().read()); + assertNotNull(Subscription.reader().read(tw)); } @Test @@ -89,7 +88,7 @@ public void testReadResultsFilteredBySinkSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(Subscription.reader().read()); + assertNotNull(Subscription.reader().read(tw)); } @Test @@ -107,7 +106,7 @@ public void testFetchRequest() { }}; try { - Subscription.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Subscription.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -121,7 +120,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Subscription.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Subscription.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -141,7 +140,7 @@ public void testCreateRequest() { }}; try { - Subscription.creator("description", "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne((java.util.Map)new java.util.HashMap())).create(); + Subscription.creator("description", "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne((java.util.Map)new java.util.HashMap())).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -155,7 +154,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Subscription.creator("description", "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne((java.util.Map)new java.util.HashMap())).create(); + Subscription.creator("description", "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne((java.util.Map)new java.util.HashMap())).create(tw); } @Test @@ -173,7 +172,7 @@ public void testUpdateRequest() { }}; try { - Subscription.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Subscription.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -187,7 +186,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Subscription.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Subscription.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -205,7 +204,7 @@ public void testDeleteRequest() { }}; try { - Subscription.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Subscription.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -219,6 +218,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Subscription.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Subscription.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/schema/SchemaVersionTest.java b/src/test/java/com/twilio/rest/events/v1/schema/SchemaVersionTest.java index 9bd7f9593f..b684e80517 100644 --- a/src/test/java/com/twilio/rest/events/v1/schema/SchemaVersionTest.java +++ b/src/test/java/com/twilio/rest/events/v1/schema/SchemaVersionTest.java @@ -31,9 +31,11 @@ public class SchemaVersionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - SchemaVersion.reader("id").read(); + SchemaVersion.reader("id").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SchemaVersion.reader("id").read()); + assertNotNull(SchemaVersion.reader("id").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(SchemaVersion.reader("id").read()); + assertNotNull(SchemaVersion.reader("id").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - SchemaVersion.fetcher("id", 1).fetch(); + SchemaVersion.fetcher("id", 1).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SchemaVersion.fetcher("id", 1).fetch()); + assertNotNull(SchemaVersion.fetcher("id", 1).fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/sink/SinkTestTest.java b/src/test/java/com/twilio/rest/events/v1/sink/SinkTestTest.java index e2bd71088f..1cf8eb4d8b 100644 --- a/src/test/java/com/twilio/rest/events/v1/sink/SinkTestTest.java +++ b/src/test/java/com/twilio/rest/events/v1/sink/SinkTestTest.java @@ -31,9 +31,11 @@ public class SinkTestTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - SinkTest.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SinkTest.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SinkTest.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SinkTest.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/sink/SinkValidateTest.java b/src/test/java/com/twilio/rest/events/v1/sink/SinkValidateTest.java index adab47bc62..2ffcd7d94c 100644 --- a/src/test/java/com/twilio/rest/events/v1/sink/SinkValidateTest.java +++ b/src/test/java/com/twilio/rest/events/v1/sink/SinkValidateTest.java @@ -31,9 +31,11 @@ public class SinkValidateTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - SinkValidate.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "test_id").create(); + SinkValidate.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "test_id").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SinkValidate.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "test_id").create(); + SinkValidate.creator("DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "test_id").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/events/v1/subscription/SubscribedEventTest.java b/src/test/java/com/twilio/rest/events/v1/subscription/SubscribedEventTest.java index 3073e21e55..33f293b7a7 100644 --- a/src/test/java/com/twilio/rest/events/v1/subscription/SubscribedEventTest.java +++ b/src/test/java/com/twilio/rest/events/v1/subscription/SubscribedEventTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SubscribedEventTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - SubscribedEvent.reader("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SubscribedEvent.reader("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SubscribedEvent.reader("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SubscribedEvent.reader("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(SubscribedEvent.reader("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SubscribedEvent.reader("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - SubscribedEvent.creator("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").create(); + SubscribedEvent.creator("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SubscribedEvent.creator("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").create(); + SubscribedEvent.creator("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - SubscribedEvent.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").fetch(); + SubscribedEvent.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SubscribedEvent.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").fetch()); + assertNotNull(SubscribedEvent.fetcher("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - SubscribedEvent.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").update(); + SubscribedEvent.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SubscribedEvent.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").update(); + SubscribedEvent.updater("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - SubscribedEvent.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").delete(); + SubscribedEvent.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SubscribedEvent.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").delete(); + SubscribedEvent.deleter("DFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "type").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/fax/v1/FaxTest.java b/src/test/java/com/twilio/rest/fax/v1/FaxTest.java index 45383d2b8e..3e8975f28d 100644 --- a/src/test/java/com/twilio/rest/fax/v1/FaxTest.java +++ b/src/test/java/com/twilio/rest/fax/v1/FaxTest.java @@ -31,9 +31,11 @@ public class FaxTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Fax.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Fax.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fax.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Fax.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Fax.reader().read(); + Fax.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fax.reader().read()); + assertNotNull(Fax.reader().read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fax.reader().read()); + assertNotNull(Fax.reader().read(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - Fax.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Fax.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Fax.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Fax.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/fax/v1/fax/FaxMediaTest.java b/src/test/java/com/twilio/rest/fax/v1/fax/FaxMediaTest.java index 6b1f77fdef..6bd732b00b 100644 --- a/src/test/java/com/twilio/rest/fax/v1/fax/FaxMediaTest.java +++ b/src/test/java/com/twilio/rest/fax/v1/fax/FaxMediaTest.java @@ -31,9 +31,11 @@ public class FaxMediaTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - FaxMedia.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FaxMedia.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FaxMedia.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FaxMedia.fetcher("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - FaxMedia.reader("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FaxMedia.reader("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(FaxMedia.reader("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FaxMedia.reader("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -115,7 +117,7 @@ public void testDeleteRequest() { }}; try { - FaxMedia.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FaxMedia.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +131,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FaxMedia.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FaxMedia.deleter("FXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/flexapi/v1/ChannelTest.java b/src/test/java/com/twilio/rest/flexapi/v1/ChannelTest.java index 365a064989..1addb63c00 100644 --- a/src/test/java/com/twilio/rest/flexapi/v1/ChannelTest.java +++ b/src/test/java/com/twilio/rest/flexapi/v1/ChannelTest.java @@ -31,9 +31,11 @@ public class ChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Channel.reader().read(); + Channel.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader().read()); + assertNotNull(Channel.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader().read()); + assertNotNull(Channel.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Channel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Channel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Channel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -130,7 +132,7 @@ public void testCreateRequest() { }}; try { - Channel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "chat_user_friendly_name", "chat_friendly_name").create(); + Channel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "chat_user_friendly_name", "chat_friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -144,7 +146,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Channel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "chat_user_friendly_name", "chat_friendly_name").create(); + Channel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "chat_user_friendly_name", "chat_friendly_name").create(tw); } @Test @@ -162,7 +164,7 @@ public void testDeleteRequest() { }}; try { - Channel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Channel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -176,6 +178,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Channel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Channel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/flexapi/v1/ConfigurationTest.java b/src/test/java/com/twilio/rest/flexapi/v1/ConfigurationTest.java index 151b69ab5c..8c14b06b05 100644 --- a/src/test/java/com/twilio/rest/flexapi/v1/ConfigurationTest.java +++ b/src/test/java/com/twilio/rest/flexapi/v1/ConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Configuration.fetcher().fetch(); + Configuration.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Configuration.fetcher().fetch()); + assertNotNull(Configuration.fetcher().fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Configuration.creator().create(); + Configuration.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Configuration.creator().create(); + Configuration.creator().create(tw); } @Test @@ -115,7 +113,7 @@ public void testUpdateRequest() { }}; try { - Configuration.updater().update(); + Configuration.updater().update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +127,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Configuration.updater().update(); + Configuration.updater().update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/flexapi/v1/FlexFlowTest.java b/src/test/java/com/twilio/rest/flexapi/v1/FlexFlowTest.java index 3951afd062..d15ac6f614 100644 --- a/src/test/java/com/twilio/rest/flexapi/v1/FlexFlowTest.java +++ b/src/test/java/com/twilio/rest/flexapi/v1/FlexFlowTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FlexFlowTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - FlexFlow.reader().read(); + FlexFlow.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(FlexFlow.reader().read()); + assertNotNull(FlexFlow.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FlexFlow.reader().read()); + assertNotNull(FlexFlow.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - FlexFlow.fetcher("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FlexFlow.fetcher("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FlexFlow.fetcher("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FlexFlow.fetcher("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -129,7 +127,7 @@ public void testCreateRequest() { }}; try { - FlexFlow.creator("friendly_name", "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", FlexFlow.ChannelType.WEB).create(); + FlexFlow.creator("friendly_name", "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", FlexFlow.ChannelType.WEB).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +141,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - FlexFlow.creator("friendly_name", "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", FlexFlow.ChannelType.WEB).create(); + FlexFlow.creator("friendly_name", "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", FlexFlow.ChannelType.WEB).create(tw); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - FlexFlow.updater("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + FlexFlow.updater("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,7 +173,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - FlexFlow.updater("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + FlexFlow.updater("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -193,7 +191,7 @@ public void testDeleteRequest() { }}; try { - FlexFlow.deleter("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FlexFlow.deleter("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +205,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FlexFlow.deleter("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FlexFlow.deleter("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/flexapi/v1/WebChannelTest.java b/src/test/java/com/twilio/rest/flexapi/v1/WebChannelTest.java index 3dce23612d..975787d374 100644 --- a/src/test/java/com/twilio/rest/flexapi/v1/WebChannelTest.java +++ b/src/test/java/com/twilio/rest/flexapi/v1/WebChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - WebChannel.reader().read(); + WebChannel.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(WebChannel.reader().read()); + assertNotNull(WebChannel.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(WebChannel.reader().read()); + assertNotNull(WebChannel.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - WebChannel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WebChannel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WebChannel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WebChannel.fetcher("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -130,7 +128,7 @@ public void testCreateRequest() { }}; try { - WebChannel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "customer_friendly_name", "chat_friendly_name").create(); + WebChannel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "customer_friendly_name", "chat_friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -144,7 +142,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - WebChannel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "customer_friendly_name", "chat_friendly_name").create(); + WebChannel.creator("FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "customer_friendly_name", "chat_friendly_name").create(tw); } @Test @@ -162,7 +160,7 @@ public void testUpdateRequest() { }}; try { - WebChannel.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + WebChannel.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -176,7 +174,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - WebChannel.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + WebChannel.updater("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -194,7 +192,7 @@ public void testDeleteRequest() { }}; try { - WebChannel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + WebChannel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -208,6 +206,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - WebChannel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + WebChannel.deleter("CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/frontlineapi/v1/UserTest.java b/src/test/java/com/twilio/rest/frontlineapi/v1/UserTest.java index 3c1d3f9f3b..2911e783ff 100644 --- a/src/test/java/com/twilio/rest/frontlineapi/v1/UserTest.java +++ b/src/test/java/com/twilio/rest/frontlineapi/v1/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("sid").fetch(); + User.fetcher("sid").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("sid").fetch()); + assertNotNull(User.fetcher("sid").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - User.updater("sid").update(); + User.updater("sid").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("sid").update(); + User.updater("sid").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/CallSummariesTest.java b/src/test/java/com/twilio/rest/insights/v1/CallSummariesTest.java index 5c9a2eeb23..203d41d84c 100644 --- a/src/test/java/com/twilio/rest/insights/v1/CallSummariesTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/CallSummariesTest.java @@ -31,9 +31,11 @@ public class CallSummariesTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - CallSummaries.reader().read(); + CallSummaries.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CallSummaries.reader().read()); + assertNotNull(CallSummaries.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadWithCarrierResponse() { result = new ObjectMapper(); }}; - assertNotNull(CallSummaries.reader().read()); + assertNotNull(CallSummaries.reader().read(tw)); } @Test @@ -89,7 +91,7 @@ public void testReadWithSubaccountResponse() { result = new ObjectMapper(); }}; - assertNotNull(CallSummaries.reader().read()); + assertNotNull(CallSummaries.reader().read(tw)); } @Test @@ -101,7 +103,7 @@ public void testReadWithTrustResponse() { result = new ObjectMapper(); }}; - assertNotNull(CallSummaries.reader().read()); + assertNotNull(CallSummaries.reader().read(tw)); } @Test @@ -113,6 +115,6 @@ public void testReadWithAbnormalSessionResponse() { result = new ObjectMapper(); }}; - assertNotNull(CallSummaries.reader().read()); + assertNotNull(CallSummaries.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/CallTest.java b/src/test/java/com/twilio/rest/insights/v1/CallTest.java index 9baaa632b7..e6253dd2bb 100644 --- a/src/test/java/com/twilio/rest/insights/v1/CallTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/CallTest.java @@ -31,9 +31,11 @@ public class CallTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Call.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Call.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Call.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Call.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/ConferenceTest.java b/src/test/java/com/twilio/rest/insights/v1/ConferenceTest.java index 216f1ee122..d757f6638c 100644 --- a/src/test/java/com/twilio/rest/insights/v1/ConferenceTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/ConferenceTest.java @@ -31,9 +31,11 @@ public class ConferenceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Conference.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Conference.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Conference.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Conference.reader().read(); + Conference.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader().read()); + assertNotNull(Conference.reader().read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadWithRegionResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader().read()); + assertNotNull(Conference.reader().read(tw)); } @Test @@ -121,7 +123,7 @@ public void testReadWithFriendlynameStartfailureResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader().read()); + assertNotNull(Conference.reader().read(tw)); } @Test @@ -133,7 +135,7 @@ public void testReadWithDuplicateIdentityResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader().read()); + assertNotNull(Conference.reader().read(tw)); } @Test @@ -145,6 +147,6 @@ public void testReadWithDetectedIssueEndreasonResponse() { result = new ObjectMapper(); }}; - assertNotNull(Conference.reader().read()); + assertNotNull(Conference.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/RoomTest.java b/src/test/java/com/twilio/rest/insights/v1/RoomTest.java index 3d6b593936..b8095a8f83 100644 --- a/src/test/java/com/twilio/rest/insights/v1/RoomTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/RoomTest.java @@ -31,9 +31,11 @@ public class RoomTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Room.reader().read(); + Room.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Room.reader().read()); + assertNotNull(Room.reader().read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Room.reader().read()); + assertNotNull(Room.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/SettingTest.java b/src/test/java/com/twilio/rest/insights/v1/SettingTest.java index 8054c0ea4d..d50139ea8c 100644 --- a/src/test/java/com/twilio/rest/insights/v1/SettingTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/SettingTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SettingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Setting.fetcher().fetch(); + Setting.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Setting.fetcher().fetch()); + assertNotNull(Setting.fetcher().fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Setting.updater().update(); + Setting.updater().update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Setting.updater().update(); + Setting.updater().update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/call/CallSummaryTest.java b/src/test/java/com/twilio/rest/insights/v1/call/CallSummaryTest.java index 46fdee241b..d9818d1f20 100644 --- a/src/test/java/com/twilio/rest/insights/v1/call/CallSummaryTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/call/CallSummaryTest.java @@ -31,9 +31,11 @@ public class CallSummaryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - CallSummary.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CallSummary.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CallSummary.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CallSummary.fetcher("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/call/EventTest.java b/src/test/java/com/twilio/rest/insights/v1/call/EventTest.java index 57751ebd7c..12fd40500c 100644 --- a/src/test/java/com/twilio/rest/insights/v1/call/EventTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/call/EventTest.java @@ -31,9 +31,11 @@ public class EventTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadDeepResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Event.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/call/MetricTest.java b/src/test/java/com/twilio/rest/insights/v1/call/MetricTest.java index 7a81d6fdb7..9000ab145b 100644 --- a/src/test/java/com/twilio/rest/insights/v1/call/MetricTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/call/MetricTest.java @@ -31,9 +31,11 @@ public class MetricTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Metric.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Metric.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(Metric.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Metric.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Metric.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Metric.reader("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/conference/ConferenceParticipantTest.java b/src/test/java/com/twilio/rest/insights/v1/conference/ConferenceParticipantTest.java index 7ef2bf42cc..44b9f75d36 100644 --- a/src/test/java/com/twilio/rest/insights/v1/conference/ConferenceParticipantTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/conference/ConferenceParticipantTest.java @@ -31,9 +31,11 @@ public class ConferenceParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - ConferenceParticipant.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ConferenceParticipant.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConferenceParticipant.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ConferenceParticipant.fetcher("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - ConferenceParticipant.reader("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ConferenceParticipant.reader("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConferenceParticipant.reader("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ConferenceParticipant.reader("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadWithLabelResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConferenceParticipant.reader("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ConferenceParticipant.reader("CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/insights/v1/room/ParticipantTest.java b/src/test/java/com/twilio/rest/insights/v1/room/ParticipantTest.java index 06cde12821..411d524dc3 100644 --- a/src/test/java/com/twilio/rest/insights/v1/room/ParticipantTest.java +++ b/src/test/java/com/twilio/rest/insights/v1/room/ParticipantTest.java @@ -31,9 +31,11 @@ public class ParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/CredentialTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/CredentialTest.java index 34ccd81e73..4eaacefa08 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/CredentialTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Credential.reader().read(); + Credential.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/ServiceTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/ServiceTest.java index 75058ec5f7..400b10717f 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/ChannelTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/ChannelTest.java index ee4f1a50f4..903418c5ba 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/ChannelTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/ChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/RoleTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/RoleTest.java index e1e774a259..a0f08c8a13 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/RoleTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/RoleTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class RoleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testFetchRequest() { }}; try { - Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +82,7 @@ public void testDeleteRequest() { }}; try { - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +96,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -117,7 +116,7 @@ public void testCreateRequest() { }}; try { - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); } @Test @@ -149,7 +148,7 @@ public void testReadRequest() { }}; try { - Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -175,7 +174,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -193,7 +192,7 @@ public void testUpdateRequest() { }}; try { - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +206,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/UserTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/UserTest.java index a609f87eb1..672a3c453d 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/UserTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/InviteTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/InviteTest.java index 08826c14e5..bde4989e49 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/InviteTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/InviteTest.java @@ -31,9 +31,11 @@ public class InviteTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +143,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MemberTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MemberTest.java index 4afc42b31a..1afed42816 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MemberTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MemberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MemberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +157,7 @@ public void testDeleteRequest() { }}; try { - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,7 +203,7 @@ public void testUpdateRoleSidResponse() { result = new ObjectMapper(); }}; - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -217,6 +215,6 @@ public void testUpdateLastConsumedMessageIndexResponse() { result = new ObjectMapper(); }}; - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MessageTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MessageTest.java index cbc0a5c9be..5f412218a9 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MessageTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/channel/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); } @Test @@ -109,7 +107,7 @@ public void testCreateWithAttributesResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); } @Test @@ -127,7 +125,7 @@ public void testReadRequest() { }}; try { - Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -153,7 +151,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -171,7 +169,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -185,7 +183,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -203,7 +201,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -217,6 +215,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v1/service/user/UserChannelTest.java b/src/test/java/com/twilio/rest/ipmessaging/v1/service/user/UserChannelTest.java index f2ac09e867..069c6b789c 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v1/service/user/UserChannelTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v1/service/user/UserChannelTest.java @@ -31,9 +31,11 @@ public class UserChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/CredentialTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/CredentialTest.java index 201ed3134e..d23150d971 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/CredentialTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Credential.reader().read(); + Credential.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/ServiceTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/ServiceTest.java index c1a9dc9f6b..9e547b5fb5 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/ServiceTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/BindingTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/BindingTest.java index dc74cf0f1d..1a700e621d 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/BindingTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/BindingTest.java @@ -31,9 +31,11 @@ public class BindingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/ChannelTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/ChannelTest.java index eb00c19e44..7e8af7692e 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/ChannelTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/ChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Channel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(); + Channel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(); + Channel.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Channel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(); + Channel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Channel.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/RoleTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/RoleTest.java index b463b11fd4..8c37bb51ca 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/RoleTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/RoleTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class RoleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testFetchRequest() { }}; try { - Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Role.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +82,7 @@ public void testDeleteRequest() { }}; try { - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +96,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Role.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -117,7 +116,7 @@ public void testCreateRequest() { }}; try { - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(); + Role.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Role.RoleType.CHANNEL, Promoter.listOfOne("permission")).create(tw); } @Test @@ -149,7 +148,7 @@ public void testReadRequest() { }}; try { - Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -175,7 +174,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Role.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -193,7 +192,7 @@ public void testUpdateRequest() { }}; try { - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +206,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(); + Role.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("permission")).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/UserTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/UserTest.java index 154e1204f4..65775a88d6 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/UserTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/UserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(User.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + User.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(); + User.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).create(tw); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(User.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(); + User.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(User.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/InviteTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/InviteTest.java index 7ad3ccb532..de3ff733db 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/InviteTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/InviteTest.java @@ -31,9 +31,11 @@ public class InviteTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Invite.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Invite.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +143,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Invite.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Invite.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MemberTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MemberTest.java index 31ee2cf2fe..e6ac9bbd0d 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MemberTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MemberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MemberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Member.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -84,7 +82,7 @@ public void testCreateRequest() { }}; try { - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(); + Member.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).create(tw); } @Test @@ -116,7 +114,7 @@ public void testReadRequest() { }}; try { - Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -142,7 +140,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Member.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -160,7 +158,7 @@ public void testDeleteRequest() { }}; try { - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(); + Member.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateRoleSidResponse() { result = new ObjectMapper(); }}; - Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(); + Member.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Member.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MessageTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MessageTest.java index 304bb796c7..fe65218f5d 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MessageTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/MessageTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +75,7 @@ public void testFetchMediaResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Message.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -121,7 +119,7 @@ public void testCreateWithAllResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -133,7 +131,7 @@ public void testCreateMediaResponse() { result = new ObjectMapper(); }}; - Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(); + Message.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).create(tw); } @Test @@ -151,7 +149,7 @@ public void testReadRequest() { }}; try { - Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -165,7 +163,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -177,7 +175,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Message.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -195,7 +193,7 @@ public void testDeleteRequest() { }}; try { - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -209,7 +207,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(); + Message.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).delete(tw); } @Test @@ -227,7 +225,7 @@ public void testUpdateRequest() { }}; try { - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -241,6 +239,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(); + Message.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "IMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setXTwilioWebhookEnabled(Message.WebhookEnabledType.TRUE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/WebhookTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/WebhookTest.java index 4bcf1351ed..a0cb867210 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/WebhookTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/channel/WebhookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(); + Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(); + Webhook.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Webhook.Type.WEBHOOK).create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserBindingTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserBindingTest.java index 512878e968..9eb5b6ecaf 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserBindingTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserBindingTest.java @@ -31,9 +31,11 @@ public class UserBindingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserBinding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UserBinding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserBinding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserChannelTest.java b/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserChannelTest.java index a6a85ac090..91088f0453 100644 --- a/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserChannelTest.java +++ b/src/test/java/com/twilio/rest/ipmessaging/v2/service/user/UserChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class UserChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UserChannel.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UserChannel.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testDeleteRequest() { }}; try { - UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UserChannel.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateNotificationLevelResponse() { result = new ObjectMapper(); }}; - UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -185,6 +183,6 @@ public void testUpdateLastConsumedMessageIndexResponse() { result = new ObjectMapper(); }}; - UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + UserChannel.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "USXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/lookups/v1/PhoneNumberTest.java b/src/test/java/com/twilio/rest/lookups/v1/PhoneNumberTest.java index c34b5c3dd2..2443029020 100644 --- a/src/test/java/com/twilio/rest/lookups/v1/PhoneNumberTest.java +++ b/src/test/java/com/twilio/rest/lookups/v1/PhoneNumberTest.java @@ -31,9 +31,11 @@ public class PhoneNumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(); + PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -77,7 +79,7 @@ public void testFetchCarrierResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -89,7 +91,7 @@ public void testFetchCarrierInternationalResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -101,7 +103,7 @@ public void testFetchCallerNameResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -113,7 +115,7 @@ public void testFetchCarrierAndCallerNameResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -125,7 +127,7 @@ public void testFetchAddonsWhitepagesProResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -137,7 +139,7 @@ public void testFetchAddonsNomoroboResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -149,6 +151,6 @@ public void testFetchAddonsPayfoneResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(PhoneNumber.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/media/v1/MediaProcessorTest.java b/src/test/java/com/twilio/rest/media/v1/MediaProcessorTest.java index f70b7c94e5..7336a35f52 100644 --- a/src/test/java/com/twilio/rest/media/v1/MediaProcessorTest.java +++ b/src/test/java/com/twilio/rest/media/v1/MediaProcessorTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MediaProcessorTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - MediaProcessor.creator("extension", "extension_context").create(); + MediaProcessor.creator("extension", "extension_context").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - MediaProcessor.creator("extension", "extension_context").create(); + MediaProcessor.creator("extension", "extension_context").create(tw); } @Test @@ -84,7 +82,7 @@ public void testFetchRequest() { }}; try { - MediaProcessor.fetcher("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + MediaProcessor.fetcher("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(MediaProcessor.fetcher("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(MediaProcessor.fetcher("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +114,7 @@ public void testUpdateRequest() { }}; try { - MediaProcessor.updater("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", MediaProcessor.UpdateStatus.ENDED).update(); + MediaProcessor.updater("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", MediaProcessor.UpdateStatus.ENDED).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testUpdateEndedResponse() { result = new ObjectMapper(); }}; - MediaProcessor.updater("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", MediaProcessor.UpdateStatus.ENDED).update(); + MediaProcessor.updater("ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", MediaProcessor.UpdateStatus.ENDED).update(tw); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - MediaProcessor.reader().read(); + MediaProcessor.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(MediaProcessor.reader().read()); + assertNotNull(MediaProcessor.reader().read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadItemsResponse() { result = new ObjectMapper(); }}; - assertNotNull(MediaProcessor.reader().read()); + assertNotNull(MediaProcessor.reader().read(tw)); } @Test @@ -186,7 +184,7 @@ public void testReadItemsUsingPageTokenResponse() { result = new ObjectMapper(); }}; - assertNotNull(MediaProcessor.reader().read()); + assertNotNull(MediaProcessor.reader().read(tw)); } @Test @@ -198,6 +196,6 @@ public void testReadItemsPageLargerThanMaxResponse() { result = new ObjectMapper(); }}; - assertNotNull(MediaProcessor.reader().read()); + assertNotNull(MediaProcessor.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/media/v1/PlayerStreamerTest.java b/src/test/java/com/twilio/rest/media/v1/PlayerStreamerTest.java index 96f8fdf05d..c6e9891cfc 100644 --- a/src/test/java/com/twilio/rest/media/v1/PlayerStreamerTest.java +++ b/src/test/java/com/twilio/rest/media/v1/PlayerStreamerTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class PlayerStreamerTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - PlayerStreamer.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PlayerStreamer.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PlayerStreamer.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PlayerStreamer.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - PlayerStreamer.creator().create(); + PlayerStreamer.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - PlayerStreamer.creator().create(); + PlayerStreamer.creator().create(tw); } @Test @@ -115,7 +113,7 @@ public void testUpdateRequest() { }}; try { - PlayerStreamer.updater("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", PlayerStreamer.UpdateStatus.ENDED).update(); + PlayerStreamer.updater("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", PlayerStreamer.UpdateStatus.ENDED).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - PlayerStreamer.updater("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", PlayerStreamer.UpdateStatus.ENDED).update(); + PlayerStreamer.updater("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", PlayerStreamer.UpdateStatus.ENDED).update(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - PlayerStreamer.reader().read(); + PlayerStreamer.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(PlayerStreamer.reader().read()); + assertNotNull(PlayerStreamer.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadItemsResponse() { result = new ObjectMapper(); }}; - assertNotNull(PlayerStreamer.reader().read()); + assertNotNull(PlayerStreamer.reader().read(tw)); } @Test @@ -185,6 +183,6 @@ public void testReadItemsPageLargerThanMaxResponse() { result = new ObjectMapper(); }}; - assertNotNull(PlayerStreamer.reader().read()); + assertNotNull(PlayerStreamer.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/media/v1/playerstreamer/PlaybackGrantTest.java b/src/test/java/com/twilio/rest/media/v1/playerstreamer/PlaybackGrantTest.java index 1c5c98eb94..eee13c4b3b 100644 --- a/src/test/java/com/twilio/rest/media/v1/playerstreamer/PlaybackGrantTest.java +++ b/src/test/java/com/twilio/rest/media/v1/playerstreamer/PlaybackGrantTest.java @@ -31,9 +31,11 @@ public class PlaybackGrantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - PlaybackGrant.creator("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PlaybackGrant.creator("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - PlaybackGrant.creator("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PlaybackGrant.creator("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - PlaybackGrant.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PlaybackGrant.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PlaybackGrant.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PlaybackGrant.fetcher("VJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/BrandRegistrationTest.java b/src/test/java/com/twilio/rest/messaging/v1/BrandRegistrationTest.java index 900c96411d..42a0e77a22 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/BrandRegistrationTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/BrandRegistrationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class BrandRegistrationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - BrandRegistration.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + BrandRegistration.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(BrandRegistration.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(BrandRegistration.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - BrandRegistration.reader().read(); + BrandRegistration.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(BrandRegistration.reader().read()); + assertNotNull(BrandRegistration.reader().read(tw)); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - BrandRegistration.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + BrandRegistration.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - BrandRegistration.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + BrandRegistration.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -148,7 +146,7 @@ public void testUpdateRequest() { }}; try { - BrandRegistration.updater("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + BrandRegistration.updater("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,6 +160,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - BrandRegistration.updater("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + BrandRegistration.updater("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/DeactivationsTest.java b/src/test/java/com/twilio/rest/messaging/v1/DeactivationsTest.java index df9aba94a1..697cc74f10 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/DeactivationsTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/DeactivationsTest.java @@ -31,9 +31,11 @@ public class DeactivationsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Deactivations.fetcher().fetch(); + Deactivations.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Deactivations.fetcher().fetch()); + assertNotNull(Deactivations.fetcher().fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/ExternalCampaignTest.java b/src/test/java/com/twilio/rest/messaging/v1/ExternalCampaignTest.java index 0402ea5838..87d5f57536 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/ExternalCampaignTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/ExternalCampaignTest.java @@ -31,9 +31,11 @@ public class ExternalCampaignTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - ExternalCampaign.creator("campaign_id", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ExternalCampaign.creator("campaign_id", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,6 +68,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ExternalCampaign.creator("campaign_id", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ExternalCampaign.creator("campaign_id", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/ServiceTest.java b/src/test/java/com/twilio/rest/messaging/v1/ServiceTest.java index 5c482b1dc7..25629d06b0 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -147,7 +145,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -179,7 +177,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/UsecaseTest.java b/src/test/java/com/twilio/rest/messaging/v1/UsecaseTest.java index 129ea1a857..47553702d7 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/UsecaseTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/UsecaseTest.java @@ -31,9 +31,11 @@ public class UsecaseTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Usecase.fetcher().fetch(); + Usecase.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Usecase.fetcher().fetch()); + assertNotNull(Usecase.fetcher().fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/brandregistration/BrandVettingTest.java b/src/test/java/com/twilio/rest/messaging/v1/brandregistration/BrandVettingTest.java index dd3458c59a..590b46c2eb 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/brandregistration/BrandVettingTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/brandregistration/BrandVettingTest.java @@ -31,9 +31,11 @@ public class BrandVettingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - BrandVetting.creator("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", BrandVetting.VettingProvider.CAMPAIGN_VERIFY).create(); + BrandVetting.creator("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", BrandVetting.VettingProvider.CAMPAIGN_VERIFY).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - BrandVetting.creator("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", BrandVetting.VettingProvider.CAMPAIGN_VERIFY).create(); + BrandVetting.creator("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", BrandVetting.VettingProvider.CAMPAIGN_VERIFY).create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - BrandVetting.reader("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + BrandVetting.reader("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(BrandVetting.reader("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(BrandVetting.reader("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -115,7 +117,7 @@ public void testFetchRequest() { }}; try { - BrandVetting.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "VTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + BrandVetting.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "VTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +131,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(BrandVetting.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "VTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(BrandVetting.fetcher("BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "VTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/service/AlphaSenderTest.java b/src/test/java/com/twilio/rest/messaging/v1/service/AlphaSenderTest.java index aafa35671d..0ddbf2cb3a 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/service/AlphaSenderTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/service/AlphaSenderTest.java @@ -31,9 +31,11 @@ public class AlphaSenderTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - AlphaSender.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "alpha_sender").create(); + AlphaSender.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "alpha_sender").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AlphaSender.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "alpha_sender").create(); + AlphaSender.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "alpha_sender").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AlphaSender.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AlphaSender.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AlphaSender.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AlphaSender.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -115,7 +117,7 @@ public void testFetchRequest() { }}; try { - AlphaSender.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AlphaSender.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AlphaSender.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AlphaSender.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +149,7 @@ public void testDeleteRequest() { }}; try { - AlphaSender.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AlphaSender.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,6 +163,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - AlphaSender.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + AlphaSender.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "AIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/service/PhoneNumberTest.java b/src/test/java/com/twilio/rest/messaging/v1/service/PhoneNumberTest.java index a0de0fcc3d..993280fb6b 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/service/PhoneNumberTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/service/PhoneNumberTest.java @@ -31,9 +31,11 @@ public class PhoneNumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - PhoneNumber.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - PhoneNumber.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -77,7 +79,7 @@ public void testCreateWithCapabilitiesResponse() { result = new ObjectMapper(); }}; - PhoneNumber.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -95,7 +97,7 @@ public void testDeleteRequest() { }}; try { - PhoneNumber.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PhoneNumber.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - PhoneNumber.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PhoneNumber.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -127,7 +129,7 @@ public void testReadRequest() { }}; try { - PhoneNumber.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + PhoneNumber.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(PhoneNumber.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +161,7 @@ public void testFetchRequest() { }}; try { - PhoneNumber.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PhoneNumber.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PhoneNumber.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/service/ShortCodeTest.java b/src/test/java/com/twilio/rest/messaging/v1/service/ShortCodeTest.java index 90dc15cd32..92185c79ac 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/service/ShortCodeTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/service/ShortCodeTest.java @@ -31,9 +31,11 @@ public class ShortCodeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - ShortCode.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ShortCode.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ShortCode.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ShortCode.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - ShortCode.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ShortCode.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ShortCode.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ShortCode.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - ShortCode.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ShortCode.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ShortCode.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -147,7 +149,7 @@ public void testFetchRequest() { }}; try { - ShortCode.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ShortCode.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,6 +163,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ShortCode.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonTest.java b/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonTest.java index 6e1a3f4def..41164b76c7 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonTest.java @@ -31,9 +31,11 @@ public class UsAppToPersonTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -56,7 +58,7 @@ public void testCreateRequest() { }}; try { - UsAppToPerson.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description", Promoter.listOfOne("message_samples"), "us_app_to_person_usecase", true, true).create(); + UsAppToPerson.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description", Promoter.listOfOne("message_samples"), "us_app_to_person_usecase", true, true).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -70,7 +72,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - UsAppToPerson.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description", Promoter.listOfOne("message_samples"), "us_app_to_person_usecase", true, true).create(); + UsAppToPerson.creator("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "description", Promoter.listOfOne("message_samples"), "us_app_to_person_usecase", true, true).create(tw); } @Test @@ -88,7 +90,7 @@ public void testDeleteRequest() { }}; try { - UsAppToPerson.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UsAppToPerson.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -102,7 +104,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - UsAppToPerson.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + UsAppToPerson.deleter("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -120,7 +122,7 @@ public void testReadRequest() { }}; try { - UsAppToPerson.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UsAppToPerson.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -134,7 +136,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsAppToPerson.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UsAppToPerson.reader("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -152,7 +154,7 @@ public void testFetchRequest() { }}; try { - UsAppToPerson.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UsAppToPerson.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -166,6 +168,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsAppToPerson.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UsAppToPerson.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "QEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonUsecaseTest.java b/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonUsecaseTest.java index d38f5c9f68..3f9bd31c32 100644 --- a/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonUsecaseTest.java +++ b/src/test/java/com/twilio/rest/messaging/v1/service/UsAppToPersonUsecaseTest.java @@ -31,9 +31,11 @@ public class UsAppToPersonUsecaseTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - UsAppToPersonUsecase.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + UsAppToPersonUsecase.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchWithBrandRegistrationSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsAppToPersonUsecase.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UsAppToPersonUsecase.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,6 +79,6 @@ public void testFetchWithoutBrandRegistrationSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsAppToPersonUsecase.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(UsAppToPersonUsecase.fetcher("MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/monitor/v1/AlertTest.java b/src/test/java/com/twilio/rest/monitor/v1/AlertTest.java index 25962183ef..369f087754 100644 --- a/src/test/java/com/twilio/rest/monitor/v1/AlertTest.java +++ b/src/test/java/com/twilio/rest/monitor/v1/AlertTest.java @@ -31,9 +31,11 @@ public class AlertTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Alert.fetcher("NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Alert.fetcher("NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Alert.fetcher("NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Alert.fetcher("NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Alert.reader().read(); + Alert.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Alert.reader().read()); + assertNotNull(Alert.reader().read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Alert.reader().read()); + assertNotNull(Alert.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/monitor/v1/EventTest.java b/src/test/java/com/twilio/rest/monitor/v1/EventTest.java index 49f02bb4da..0e98fc4667 100644 --- a/src/test/java/com/twilio/rest/monitor/v1/EventTest.java +++ b/src/test/java/com/twilio/rest/monitor/v1/EventTest.java @@ -31,9 +31,11 @@ public class EventTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Event.fetcher("AEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Event.fetcher("AEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.fetcher("AEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Event.fetcher("AEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Event.reader().read(); + Event.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader().read()); + assertNotNull(Event.reader().read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader().read()); + assertNotNull(Event.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/notify/v1/CredentialTest.java b/src/test/java/com/twilio/rest/notify/v1/CredentialTest.java index 958cb385c6..4fc709d1cb 100644 --- a/src/test/java/com/twilio/rest/notify/v1/CredentialTest.java +++ b/src/test/java/com/twilio/rest/notify/v1/CredentialTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CredentialTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Credential.reader().read(); + Credential.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.reader().read()); + assertNotNull(Credential.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Credential.creator(Credential.PushService.GCM).create(); + Credential.creator(Credential.PushService.GCM).create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Credential.fetcher("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Credential.updater("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/notify/v1/ServiceTest.java b/src/test/java/com/twilio/rest/notify/v1/ServiceTest.java index 5735b2d989..e6347c3632 100644 --- a/src/test/java/com/twilio/rest/notify/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/notify/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Service.creator().create(); + Service.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator().create(); + Service.creator().create(tw); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/notify/v1/service/BindingTest.java b/src/test/java/com/twilio/rest/notify/v1/service/BindingTest.java index 30836092c4..6f973ecd93 100644 --- a/src/test/java/com/twilio/rest/notify/v1/service/BindingTest.java +++ b/src/test/java/com/twilio/rest/notify/v1/service/BindingTest.java @@ -31,9 +31,11 @@ public class BindingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Binding.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Binding.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -117,7 +119,7 @@ public void testCreateRequest() { }}; try { - Binding.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", Binding.BindingType.APN, "address").create(); + Binding.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", Binding.BindingType.APN, "address").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +133,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Binding.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", Binding.BindingType.APN, "address").create(); + Binding.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", Binding.BindingType.APN, "address").create(tw); } @Test @@ -149,7 +151,7 @@ public void testReadRequest() { }}; try { - Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +165,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -175,6 +177,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Binding.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/notify/v1/service/NotificationTest.java b/src/test/java/com/twilio/rest/notify/v1/service/NotificationTest.java index 6f5a3352b7..78492b2c7d 100644 --- a/src/test/java/com/twilio/rest/notify/v1/service/NotificationTest.java +++ b/src/test/java/com/twilio/rest/notify/v1/service/NotificationTest.java @@ -31,9 +31,11 @@ public class NotificationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Notification.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Notification.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Notification.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Notification.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -77,6 +79,6 @@ public void testCreateDirectNotificationResponse() { result = new ObjectMapper(); }}; - Notification.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Notification.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/BundleTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/BundleTest.java index 4412bbd308..3e4df69da8 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/BundleTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/BundleTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class BundleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - Bundle.creator("friendly_name", "email").create(); + Bundle.creator("friendly_name", "email").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Bundle.creator("friendly_name", "email").create(); + Bundle.creator("friendly_name", "email").create(tw); } @Test @@ -84,7 +82,7 @@ public void testReadRequest() { }}; try { - Bundle.reader().read(); + Bundle.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bundle.reader().read()); + assertNotNull(Bundle.reader().read(tw)); } @Test @@ -110,7 +108,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bundle.reader().read()); + assertNotNull(Bundle.reader().read(tw)); } @Test @@ -122,7 +120,7 @@ public void testReadApprovedAuMobileWithDateResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bundle.reader().read()); + assertNotNull(Bundle.reader().read(tw)); } @Test @@ -134,7 +132,7 @@ public void testReadApprovedAuMobileDateLessResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bundle.reader().read()); + assertNotNull(Bundle.reader().read(tw)); } @Test @@ -146,7 +144,7 @@ public void testReadApprovedJapanTollfreeDateBetweenResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bundle.reader().read()); + assertNotNull(Bundle.reader().read(tw)); } @Test @@ -164,7 +162,7 @@ public void testFetchRequest() { }}; try { - Bundle.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Bundle.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -178,7 +176,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bundle.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Bundle.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -196,7 +194,7 @@ public void testUpdateRequest() { }}; try { - Bundle.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Bundle.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -210,7 +208,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Bundle.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Bundle.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -228,7 +226,7 @@ public void testDeleteRequest() { }}; try { - Bundle.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Bundle.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -242,6 +240,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Bundle.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Bundle.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTest.java index bd59966588..fe85ce807b 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class EndUserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - EndUser.creator("friendly_name", EndUser.Type.INDIVIDUAL).create(); + EndUser.creator("friendly_name", EndUser.Type.INDIVIDUAL).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - EndUser.creator("friendly_name", EndUser.Type.INDIVIDUAL).create(); + EndUser.creator("friendly_name", EndUser.Type.INDIVIDUAL).create(tw); } @Test @@ -84,7 +82,7 @@ public void testReadRequest() { }}; try { - EndUser.reader().read(); + EndUser.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUser.reader().read()); + assertNotNull(EndUser.reader().read(tw)); } @Test @@ -110,7 +108,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUser.reader().read()); + assertNotNull(EndUser.reader().read(tw)); } @Test @@ -128,7 +126,7 @@ public void testFetchRequest() { }}; try { - EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTypeTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTypeTest.java index 6e3e298e80..284e2bb4db 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTypeTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/EndUserTypeTest.java @@ -31,9 +31,11 @@ public class EndUserTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - EndUserType.reader().read(); + EndUserType.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUserType.reader().read()); + assertNotNull(EndUserType.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUserType.reader().read()); + assertNotNull(EndUserType.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/RegulationTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/RegulationTest.java index 0e991c63b9..ea8437c125 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/RegulationTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/RegulationTest.java @@ -31,9 +31,11 @@ public class RegulationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Regulation.reader().read(); + Regulation.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Regulation.reader().read()); + assertNotNull(Regulation.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Regulation.reader().read()); + assertNotNull(Regulation.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Regulation.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Regulation.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Regulation.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Regulation.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTest.java index 2527804b9e..0400a2a15c 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SupportingDocumentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - SupportingDocument.creator("friendly_name", "type").create(); + SupportingDocument.creator("friendly_name", "type").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SupportingDocument.creator("friendly_name", "type").create(); + SupportingDocument.creator("friendly_name", "type").create(tw); } @Test @@ -84,7 +82,7 @@ public void testReadRequest() { }}; try { - SupportingDocument.reader().read(); + SupportingDocument.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocument.reader().read()); + assertNotNull(SupportingDocument.reader().read(tw)); } @Test @@ -110,7 +108,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocument.reader().read()); + assertNotNull(SupportingDocument.reader().read(tw)); } @Test @@ -128,7 +126,7 @@ public void testFetchRequest() { }}; try { - SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTypeTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTypeTest.java index 94a0829585..501e1bc873 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTypeTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/SupportingDocumentTypeTest.java @@ -31,9 +31,11 @@ public class SupportingDocumentTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - SupportingDocumentType.reader().read(); + SupportingDocumentType.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocumentType.reader().read()); + assertNotNull(SupportingDocumentType.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocumentType.reader().read()); + assertNotNull(SupportingDocumentType.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/BundleCopyTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/BundleCopyTest.java index e6e04eb8f7..6ea95ea02a 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/BundleCopyTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/BundleCopyTest.java @@ -31,9 +31,11 @@ public class BundleCopyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - BundleCopy.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + BundleCopy.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - BundleCopy.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + BundleCopy.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - BundleCopy.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + BundleCopy.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(BundleCopy.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(BundleCopy.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(BundleCopy.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(BundleCopy.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/EvaluationTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/EvaluationTest.java index 8f2d78c208..ab6a221625 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/EvaluationTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/EvaluationTest.java @@ -31,9 +31,11 @@ public class EvaluationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Evaluation.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Evaluation.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Evaluation.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Evaluation.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Evaluation.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Evaluation.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Evaluation.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Evaluation.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Evaluation.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Evaluation.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - Evaluation.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Evaluation.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Evaluation.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Evaluation.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ItemAssignmentTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ItemAssignmentTest.java index 30522113f7..264d035c16 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ItemAssignmentTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ItemAssignmentTest.java @@ -31,9 +31,11 @@ public class ItemAssignmentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - ItemAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ItemAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ItemAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ItemAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - ItemAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ItemAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ItemAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ItemAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ItemAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ItemAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - ItemAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ItemAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ItemAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ItemAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - ItemAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ItemAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ItemAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ItemAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ReplaceItemsTest.java b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ReplaceItemsTest.java index 51dd142093..6abffddb97 100644 --- a/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ReplaceItemsTest.java +++ b/src/test/java/com/twilio/rest/numbers/v2/regulatorycompliance/bundle/ReplaceItemsTest.java @@ -31,9 +31,11 @@ public class ReplaceItemsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - ReplaceItems.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ReplaceItems.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ReplaceItems.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ReplaceItems.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/bulkExports/ExportConfigurationTest.java b/src/test/java/com/twilio/rest/preview/bulkExports/ExportConfigurationTest.java index 0bf1f9c734..7ddd845d8a 100644 --- a/src/test/java/com/twilio/rest/preview/bulkExports/ExportConfigurationTest.java +++ b/src/test/java/com/twilio/rest/preview/bulkExports/ExportConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ExportConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - ExportConfiguration.fetcher("resource_type").fetch(); + ExportConfiguration.fetcher("resource_type").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExportConfiguration.fetcher("resource_type").fetch()); + assertNotNull(ExportConfiguration.fetcher("resource_type").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - ExportConfiguration.updater("resource_type").update(); + ExportConfiguration.updater("resource_type").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ExportConfiguration.updater("resource_type").update(); + ExportConfiguration.updater("resource_type").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/bulkExports/ExportTest.java b/src/test/java/com/twilio/rest/preview/bulkExports/ExportTest.java index 6cc4e762d0..21b07b41dd 100644 --- a/src/test/java/com/twilio/rest/preview/bulkExports/ExportTest.java +++ b/src/test/java/com/twilio/rest/preview/bulkExports/ExportTest.java @@ -31,9 +31,11 @@ public class ExportTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Export.fetcher("resource_type").fetch(); + Export.fetcher("resource_type").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Export.fetcher("resource_type").fetch()); + assertNotNull(Export.fetcher("resource_type").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/bulkExports/export/DayTest.java b/src/test/java/com/twilio/rest/preview/bulkExports/export/DayTest.java index 62aa83d1a4..4696efc96a 100644 --- a/src/test/java/com/twilio/rest/preview/bulkExports/export/DayTest.java +++ b/src/test/java/com/twilio/rest/preview/bulkExports/export/DayTest.java @@ -31,9 +31,11 @@ public class DayTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Day.fetcher("resource_type", "day").fetch(); + Day.fetcher("resource_type", "day").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Day.fetcher("resource_type", "day").fetch()); + assertNotNull(Day.fetcher("resource_type", "day").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Day.reader("resource_type").read(); + Day.reader("resource_type").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Day.reader("resource_type").read()); + assertNotNull(Day.reader("resource_type").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Day.reader("resource_type").read()); + assertNotNull(Day.reader("resource_type").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/bulkExports/export/ExportCustomJobTest.java b/src/test/java/com/twilio/rest/preview/bulkExports/export/ExportCustomJobTest.java index 02bf314ffe..77493b72de 100644 --- a/src/test/java/com/twilio/rest/preview/bulkExports/export/ExportCustomJobTest.java +++ b/src/test/java/com/twilio/rest/preview/bulkExports/export/ExportCustomJobTest.java @@ -31,9 +31,11 @@ public class ExportCustomJobTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ExportCustomJob.reader("resource_type").read(); + ExportCustomJob.reader("resource_type").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExportCustomJob.reader("resource_type").read()); + assertNotNull(ExportCustomJob.reader("resource_type").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExportCustomJob.reader("resource_type").read()); + assertNotNull(ExportCustomJob.reader("resource_type").read(tw)); } @Test @@ -97,7 +99,7 @@ public void testCreateRequest() { }}; try { - ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(); + ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -111,6 +113,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(); + ExportCustomJob.creator("resource_type", "start_day", "end_day", "friendly_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/bulkExports/export/JobTest.java b/src/test/java/com/twilio/rest/preview/bulkExports/export/JobTest.java index 2d8e7f91dd..ac91f77035 100644 --- a/src/test/java/com/twilio/rest/preview/bulkExports/export/JobTest.java +++ b/src/test/java/com/twilio/rest/preview/bulkExports/export/JobTest.java @@ -31,9 +31,11 @@ public class JobTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Job.fetcher("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Job.deleter("JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/deployedDevices/FleetTest.java b/src/test/java/com/twilio/rest/preview/deployedDevices/FleetTest.java index f1842f7c9e..4515be5aa6 100644 --- a/src/test/java/com/twilio/rest/preview/deployedDevices/FleetTest.java +++ b/src/test/java/com/twilio/rest/preview/deployedDevices/FleetTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FleetTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Fleet.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Fleet.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fleet.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Fleet.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Fleet.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Fleet.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Fleet.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Fleet.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Fleet.creator().create(); + Fleet.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Fleet.creator().create(); + Fleet.creator().create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Fleet.reader().read(); + Fleet.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fleet.reader().read()); + assertNotNull(Fleet.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fleet.reader().read()); + assertNotNull(Fleet.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Fleet.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Fleet.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Fleet.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Fleet.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/CertificateTest.java b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/CertificateTest.java index 4ff5ea5954..c86b8e95b0 100644 --- a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/CertificateTest.java +++ b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/CertificateTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CertificateTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Certificate.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Certificate.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Certificate.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Certificate.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Certificate.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Certificate.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Certificate.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Certificate.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Certificate.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "certificate_data").create(); + Certificate.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "certificate_data").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Certificate.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "certificate_data").create(); + Certificate.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "certificate_data").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Certificate.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Certificate.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Certificate.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Certificate.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Certificate.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Certificate.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Certificate.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Certificate.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Certificate.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Certificate.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeploymentTest.java b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeploymentTest.java index d0a471fb72..804ff86427 100644 --- a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeploymentTest.java +++ b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeploymentTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DeploymentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Deployment.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Deployment.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Deployment.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Deployment.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Deployment.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Deployment.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Deployment.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Deployment.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Deployment.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Deployment.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Deployment.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Deployment.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Deployment.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Deployment.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Deployment.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Deployment.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Deployment.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Deployment.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Deployment.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Deployment.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Deployment.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Deployment.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "DLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeviceTest.java b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeviceTest.java index 0ab84610ae..8cc1fd9023 100644 --- a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeviceTest.java +++ b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/DeviceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DeviceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Device.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Device.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Device.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Device.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Device.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Device.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Device.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Device.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Device.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Device.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Device.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Device.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Device.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Device.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Device.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Device.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Device.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Device.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Device.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Device.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Device.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Device.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/KeyTest.java b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/KeyTest.java index 06fd3d9566..d66fc36cb4 100644 --- a/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/KeyTest.java +++ b/src/test/java/com/twilio/rest/preview/deployedDevices/fleet/KeyTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class KeyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Key.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Key.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Key.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Key.fetcher("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Key.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Key.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Key.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Key.deleter("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Key.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Key.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Key.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Key.creator("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Key.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Key.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Key.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Key.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Key.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Key.reader("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Key.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Key.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Key.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Key.updater("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentTest.java b/src/test/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentTest.java index 0b35af4569..214fae8f52 100644 --- a/src/test/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentTest.java +++ b/src/test/java/com/twilio/rest/preview/hostedNumbers/AuthorizationDocumentTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class AuthorizationDocumentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testFetchRequest() { }}; try { - AuthorizationDocument.fetcher("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AuthorizationDocument.fetcher("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthorizationDocument.fetcher("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AuthorizationDocument.fetcher("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +82,7 @@ public void testUpdateRequest() { }}; try { - AuthorizationDocument.updater("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AuthorizationDocument.updater("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +96,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - AuthorizationDocument.updater("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AuthorizationDocument.updater("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +114,7 @@ public void testReadRequest() { }}; try { - AuthorizationDocument.reader().read(); + AuthorizationDocument.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +128,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthorizationDocument.reader().read()); + assertNotNull(AuthorizationDocument.reader().read(tw)); } @Test @@ -141,7 +140,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AuthorizationDocument.reader().read()); + assertNotNull(AuthorizationDocument.reader().read(tw)); } @Test @@ -163,7 +162,7 @@ public void testCreateRequest() { }}; try { - AuthorizationDocument.creator(Promoter.listOfOne("hosted_number_order_sids"), "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "email", "contact_title", "contact_phone_number").create(); + AuthorizationDocument.creator(Promoter.listOfOne("hosted_number_order_sids"), "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "email", "contact_title", "contact_phone_number").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -177,6 +176,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - AuthorizationDocument.creator(Promoter.listOfOne("hosted_number_order_sids"), "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "email", "contact_title", "contact_phone_number").create(); + AuthorizationDocument.creator(Promoter.listOfOne("hosted_number_order_sids"), "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "email", "contact_title", "contact_phone_number").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderTest.java b/src/test/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderTest.java index 55fdaced0e..7aa10bafdb 100644 --- a/src/test/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderTest.java +++ b/src/test/java/com/twilio/rest/preview/hostedNumbers/HostedNumberOrderTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class HostedNumberOrderTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - HostedNumberOrder.fetcher("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + HostedNumberOrder.fetcher("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(HostedNumberOrder.fetcher("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(HostedNumberOrder.fetcher("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - HostedNumberOrder.deleter("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + HostedNumberOrder.deleter("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - HostedNumberOrder.deleter("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + HostedNumberOrder.deleter("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testUpdateRequest() { }}; try { - HostedNumberOrder.updater("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + HostedNumberOrder.updater("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - HostedNumberOrder.updater("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + HostedNumberOrder.updater("HRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - HostedNumberOrder.reader().read(); + HostedNumberOrder.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(HostedNumberOrder.reader().read()); + assertNotNull(HostedNumberOrder.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(HostedNumberOrder.reader().read()); + assertNotNull(HostedNumberOrder.reader().read(tw)); } @Test @@ -192,7 +190,7 @@ public void testCreateRequest() { }}; try { - HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(); + HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,7 +204,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(); + HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(tw); } @Test @@ -218,7 +216,7 @@ public void testCreateWithoutOptionalLoaFieldsResponse() { result = new ObjectMapper(); }}; - HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(); + HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(tw); } @Test @@ -230,6 +228,6 @@ public void testCreateWithPhoneBillVerificationResponse() { result = new ObjectMapper(); }}; - HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(); + HostedNumberOrder.creator(new com.twilio.type.PhoneNumber("+15017122661"), true).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/hostedNumbers/authorizationdocument/DependentHostedNumberOrderTest.java b/src/test/java/com/twilio/rest/preview/hostedNumbers/authorizationdocument/DependentHostedNumberOrderTest.java index c582c9e49c..c876fc7694 100644 --- a/src/test/java/com/twilio/rest/preview/hostedNumbers/authorizationdocument/DependentHostedNumberOrderTest.java +++ b/src/test/java/com/twilio/rest/preview/hostedNumbers/authorizationdocument/DependentHostedNumberOrderTest.java @@ -31,9 +31,11 @@ public class DependentHostedNumberOrderTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - DependentHostedNumberOrder.reader("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DependentHostedNumberOrder.reader("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(DependentHostedNumberOrder.reader("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DependentHostedNumberOrder.reader("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(DependentHostedNumberOrder.reader("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DependentHostedNumberOrder.reader("PXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/marketplace/AvailableAddOnTest.java b/src/test/java/com/twilio/rest/preview/marketplace/AvailableAddOnTest.java index 7857f99c81..a38e403ce5 100644 --- a/src/test/java/com/twilio/rest/preview/marketplace/AvailableAddOnTest.java +++ b/src/test/java/com/twilio/rest/preview/marketplace/AvailableAddOnTest.java @@ -31,9 +31,11 @@ public class AvailableAddOnTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - AvailableAddOn.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AvailableAddOn.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailableAddOn.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AvailableAddOn.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AvailableAddOn.reader().read(); + AvailableAddOn.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailableAddOn.reader().read()); + assertNotNull(AvailableAddOn.reader().read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailableAddOn.reader().read()); + assertNotNull(AvailableAddOn.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/marketplace/InstalledAddOnTest.java b/src/test/java/com/twilio/rest/preview/marketplace/InstalledAddOnTest.java index 8f6bccf337..aeb935e378 100644 --- a/src/test/java/com/twilio/rest/preview/marketplace/InstalledAddOnTest.java +++ b/src/test/java/com/twilio/rest/preview/marketplace/InstalledAddOnTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class InstalledAddOnTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - InstalledAddOn.creator("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).create(); + InstalledAddOn.creator("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - InstalledAddOn.creator("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).create(); + InstalledAddOn.creator("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).create(tw); } @Test @@ -84,7 +82,7 @@ public void testDeleteRequest() { }}; try { - InstalledAddOn.deleter("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + InstalledAddOn.deleter("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - InstalledAddOn.deleter("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + InstalledAddOn.deleter("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -116,7 +114,7 @@ public void testFetchRequest() { }}; try { - InstalledAddOn.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + InstalledAddOn.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(InstalledAddOn.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(InstalledAddOn.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -148,7 +146,7 @@ public void testUpdateRequest() { }}; try { - InstalledAddOn.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + InstalledAddOn.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - InstalledAddOn.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + InstalledAddOn.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -180,7 +178,7 @@ public void testReadRequest() { }}; try { - InstalledAddOn.reader().read(); + InstalledAddOn.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,7 +192,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(InstalledAddOn.reader().read()); + assertNotNull(InstalledAddOn.reader().read(tw)); } @Test @@ -206,6 +204,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(InstalledAddOn.reader().read()); + assertNotNull(InstalledAddOn.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/marketplace/availableaddon/AvailableAddOnExtensionTest.java b/src/test/java/com/twilio/rest/preview/marketplace/availableaddon/AvailableAddOnExtensionTest.java index 69bceb0496..e81102e4da 100644 --- a/src/test/java/com/twilio/rest/preview/marketplace/availableaddon/AvailableAddOnExtensionTest.java +++ b/src/test/java/com/twilio/rest/preview/marketplace/availableaddon/AvailableAddOnExtensionTest.java @@ -31,9 +31,11 @@ public class AvailableAddOnExtensionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - AvailableAddOnExtension.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AvailableAddOnExtension.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailableAddOnExtension.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AvailableAddOnExtension.fetcher("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - AvailableAddOnExtension.reader("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AvailableAddOnExtension.reader("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailableAddOnExtension.reader("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AvailableAddOnExtension.reader("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AvailableAddOnExtension.reader("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AvailableAddOnExtension.reader("XBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/marketplace/installedaddon/InstalledAddOnExtensionTest.java b/src/test/java/com/twilio/rest/preview/marketplace/installedaddon/InstalledAddOnExtensionTest.java index fa67e059f8..57678a6304 100644 --- a/src/test/java/com/twilio/rest/preview/marketplace/installedaddon/InstalledAddOnExtensionTest.java +++ b/src/test/java/com/twilio/rest/preview/marketplace/installedaddon/InstalledAddOnExtensionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class InstalledAddOnExtensionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - InstalledAddOnExtension.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + InstalledAddOnExtension.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(InstalledAddOnExtension.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(InstalledAddOnExtension.fetcher("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - InstalledAddOnExtension.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).update(); + InstalledAddOnExtension.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - InstalledAddOnExtension.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).update(); + InstalledAddOnExtension.updater("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "XFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", true).update(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - InstalledAddOnExtension.reader("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + InstalledAddOnExtension.reader("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(InstalledAddOnExtension.reader("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(InstalledAddOnExtension.reader("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,6 +139,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(InstalledAddOnExtension.reader("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(InstalledAddOnExtension.reader("XEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/ServiceTest.java b/src/test/java/com/twilio/rest/preview/sync/ServiceTest.java index 36f318fe52..6acc5d7056 100644 --- a/src/test/java/com/twilio/rest/preview/sync/ServiceTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator().create(); + Service.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator().create(); + Service.creator().create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/DocumentTest.java b/src/test/java/com/twilio/rest/preview/sync/service/DocumentTest.java index 87193d2919..4ca34bd88f 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/DocumentTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/DocumentTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DocumentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).setIfMatch("if_match").update(); + Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).setIfMatch("if_match").update(); + Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/SyncListTest.java b/src/test/java/com/twilio/rest/preview/sync/service/SyncListTest.java index f71a691c74..e3ca1570f5 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/SyncListTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/SyncListTest.java @@ -31,9 +31,11 @@ public class SyncListTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +163,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +175,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/SyncMapTest.java b/src/test/java/com/twilio/rest/preview/sync/service/SyncMapTest.java index 787009167d..a3ce8a900f 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/SyncMapTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/SyncMapTest.java @@ -31,9 +31,11 @@ public class SyncMapTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +163,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +175,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/document/DocumentPermissionTest.java b/src/test/java/com/twilio/rest/preview/sync/service/document/DocumentPermissionTest.java index 0a841a0f84..1c1edb205a 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/document/DocumentPermissionTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/document/DocumentPermissionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DocumentPermissionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,6 +173,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListItemTest.java b/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListItemTest.java index 2433a4ad9d..c7ff4b6c18 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListItemTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListItemTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncListItemTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch(); + SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch()); + assertNotNull(SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(); + SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(); + SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(); + SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(); + SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, new java.util.HashMap()).setIfMatch("if_match").update(); + SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, new java.util.HashMap()).setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, new java.util.HashMap()).setIfMatch("if_match").update(); + SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, new java.util.HashMap()).setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListPermissionTest.java b/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListPermissionTest.java index 7c784821da..728667e6b2 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListPermissionTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/synclist/SyncListPermissionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncListPermissionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,6 +173,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapItemTest.java b/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapItemTest.java index 999ea78d60..3bd0ee85f8 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapItemTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapItemTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncMapItemTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch(); + SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch()); + assertNotNull(SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(); + SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(); + SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(tw); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(); + SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(); + SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(tw); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -193,7 +191,7 @@ public void testUpdateRequest() { }}; try { - SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).setIfMatch("if_match").update(); + SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +205,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).setIfMatch("if_match").update(); + SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapPermissionTest.java b/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapPermissionTest.java index 66ba2e1bcb..1d7ff1bb9b 100644 --- a/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapPermissionTest.java +++ b/src/test/java/com/twilio/rest/preview/sync/service/syncmap/SyncMapPermissionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncMapPermissionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,6 +173,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/trustedComms/BrandedChannelTest.java b/src/test/java/com/twilio/rest/preview/trustedComms/BrandedChannelTest.java index e5023fdd69..fb404294c6 100644 --- a/src/test/java/com/twilio/rest/preview/trustedComms/BrandedChannelTest.java +++ b/src/test/java/com/twilio/rest/preview/trustedComms/BrandedChannelTest.java @@ -31,9 +31,11 @@ public class BrandedChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - BrandedChannel.fetcher("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + BrandedChannel.fetcher("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(BrandedChannel.fetcher("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(BrandedChannel.fetcher("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/trustedComms/BrandsInformationTest.java b/src/test/java/com/twilio/rest/preview/trustedComms/BrandsInformationTest.java index a22c951792..ce9dde0ecc 100644 --- a/src/test/java/com/twilio/rest/preview/trustedComms/BrandsInformationTest.java +++ b/src/test/java/com/twilio/rest/preview/trustedComms/BrandsInformationTest.java @@ -31,9 +31,11 @@ public class BrandsInformationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - BrandsInformation.fetcher().setIfNoneMatch("if_none_match").fetch(); + BrandsInformation.fetcher().setIfNoneMatch("if_none_match").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResultsWithEtagResponse() { result = new ObjectMapper(); }}; - assertNotNull(BrandsInformation.fetcher().setIfNoneMatch("if_none_match").fetch()); + assertNotNull(BrandsInformation.fetcher().setIfNoneMatch("if_none_match").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/trustedComms/CpsTest.java b/src/test/java/com/twilio/rest/preview/trustedComms/CpsTest.java index cc43881f1f..3c6a9dce52 100644 --- a/src/test/java/com/twilio/rest/preview/trustedComms/CpsTest.java +++ b/src/test/java/com/twilio/rest/preview/trustedComms/CpsTest.java @@ -31,9 +31,11 @@ public class CpsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Cps.fetcher().setXXcnamSensitivePhoneNumber("x_xcnam_sensitive_phone_number").fetch(); + Cps.fetcher().setXXcnamSensitivePhoneNumber("x_xcnam_sensitive_phone_number").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Cps.fetcher().setXXcnamSensitivePhoneNumber("x_xcnam_sensitive_phone_number").fetch()); + assertNotNull(Cps.fetcher().setXXcnamSensitivePhoneNumber("x_xcnam_sensitive_phone_number").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/trustedComms/CurrentCallTest.java b/src/test/java/com/twilio/rest/preview/trustedComms/CurrentCallTest.java index 3baa0ec26e..0b10c9e49c 100644 --- a/src/test/java/com/twilio/rest/preview/trustedComms/CurrentCallTest.java +++ b/src/test/java/com/twilio/rest/preview/trustedComms/CurrentCallTest.java @@ -31,9 +31,11 @@ public class CurrentCallTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testFetchRequest() { }}; try { - CurrentCall.fetcher().setXXcnamSensitivePhoneNumberFrom("x_xcnam_sensitive_phone_number_from").setXXcnamSensitivePhoneNumberTo("x_xcnam_sensitive_phone_number_to").fetch(); + CurrentCall.fetcher().setXXcnamSensitivePhoneNumberFrom("x_xcnam_sensitive_phone_number_from").setXXcnamSensitivePhoneNumberTo("x_xcnam_sensitive_phone_number_to").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,6 +68,6 @@ public void testReadFoundResponse() { result = new ObjectMapper(); }}; - assertNotNull(CurrentCall.fetcher().setXXcnamSensitivePhoneNumberFrom("x_xcnam_sensitive_phone_number_from").setXXcnamSensitivePhoneNumberTo("x_xcnam_sensitive_phone_number_to").fetch()); + assertNotNull(CurrentCall.fetcher().setXXcnamSensitivePhoneNumberFrom("x_xcnam_sensitive_phone_number_from").setXXcnamSensitivePhoneNumberTo("x_xcnam_sensitive_phone_number_to").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/trustedComms/brandedchannel/ChannelTest.java b/src/test/java/com/twilio/rest/preview/trustedComms/brandedchannel/ChannelTest.java index 91eadaa17e..0d193b6ef1 100644 --- a/src/test/java/com/twilio/rest/preview/trustedComms/brandedchannel/ChannelTest.java +++ b/src/test/java/com/twilio/rest/preview/trustedComms/brandedchannel/ChannelTest.java @@ -31,9 +31,11 @@ public class ChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Channel.creator("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Channel.creator("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Channel.creator("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Channel.creator("BWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/AssistantTest.java b/src/test/java/com/twilio/rest/preview/understand/AssistantTest.java index 32ff1d0f02..e242bec900 100644 --- a/src/test/java/com/twilio/rest/preview/understand/AssistantTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/AssistantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AssistantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Assistant.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Assistant.reader().read(); + Assistant.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Assistant.reader().read()); + assertNotNull(Assistant.reader().read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Assistant.reader().read()); + assertNotNull(Assistant.reader().read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Assistant.creator().create(); + Assistant.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Assistant.creator().create(); + Assistant.creator().create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Assistant.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Assistant.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsTest.java index de0a0ec369..fb3e9e5771 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantFallbackActionsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AssistantFallbackActionsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - AssistantFallbackActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AssistantFallbackActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssistantFallbackActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AssistantFallbackActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - AssistantFallbackActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AssistantFallbackActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - AssistantFallbackActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AssistantFallbackActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsTest.java index 509708cac2..b6a9fb0525 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/AssistantInitiationActionsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AssistantInitiationActionsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - AssistantInitiationActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AssistantInitiationActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssistantInitiationActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AssistantInitiationActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - AssistantInitiationActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AssistantInitiationActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - AssistantInitiationActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + AssistantInitiationActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/DialogueTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/DialogueTest.java index 7724f5e74a..9c13a72097 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/DialogueTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/DialogueTest.java @@ -31,9 +31,11 @@ public class DialogueTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Dialogue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/FieldTypeTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/FieldTypeTest.java index fe9407e25f..b146d65fee 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/FieldTypeTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/FieldTypeTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FieldTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FieldType.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldType.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + FieldType.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + FieldType.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldType.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/ModelBuildTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/ModelBuildTest.java index 2376131e89..6e56ae3ae1 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/ModelBuildTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/ModelBuildTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ModelBuildTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ModelBuild.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ModelBuild.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ModelBuild.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ModelBuild.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ModelBuild.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/QueryTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/QueryTest.java index 80911313c7..87df7eaf73 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/QueryTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/QueryTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class QueryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Query.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Query.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +126,7 @@ public void testCreateRequest() { }}; try { - Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(); + Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(); + Query.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "query").create(tw); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Query.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Query.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/StyleSheetTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/StyleSheetTest.java index 4ffe7bf494..a51cbba2a9 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/StyleSheetTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/StyleSheetTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class StyleSheetTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(StyleSheet.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + StyleSheet.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/TaskTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/TaskTest.java index 1db536583e..039d72f3f4 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/TaskTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/TaskTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Task.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + Task.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Task.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Task.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueTest.java index 0b14ae5466..357bacae64 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/fieldtype/FieldValueTest.java @@ -31,9 +31,11 @@ public class FieldValueTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FieldValue.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FieldValue.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +130,7 @@ public void testCreateRequest() { }}; try { - FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(); + FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(); + FieldValue.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "value").create(tw); } @Test @@ -160,7 +162,7 @@ public void testDeleteRequest() { }}; try { - FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,6 +176,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + FieldValue.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/task/FieldTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/task/FieldTest.java index 162d9b27fa..944ceea698 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/task/FieldTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/task/FieldTest.java @@ -31,9 +31,11 @@ public class FieldTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Field.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Field.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +130,7 @@ public void testCreateRequest() { }}; try { - Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(); + Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(); + Field.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "field_type", "unique_name").create(tw); } @Test @@ -160,7 +162,7 @@ public void testDeleteRequest() { }}; try { - Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,6 +176,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Field.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/task/SampleTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/task/SampleTest.java index 7a9817bbfb..a97f715fc3 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/task/SampleTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/task/SampleTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SampleTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Sample.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Sample.reader("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +126,7 @@ public void testCreateRequest() { }}; try { - Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(); + Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(); + Sample.creator("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "language", "tagged_text").create(tw); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sample.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sample.deleter("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsTest.java index c3d5885493..42ff9ff691 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskActionsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskActionsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskActions.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskActions.updater("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsTest.java b/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsTest.java index eb57e44819..ef54009d25 100644 --- a/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsTest.java +++ b/src/test/java/com/twilio/rest/preview/understand/assistant/task/TaskStatisticsTest.java @@ -31,9 +31,11 @@ public class TaskStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskStatistics.fetcher("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/wireless/CommandTest.java b/src/test/java/com/twilio/rest/preview/wireless/CommandTest.java index df1322f952..34146b8468 100644 --- a/src/test/java/com/twilio/rest/preview/wireless/CommandTest.java +++ b/src/test/java/com/twilio/rest/preview/wireless/CommandTest.java @@ -31,9 +31,11 @@ public class CommandTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Command.reader().read(); + Command.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } @Test @@ -127,7 +129,7 @@ public void testCreateRequest() { }}; try { - Command.creator("command").create(); + Command.creator("command").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Command.creator("command").create(); + Command.creator("command").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/wireless/RatePlanTest.java b/src/test/java/com/twilio/rest/preview/wireless/RatePlanTest.java index 6649af6caa..cb4e067e8f 100644 --- a/src/test/java/com/twilio/rest/preview/wireless/RatePlanTest.java +++ b/src/test/java/com/twilio/rest/preview/wireless/RatePlanTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RatePlanTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - RatePlan.reader().read(); + RatePlan.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(RatePlan.reader().read()); + assertNotNull(RatePlan.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(RatePlan.reader().read()); + assertNotNull(RatePlan.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - RatePlan.creator().create(); + RatePlan.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - RatePlan.creator().create(); + RatePlan.creator().create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/wireless/SimTest.java b/src/test/java/com/twilio/rest/preview/wireless/SimTest.java index bc5a4a3ae5..c3e8b51fc4 100644 --- a/src/test/java/com/twilio/rest/preview/wireless/SimTest.java +++ b/src/test/java/com/twilio/rest/preview/wireless/SimTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SimTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Sim.reader().read(); + Sim.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +139,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/preview/wireless/sim/UsageTest.java b/src/test/java/com/twilio/rest/preview/wireless/sim/UsageTest.java index e259f9788e..eb93e85ee1 100644 --- a/src/test/java/com/twilio/rest/preview/wireless/sim/UsageTest.java +++ b/src/test/java/com/twilio/rest/preview/wireless/sim/UsageTest.java @@ -31,9 +31,11 @@ public class UsageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Usage.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Usage.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Usage.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Usage.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v1/messaging/CountryTest.java b/src/test/java/com/twilio/rest/pricing/v1/messaging/CountryTest.java index 8f247de4ef..cb16a1b0e7 100644 --- a/src/test/java/com/twilio/rest/pricing/v1/messaging/CountryTest.java +++ b/src/test/java/com/twilio/rest/pricing/v1/messaging/CountryTest.java @@ -31,9 +31,11 @@ public class CountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Country.reader().read(); + Country.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Country.fetcher("US").fetch(); + Country.fetcher("US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.fetcher("US").fetch()); + assertNotNull(Country.fetcher("US").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v1/phonenumber/CountryTest.java b/src/test/java/com/twilio/rest/pricing/v1/phonenumber/CountryTest.java index 540f533061..bbbbe42648 100644 --- a/src/test/java/com/twilio/rest/pricing/v1/phonenumber/CountryTest.java +++ b/src/test/java/com/twilio/rest/pricing/v1/phonenumber/CountryTest.java @@ -31,9 +31,11 @@ public class CountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Country.reader().read(); + Country.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Country.fetcher("US").fetch(); + Country.fetcher("US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.fetcher("US").fetch()); + assertNotNull(Country.fetcher("US").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v1/voice/CountryTest.java b/src/test/java/com/twilio/rest/pricing/v1/voice/CountryTest.java index 4818f50458..5918d545b4 100644 --- a/src/test/java/com/twilio/rest/pricing/v1/voice/CountryTest.java +++ b/src/test/java/com/twilio/rest/pricing/v1/voice/CountryTest.java @@ -31,9 +31,11 @@ public class CountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Country.reader().read(); + Country.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Country.fetcher("US").fetch(); + Country.fetcher("US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.fetcher("US").fetch()); + assertNotNull(Country.fetcher("US").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v1/voice/NumberTest.java b/src/test/java/com/twilio/rest/pricing/v1/voice/NumberTest.java index 3e1fb02951..05653c7169 100644 --- a/src/test/java/com/twilio/rest/pricing/v1/voice/NumberTest.java +++ b/src/test/java/com/twilio/rest/pricing/v1/voice/NumberTest.java @@ -31,9 +31,11 @@ public class NumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(); + Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v2/CountryTest.java b/src/test/java/com/twilio/rest/pricing/v2/CountryTest.java index 075048540e..16bed1e563 100644 --- a/src/test/java/com/twilio/rest/pricing/v2/CountryTest.java +++ b/src/test/java/com/twilio/rest/pricing/v2/CountryTest.java @@ -31,9 +31,11 @@ public class CountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Country.reader().read(); + Country.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Country.fetcher("US").fetch(); + Country.fetcher("US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.fetcher("US").fetch()); + assertNotNull(Country.fetcher("US").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v2/NumberTest.java b/src/test/java/com/twilio/rest/pricing/v2/NumberTest.java index 45bed5e262..25832d221b 100644 --- a/src/test/java/com/twilio/rest/pricing/v2/NumberTest.java +++ b/src/test/java/com/twilio/rest/pricing/v2/NumberTest.java @@ -31,9 +31,11 @@ public class NumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(); + Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } @Test @@ -77,6 +79,6 @@ public void testFetchWithOriginationResponse() { result = new ObjectMapper(); }}; - assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v2/voice/CountryTest.java b/src/test/java/com/twilio/rest/pricing/v2/voice/CountryTest.java index 60d69100e4..317a8c82ca 100644 --- a/src/test/java/com/twilio/rest/pricing/v2/voice/CountryTest.java +++ b/src/test/java/com/twilio/rest/pricing/v2/voice/CountryTest.java @@ -31,9 +31,11 @@ public class CountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Country.reader().read(); + Country.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Country.fetcher("US").fetch(); + Country.fetcher("US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.fetcher("US").fetch()); + assertNotNull(Country.fetcher("US").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/pricing/v2/voice/NumberTest.java b/src/test/java/com/twilio/rest/pricing/v2/voice/NumberTest.java index 103795cd57..34479585d0 100644 --- a/src/test/java/com/twilio/rest/pricing/v2/voice/NumberTest.java +++ b/src/test/java/com/twilio/rest/pricing/v2/voice/NumberTest.java @@ -31,9 +31,11 @@ public class NumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(); + Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch()); + assertNotNull(Number.fetcher(new com.twilio.type.PhoneNumber("+15017122661")).fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/ServiceTest.java b/src/test/java/com/twilio/rest/proxy/v1/ServiceTest.java index 17c2655275..08ae499d44 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator("unique_name").create(); + Service.creator("unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("unique_name").create(); + Service.creator("unique_name").create(tw); } @Test @@ -147,7 +145,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/service/PhoneNumberTest.java b/src/test/java/com/twilio/rest/proxy/v1/service/PhoneNumberTest.java index ac525cd774..bab145a4a4 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/service/PhoneNumberTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/service/PhoneNumberTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class PhoneNumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - PhoneNumber.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - PhoneNumber.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - PhoneNumber.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PhoneNumber.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - PhoneNumber.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PhoneNumber.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - PhoneNumber.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + PhoneNumber.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(PhoneNumber.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -147,7 +145,7 @@ public void testFetchRequest() { }}; try { - PhoneNumber.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PhoneNumber.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PhoneNumber.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - PhoneNumber.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + PhoneNumber.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - PhoneNumber.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + PhoneNumber.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/service/SessionTest.java b/src/test/java/com/twilio/rest/proxy/v1/service/SessionTest.java index 5a63b6aa56..7292d0bbd7 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/service/SessionTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/service/SessionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SessionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Session.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Session.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Session.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Session.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Session.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Session.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Session.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Session.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Session.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Session.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Session.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Session.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testDeleteRequest() { }}; try { - Session.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Session.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Session.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Session.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - Session.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Session.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Session.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Session.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/service/ShortCodeTest.java b/src/test/java/com/twilio/rest/proxy/v1/service/ShortCodeTest.java index 6f6acc3195..73582da15f 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/service/ShortCodeTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/service/ShortCodeTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ShortCodeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - ShortCode.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ShortCode.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ShortCode.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + ShortCode.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - ShortCode.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ShortCode.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ShortCode.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ShortCode.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - ShortCode.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ShortCode.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ShortCode.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -147,7 +145,7 @@ public void testFetchRequest() { }}; try { - ShortCode.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ShortCode.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ShortCode.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ShortCode.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - ShortCode.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ShortCode.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ShortCode.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ShortCode.updater("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/service/session/InteractionTest.java b/src/test/java/com/twilio/rest/proxy/v1/service/session/InteractionTest.java index 872d7969fc..99011fda6f 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/service/session/InteractionTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/service/session/InteractionTest.java @@ -31,9 +31,11 @@ public class InteractionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Interaction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Interaction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Interaction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Interaction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Interaction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Interaction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Interaction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Interaction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -115,7 +117,7 @@ public void testDeleteRequest() { }}; try { - Interaction.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Interaction.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +131,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Interaction.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Interaction.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/service/session/ParticipantTest.java b/src/test/java/com/twilio/rest/proxy/v1/service/session/ParticipantTest.java index 2cd21b956c..2078e19ae4 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/service/session/ParticipantTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/service/session/ParticipantTest.java @@ -31,9 +31,11 @@ public class ParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Participant.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Participant.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +79,7 @@ public void testFetchChannelResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +97,7 @@ public void testReadRequest() { }}; try { - Participant.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Participant.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testCreateRequest() { }}; try { - Participant.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identifier").create(); + Participant.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identifier").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Participant.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identifier").create(); + Participant.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identifier").create(tw); } @Test @@ -153,7 +155,7 @@ public void testCreateChannelResponse() { result = new ObjectMapper(); }}; - Participant.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identifier").create(); + Participant.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identifier").create(tw); } @Test @@ -171,7 +173,7 @@ public void testDeleteRequest() { }}; try { - Participant.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Participant.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -185,6 +187,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Participant.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Participant.deleter("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionTest.java b/src/test/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionTest.java index 76d31a10ed..b7322873be 100644 --- a/src/test/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionTest.java +++ b/src/test/java/com/twilio/rest/proxy/v1/service/session/participant/MessageInteractionTest.java @@ -31,9 +31,11 @@ public class MessageInteractionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - MessageInteraction.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + MessageInteraction.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - MessageInteraction.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(); + MessageInteraction.creator("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "body").create(tw); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - MessageInteraction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + MessageInteraction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(MessageInteraction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(MessageInteraction.fetcher("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KIXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testReadRequest() { }}; try { - MessageInteraction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + MessageInteraction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +131,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(MessageInteraction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(MessageInteraction.reader("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "KPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/ServiceTest.java b/src/test/java/com/twilio/rest/serverless/v1/ServiceTest.java index aeb89581ea..ca73832093 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -148,7 +146,7 @@ public void testCreateRequest() { }}; try { - Service.creator("unique_name", "friendly_name").create(); + Service.creator("unique_name", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator("unique_name", "friendly_name").create(); + Service.creator("unique_name", "friendly_name").create(tw); } @Test @@ -180,7 +178,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,6 +192,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/AssetTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/AssetTest.java index ccb8cb5080..77bb8452e9 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/AssetTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/AssetTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class AssetTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Asset.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Asset.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Asset.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Asset.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Asset.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Asset.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Asset.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Asset.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Asset.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Asset.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Asset.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Asset.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testCreateRequest() { }}; try { - Asset.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Asset.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Asset.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Asset.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - Asset.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + Asset.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Asset.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + Asset.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/BuildTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/BuildTest.java index ac9fdae788..1e7f865d8c 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/BuildTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/BuildTest.java @@ -31,9 +31,11 @@ public class BuildTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Build.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Build.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Build.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Build.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Build.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Build.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Build.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Build.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testDeleteRequest() { }}; try { - Build.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Build.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Build.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Build.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +149,7 @@ public void testCreateRequest() { }}; try { - Build.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Build.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,6 +163,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Build.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Build.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/EnvironmentTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/EnvironmentTest.java index 11d7f50f18..ef9f728cbe 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/EnvironmentTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/EnvironmentTest.java @@ -31,9 +31,11 @@ public class EnvironmentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Environment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Environment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Environment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Environment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Environment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Environment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Environment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Environment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - Environment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + Environment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Environment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + Environment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); } @Test @@ -147,7 +149,7 @@ public void testDeleteRequest() { }}; try { - Environment.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Environment.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,6 +163,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Environment.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Environment.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/FunctionTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/FunctionTest.java index 7b025776e3..deca058016 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/FunctionTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/FunctionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FunctionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Function.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Function.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Function.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Function.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Function.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Function.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Function.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Function.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Function.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Function.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Function.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Function.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testCreateRequest() { }}; try { - Function.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Function.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Function.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Function.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - Function.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + Function.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Function.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + Function.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/asset/AssetVersionTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/asset/AssetVersionTest.java index 0d2e0db820..dd419dc5c5 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/asset/AssetVersionTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/asset/AssetVersionTest.java @@ -31,9 +31,11 @@ public class AssetVersionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - AssetVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + AssetVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssetVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(AssetVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - AssetVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AssetVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AssetVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AssetVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/build/BuildStatusTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/build/BuildStatusTest.java index 3e47a3f2cb..370d66e1db 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/build/BuildStatusTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/build/BuildStatusTest.java @@ -31,9 +31,11 @@ public class BuildStatusTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - BuildStatus.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + BuildStatus.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(BuildStatus.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(BuildStatus.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/environment/DeploymentTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/environment/DeploymentTest.java index 1e466bab49..75292c4bcc 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/environment/DeploymentTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/environment/DeploymentTest.java @@ -31,9 +31,11 @@ public class DeploymentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Deployment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Deployment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Deployment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Deployment.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Deployment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Deployment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Deployment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Deployment.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - Deployment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Deployment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +131,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Deployment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Deployment.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/environment/LogTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/environment/LogTest.java index 59aa9e9eea..73cdf23aad 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/environment/LogTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/environment/LogTest.java @@ -31,9 +31,11 @@ public class LogTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Log.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Log.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Log.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Log.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Log.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Log.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Log.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Log.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/environment/VariableTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/environment/VariableTest.java index 43a46931e5..5a6fb6f76a 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/environment/VariableTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/environment/VariableTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class VariableTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Variable.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Variable.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Variable.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Variable.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Variable.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Variable.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Variable.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Variable.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - Variable.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "value").create(); + Variable.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "value").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Variable.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "value").create(); + Variable.creator("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", "value").create(tw); } @Test @@ -148,7 +146,7 @@ public void testUpdateRequest() { }}; try { - Variable.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Variable.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Variable.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Variable.updater("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -180,7 +178,7 @@ public void testDeleteRequest() { }}; try { - Variable.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Variable.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,6 +192,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Variable.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Variable.deleter("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/function/FunctionVersionTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/function/FunctionVersionTest.java index eed17a485c..680df0f475 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/function/FunctionVersionTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/function/FunctionVersionTest.java @@ -31,9 +31,11 @@ public class FunctionVersionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - FunctionVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FunctionVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FunctionVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FunctionVersion.reader("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - FunctionVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FunctionVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FunctionVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FunctionVersion.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/serverless/v1/service/function/functionversion/FunctionVersionContentTest.java b/src/test/java/com/twilio/rest/serverless/v1/service/function/functionversion/FunctionVersionContentTest.java index e982f307e5..876eca8e6a 100644 --- a/src/test/java/com/twilio/rest/serverless/v1/service/function/functionversion/FunctionVersionContentTest.java +++ b/src/test/java/com/twilio/rest/serverless/v1/service/function/functionversion/FunctionVersionContentTest.java @@ -31,9 +31,11 @@ public class FunctionVersionContentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - FunctionVersionContent.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FunctionVersionContent.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FunctionVersionContent.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FunctionVersionContent.fetcher("ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/FlowTest.java b/src/test/java/com/twilio/rest/studio/v1/FlowTest.java index 1133351f03..57a1a97202 100644 --- a/src/test/java/com/twilio/rest/studio/v1/FlowTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/FlowTest.java @@ -31,9 +31,11 @@ public class FlowTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Flow.reader().read(); + Flow.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Flow.reader().read()); + assertNotNull(Flow.reader().read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +117,7 @@ public void testDeleteRequest() { }}; try { - Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,6 +131,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/EngagementTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/EngagementTest.java index 394729fa71..64e0d083e8 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/EngagementTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/EngagementTest.java @@ -31,9 +31,11 @@ public class EngagementTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Engagement.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Engagement.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Engagement.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Engagement.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Engagement.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Engagement.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Engagement.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Engagement.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +118,7 @@ public void testCreateRequest() { }}; try { - Engagement.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(); + Engagement.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +132,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Engagement.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(); + Engagement.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } @Test @@ -148,7 +150,7 @@ public void testDeleteRequest() { }}; try { - Engagement.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Engagement.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,6 +164,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Engagement.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Engagement.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/ExecutionTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/ExecutionTest.java index 7afebd1d90..8847311c0a 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/ExecutionTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/ExecutionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ExecutionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(); + Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(); + Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } @Test @@ -148,7 +146,7 @@ public void testDeleteRequest() { }}; try { - Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -180,7 +178,7 @@ public void testUpdateRequest() { }}; try { - Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(); + Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,6 +192,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(); + Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/engagement/EngagementContextTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/engagement/EngagementContextTest.java index 94e124e81d..31668cf317 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/engagement/EngagementContextTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/engagement/EngagementContextTest.java @@ -31,9 +31,11 @@ public class EngagementContextTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - EngagementContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + EngagementContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EngagementContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(EngagementContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/engagement/StepTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/engagement/StepTest.java index 75003637d6..f463c3638e 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/engagement/StepTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/engagement/StepTest.java @@ -31,9 +31,11 @@ public class StepTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Step.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Step.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Step.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Step.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - Step.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Step.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Step.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Step.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/engagement/step/StepContextTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/engagement/step/StepContextTest.java index 1846c24d2e..62d8ee4ebb 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/engagement/step/StepContextTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/engagement/step/StepContextTest.java @@ -31,9 +31,11 @@ public class StepContextTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - StepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + StepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(StepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(StepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionContextTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionContextTest.java index fefb006114..3f9da8d79b 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionContextTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionContextTest.java @@ -31,9 +31,11 @@ public class ExecutionContextTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionStepTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionStepTest.java index b82ce491c0..5e3b8e2f44 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionStepTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/execution/ExecutionStepTest.java @@ -31,9 +31,11 @@ public class ExecutionStepTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v1/flow/execution/executionstep/ExecutionStepContextTest.java b/src/test/java/com/twilio/rest/studio/v1/flow/execution/executionstep/ExecutionStepContextTest.java index fe96386502..a694691d43 100644 --- a/src/test/java/com/twilio/rest/studio/v1/flow/execution/executionstep/ExecutionStepContextTest.java +++ b/src/test/java/com/twilio/rest/studio/v1/flow/execution/executionstep/ExecutionStepContextTest.java @@ -31,9 +31,11 @@ public class ExecutionStepContextTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/FlowTest.java b/src/test/java/com/twilio/rest/studio/v2/FlowTest.java index cb371c9bdd..87b2b469fa 100644 --- a/src/test/java/com/twilio/rest/studio/v2/FlowTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/FlowTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FlowTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +51,7 @@ public void testCreateRequest() { }}; try { - Flow.creator("friendly_name", Flow.Status.DRAFT, new java.util.HashMap()).create(); + Flow.creator("friendly_name", Flow.Status.DRAFT, new java.util.HashMap()).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +65,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Flow.creator("friendly_name", Flow.Status.DRAFT, new java.util.HashMap()).create(); + Flow.creator("friendly_name", Flow.Status.DRAFT, new java.util.HashMap()).create(tw); } @Test @@ -85,7 +83,7 @@ public void testUpdateRequest() { }}; try { - Flow.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Flow.Status.DRAFT).update(); + Flow.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Flow.Status.DRAFT).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +97,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Flow.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Flow.Status.DRAFT).update(); + Flow.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Flow.Status.DRAFT).update(tw); } @Test @@ -117,7 +115,7 @@ public void testReadRequest() { }}; try { - Flow.reader().read(); + Flow.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +129,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Flow.reader().read()); + assertNotNull(Flow.reader().read(tw)); } @Test @@ -149,7 +147,7 @@ public void testFetchRequest() { }}; try { - Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +161,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Flow.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -181,7 +179,7 @@ public void testDeleteRequest() { }}; try { - Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -195,6 +193,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Flow.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/FlowValidateTest.java b/src/test/java/com/twilio/rest/studio/v2/FlowValidateTest.java index 3158e6371b..8bd5233a23 100644 --- a/src/test/java/com/twilio/rest/studio/v2/FlowValidateTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/FlowValidateTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FlowValidateTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +51,7 @@ public void testUpdateRequest() { }}; try { - FlowValidate.updater("friendly_name", FlowValidate.Status.DRAFT, new java.util.HashMap()).update(); + FlowValidate.updater("friendly_name", FlowValidate.Status.DRAFT, new java.util.HashMap()).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,6 +65,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - FlowValidate.updater("friendly_name", FlowValidate.Status.DRAFT, new java.util.HashMap()).update(); + FlowValidate.updater("friendly_name", FlowValidate.Status.DRAFT, new java.util.HashMap()).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/flow/ExecutionTest.java b/src/test/java/com/twilio/rest/studio/v2/flow/ExecutionTest.java index 9ac00c9fff..81b8adaff0 100644 --- a/src/test/java/com/twilio/rest/studio/v2/flow/ExecutionTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/flow/ExecutionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ExecutionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Execution.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Execution.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(); + Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(); + Execution.creator("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new com.twilio.type.PhoneNumber("+15558675310"), new com.twilio.type.PhoneNumber("+15017122661")).create(tw); } @Test @@ -148,7 +146,7 @@ public void testDeleteRequest() { }}; try { - Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Execution.deleter("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -180,7 +178,7 @@ public void testUpdateRequest() { }}; try { - Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(); + Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -194,6 +192,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(); + Execution.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Execution.Status.ACTIVE).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/flow/FlowRevisionTest.java b/src/test/java/com/twilio/rest/studio/v2/flow/FlowRevisionTest.java index d9c3e89875..93bd2e4508 100644 --- a/src/test/java/com/twilio/rest/studio/v2/flow/FlowRevisionTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/flow/FlowRevisionTest.java @@ -31,9 +31,11 @@ public class FlowRevisionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - FlowRevision.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + FlowRevision.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(FlowRevision.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(FlowRevision.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - FlowRevision.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "revision").fetch(); + FlowRevision.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "revision").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FlowRevision.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "revision").fetch()); + assertNotNull(FlowRevision.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "revision").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/flow/FlowTestUserTest.java b/src/test/java/com/twilio/rest/studio/v2/flow/FlowTestUserTest.java index 557e154552..96dcb1b0b7 100644 --- a/src/test/java/com/twilio/rest/studio/v2/flow/FlowTestUserTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/flow/FlowTestUserTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class FlowTestUserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +50,7 @@ public void testFetchRequest() { }}; try { - FlowTestUser.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + FlowTestUser.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +64,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(FlowTestUser.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(FlowTestUser.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +82,7 @@ public void testUpdateRequest() { }}; try { - FlowTestUser.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("test_users")).update(); + FlowTestUser.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("test_users")).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +96,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - FlowTestUser.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("test_users")).update(); + FlowTestUser.updater("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Promoter.listOfOne("test_users")).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionContextTest.java b/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionContextTest.java index aebb99bb24..5dc225b426 100644 --- a/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionContextTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionContextTest.java @@ -31,9 +31,11 @@ public class ExecutionContextTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ExecutionContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionStepTest.java b/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionStepTest.java index 47642c1625..bb1f1436e7 100644 --- a/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionStepTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/flow/execution/ExecutionStepTest.java @@ -31,9 +31,11 @@ public class ExecutionStepTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ExecutionStep.reader("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testFetchRequest() { }}; try { - ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ExecutionStep.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/studio/v2/flow/execution/executionstep/ExecutionStepContextTest.java b/src/test/java/com/twilio/rest/studio/v2/flow/execution/executionstep/ExecutionStepContextTest.java index 47c7b45e44..cfa0dafd5e 100644 --- a/src/test/java/com/twilio/rest/studio/v2/flow/execution/executionstep/ExecutionStepContextTest.java +++ b/src/test/java/com/twilio/rest/studio/v2/flow/execution/executionstep/ExecutionStepContextTest.java @@ -31,9 +31,11 @@ public class ExecutionStepContextTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ExecutionStepContext.fetcher("FWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "FTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/CommandTest.java b/src/test/java/com/twilio/rest/supersim/v1/CommandTest.java index 915cee50c1..52ec968c2b 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/CommandTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/CommandTest.java @@ -31,9 +31,11 @@ public class CommandTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - Command.creator("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "command").create(); + Command.creator("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "command").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreateCommandMinimalResponse() { result = new ObjectMapper(); }}; - Command.creator("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "command").create(); + Command.creator("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "command").create(tw); } @Test @@ -78,7 +80,7 @@ public void testCreateCommandFullResponse() { result = new ObjectMapper(); }}; - Command.creator("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "command").create(); + Command.creator("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "command").create(tw); } @Test @@ -96,7 +98,7 @@ public void testFetchRequest() { }}; try { - Command.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Command.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -110,7 +112,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Command.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -128,7 +130,7 @@ public void testReadRequest() { }}; try { - Command.reader().read(); + Command.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } @Test @@ -154,6 +156,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/EsimProfileTest.java b/src/test/java/com/twilio/rest/supersim/v1/EsimProfileTest.java index 04883f1167..1cccd629d4 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/EsimProfileTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/EsimProfileTest.java @@ -31,9 +31,11 @@ public class EsimProfileTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - EsimProfile.creator("eid").create(); + EsimProfile.creator("eid").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateDefaultSmdpResponse() { result = new ObjectMapper(); }}; - EsimProfile.creator("eid").create(); + EsimProfile.creator("eid").create(tw); } @Test @@ -77,7 +79,7 @@ public void testCreateWithCallbackResponse() { result = new ObjectMapper(); }}; - EsimProfile.creator("eid").create(); + EsimProfile.creator("eid").create(tw); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - EsimProfile.fetcher("HPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + EsimProfile.fetcher("HPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EsimProfile.fetcher("HPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(EsimProfile.fetcher("HPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +129,7 @@ public void testReadRequest() { }}; try { - EsimProfile.reader().read(); + EsimProfile.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testReadAllResponse() { result = new ObjectMapper(); }}; - assertNotNull(EsimProfile.reader().read()); + assertNotNull(EsimProfile.reader().read(tw)); } @Test @@ -153,7 +155,7 @@ public void testReadByEidResponse() { result = new ObjectMapper(); }}; - assertNotNull(EsimProfile.reader().read()); + assertNotNull(EsimProfile.reader().read(tw)); } @Test @@ -165,7 +167,7 @@ public void testReadBySimSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(EsimProfile.reader().read()); + assertNotNull(EsimProfile.reader().read(tw)); } @Test @@ -177,6 +179,6 @@ public void testReadByStatusResponse() { result = new ObjectMapper(); }}; - assertNotNull(EsimProfile.reader().read()); + assertNotNull(EsimProfile.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/FleetTest.java b/src/test/java/com/twilio/rest/supersim/v1/FleetTest.java index 934562b6d4..e94f5400c8 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/FleetTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/FleetTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FleetTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Fleet.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Fleet.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Fleet.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Fleet.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Fleet.fetcher("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Fleet.fetcher("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fleet.fetcher("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Fleet.fetcher("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - Fleet.reader().read(); + Fleet.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fleet.reader().read()); + assertNotNull(Fleet.reader().read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Fleet.reader().read()); + assertNotNull(Fleet.reader().read(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Fleet.updater("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Fleet.updater("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +171,6 @@ public void testUpdateUniqueNameResponse() { result = new ObjectMapper(); }}; - Fleet.updater("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Fleet.updater("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/IpCommandTest.java b/src/test/java/com/twilio/rest/supersim/v1/IpCommandTest.java index c6696cf90c..7e1d0b7062 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/IpCommandTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/IpCommandTest.java @@ -31,9 +31,11 @@ public class IpCommandTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +55,7 @@ public void testCreateRequest() { }}; try { - IpCommand.creator("sim", "payload", 1).create(); + IpCommand.creator("sim", "payload", 1).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +69,7 @@ public void testCreateFullResponse() { result = new ObjectMapper(); }}; - IpCommand.creator("sim", "payload", 1).create(); + IpCommand.creator("sim", "payload", 1).create(tw); } @Test @@ -79,7 +81,7 @@ public void testCreateMinimalResponse() { result = new ObjectMapper(); }}; - IpCommand.creator("sim", "payload", 1).create(); + IpCommand.creator("sim", "payload", 1).create(tw); } @Test @@ -97,7 +99,7 @@ public void testFetchRequest() { }}; try { - IpCommand.fetcher("HGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IpCommand.fetcher("HGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -111,7 +113,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpCommand.fetcher("HGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IpCommand.fetcher("HGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -129,7 +131,7 @@ public void testReadRequest() { }}; try { - IpCommand.reader().read(); + IpCommand.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +145,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpCommand.reader().read()); + assertNotNull(IpCommand.reader().read(tw)); } @Test @@ -155,6 +157,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpCommand.reader().read()); + assertNotNull(IpCommand.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/NetworkAccessProfileTest.java b/src/test/java/com/twilio/rest/supersim/v1/NetworkAccessProfileTest.java index 8c982de618..568be900c7 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/NetworkAccessProfileTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/NetworkAccessProfileTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class NetworkAccessProfileTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - NetworkAccessProfile.creator().create(); + NetworkAccessProfile.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateMinimalResponse() { result = new ObjectMapper(); }}; - NetworkAccessProfile.creator().create(); + NetworkAccessProfile.creator().create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateWithNameAndNetworksResponse() { result = new ObjectMapper(); }}; - NetworkAccessProfile.creator().create(); + NetworkAccessProfile.creator().create(tw); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - NetworkAccessProfile.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + NetworkAccessProfile.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(NetworkAccessProfile.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(NetworkAccessProfile.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - NetworkAccessProfile.updater("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + NetworkAccessProfile.updater("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testUpdateUniqueNameResponse() { result = new ObjectMapper(); }}; - NetworkAccessProfile.updater("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + NetworkAccessProfile.updater("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -159,7 +157,7 @@ public void testReadRequest() { }}; try { - NetworkAccessProfile.reader().read(); + NetworkAccessProfile.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(NetworkAccessProfile.reader().read()); + assertNotNull(NetworkAccessProfile.reader().read(tw)); } @Test @@ -185,6 +183,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(NetworkAccessProfile.reader().read()); + assertNotNull(NetworkAccessProfile.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/NetworkTest.java b/src/test/java/com/twilio/rest/supersim/v1/NetworkTest.java index 75408dfb3e..a6707b6219 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/NetworkTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/NetworkTest.java @@ -31,9 +31,11 @@ public class NetworkTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Network.fetcher("HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Network.fetcher("HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Network.fetcher("HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Network.fetcher("HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Network.reader().read(); + Network.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadResponse() { result = new ObjectMapper(); }}; - assertNotNull(Network.reader().read()); + assertNotNull(Network.reader().read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadWithFiltersResponse() { result = new ObjectMapper(); }}; - assertNotNull(Network.reader().read()); + assertNotNull(Network.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/SimTest.java b/src/test/java/com/twilio/rest/supersim/v1/SimTest.java index 571c269114..94c0bd41d9 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/SimTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/SimTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SimTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - Sim.creator("iccid", "registration_code").create(); + Sim.creator("iccid", "registration_code").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Sim.creator("iccid", "registration_code").create(); + Sim.creator("iccid", "registration_code").create(tw); } @Test @@ -84,7 +82,7 @@ public void testFetchRequest() { }}; try { - Sim.fetcher("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Sim.fetcher("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.fetcher("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Sim.fetcher("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +114,7 @@ public void testUpdateRequest() { }}; try { - Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testUpdateUniqueNameResponse() { result = new ObjectMapper(); }}; - Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -142,7 +140,7 @@ public void testUpdateStatusResponse() { result = new ObjectMapper(); }}; - Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -154,7 +152,7 @@ public void testUpdateFleetWithSidResponse() { result = new ObjectMapper(); }}; - Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -166,7 +164,7 @@ public void testUpdateFleetWithUniqueNameResponse() { result = new ObjectMapper(); }}; - Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -178,7 +176,7 @@ public void testTransferSimToAnotherAccountResponse() { result = new ObjectMapper(); }}; - Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -196,7 +194,7 @@ public void testReadRequest() { }}; try { - Sim.reader().read(); + Sim.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -210,7 +208,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -222,7 +220,7 @@ public void testReadFullByFleetSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -234,7 +232,7 @@ public void testReadFullByFleetNameResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -246,6 +244,6 @@ public void testReadByIccidResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/SmsCommandTest.java b/src/test/java/com/twilio/rest/supersim/v1/SmsCommandTest.java index cccb843cf0..278e40feb6 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/SmsCommandTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/SmsCommandTest.java @@ -31,9 +31,11 @@ public class SmsCommandTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - SmsCommand.creator("sim", "payload").create(); + SmsCommand.creator("sim", "payload").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreateCommandMinimalResponse() { result = new ObjectMapper(); }}; - SmsCommand.creator("sim", "payload").create(); + SmsCommand.creator("sim", "payload").create(tw); } @Test @@ -78,7 +80,7 @@ public void testCreateCommandFullResponse() { result = new ObjectMapper(); }}; - SmsCommand.creator("sim", "payload").create(); + SmsCommand.creator("sim", "payload").create(tw); } @Test @@ -96,7 +98,7 @@ public void testFetchRequest() { }}; try { - SmsCommand.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SmsCommand.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -110,7 +112,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SmsCommand.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SmsCommand.fetcher("HCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -128,7 +130,7 @@ public void testReadRequest() { }}; try { - SmsCommand.reader().read(); + SmsCommand.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SmsCommand.reader().read()); + assertNotNull(SmsCommand.reader().read(tw)); } @Test @@ -154,6 +156,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SmsCommand.reader().read()); + assertNotNull(SmsCommand.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/UsageRecordTest.java b/src/test/java/com/twilio/rest/supersim/v1/UsageRecordTest.java index aaf8b7aea8..c1fd045ef6 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/UsageRecordTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/UsageRecordTest.java @@ -31,9 +31,11 @@ public class UsageRecordTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UsageRecord.reader().read(); + UsageRecord.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadAllResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadAllDayResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -89,7 +91,7 @@ public void testReadAllHourResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -101,7 +103,7 @@ public void testReadDaySimFilterResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -113,7 +115,7 @@ public void testReadDayNetworkFilterResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -125,7 +127,7 @@ public void testReadDayCountryFilterResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -137,7 +139,7 @@ public void testReadDayFleetFilterResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -149,7 +151,7 @@ public void testReadDayGroupBySimResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -161,7 +163,7 @@ public void testReadDayGroupByFleetResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -173,7 +175,7 @@ public void testReadDayGroupByNetworkResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -185,7 +187,7 @@ public void testReadDayGroupByIsoCountryResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } @Test @@ -197,6 +199,6 @@ public void testReadDayGroupBySimAndFilterByCountryResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/networkaccessprofile/NetworkAccessProfileNetworkTest.java b/src/test/java/com/twilio/rest/supersim/v1/networkaccessprofile/NetworkAccessProfileNetworkTest.java index e74d708a1f..6d69a5829b 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/networkaccessprofile/NetworkAccessProfileNetworkTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/networkaccessprofile/NetworkAccessProfileNetworkTest.java @@ -31,9 +31,11 @@ public class NetworkAccessProfileNetworkTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - NetworkAccessProfileNetwork.reader("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + NetworkAccessProfileNetwork.reader("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(NetworkAccessProfileNetwork.reader("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(NetworkAccessProfileNetwork.reader("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - NetworkAccessProfileNetwork.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + NetworkAccessProfileNetwork.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - NetworkAccessProfileNetwork.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + NetworkAccessProfileNetwork.creator("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -115,7 +117,7 @@ public void testDeleteRequest() { }}; try { - NetworkAccessProfileNetwork.deleter("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + NetworkAccessProfileNetwork.deleter("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - NetworkAccessProfileNetwork.deleter("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + NetworkAccessProfileNetwork.deleter("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +149,7 @@ public void testFetchRequest() { }}; try { - NetworkAccessProfileNetwork.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + NetworkAccessProfileNetwork.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,6 +163,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(NetworkAccessProfileNetwork.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(NetworkAccessProfileNetwork.fetcher("HAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "HWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/supersim/v1/sim/BillingPeriodTest.java b/src/test/java/com/twilio/rest/supersim/v1/sim/BillingPeriodTest.java index 4c3e2540d2..ccbaae6863 100644 --- a/src/test/java/com/twilio/rest/supersim/v1/sim/BillingPeriodTest.java +++ b/src/test/java/com/twilio/rest/supersim/v1/sim/BillingPeriodTest.java @@ -31,9 +31,11 @@ public class BillingPeriodTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullActivePeriodResponse() { result = new ObjectMapper(); }}; - assertNotNull(BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -89,6 +91,6 @@ public void testReadFullReadyPeriodResponse() { result = new ObjectMapper(); }}; - assertNotNull(BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(BillingPeriod.reader("HSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/ServiceTest.java b/src/test/java/com/twilio/rest/sync/v1/ServiceTest.java index 5ddde12163..813e62d60e 100644 --- a/src/test/java/com/twilio/rest/sync/v1/ServiceTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Service.creator().create(); + Service.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Service.creator().create(); + Service.creator().create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/DocumentTest.java b/src/test/java/com/twilio/rest/sync/v1/service/DocumentTest.java index 5757fd1beb..af1d84fa69 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/DocumentTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/DocumentTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DocumentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Document.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Document.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Document.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Document.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Document.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/SyncListTest.java b/src/test/java/com/twilio/rest/sync/v1/service/SyncListTest.java index 3210b97571..5c262eaf61 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/SyncListTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/SyncListTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncListTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SyncList.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncList.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncList.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testUpdateRequest() { }}; try { - SyncList.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SyncList.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncList.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SyncList.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -179,7 +177,7 @@ public void testReadRequest() { }}; try { - SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,7 +191,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -205,6 +203,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncList.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/SyncMapTest.java b/src/test/java/com/twilio/rest/sync/v1/service/SyncMapTest.java index 17b09e4ab7..26eb130aee 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/SyncMapTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/SyncMapTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncMapTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SyncMap.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncMap.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncMap.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testUpdateRequest() { }}; try { - SyncMap.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SyncMap.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncMap.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SyncMap.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -179,7 +177,7 @@ public void testReadRequest() { }}; try { - SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,7 +191,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -205,6 +203,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMap.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/SyncStreamTest.java b/src/test/java/com/twilio/rest/sync/v1/service/SyncStreamTest.java index 9ac54f3853..d278e904eb 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/SyncStreamTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/SyncStreamTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncStreamTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncStream.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SyncStream.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncStream.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SyncStream.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncStream.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncStream.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncStream.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SyncStream.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - SyncStream.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncStream.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncStream.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SyncStream.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +145,7 @@ public void testUpdateRequest() { }}; try { - SyncStream.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SyncStream.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncStream.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SyncStream.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -179,7 +177,7 @@ public void testReadRequest() { }}; try { - SyncStream.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncStream.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,7 +191,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncStream.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncStream.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -205,6 +203,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncStream.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncStream.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/document/DocumentPermissionTest.java b/src/test/java/com/twilio/rest/sync/v1/service/document/DocumentPermissionTest.java index 2a1c2dd3bb..21071c097e 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/document/DocumentPermissionTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/document/DocumentPermissionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class DocumentPermissionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(DocumentPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + DocumentPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DocumentPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,6 +173,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + DocumentPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemTest.java b/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemTest.java index b24132bad9..49b6dbde84 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListItemTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncListItemTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch(); + SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch()); + assertNotNull(SyncListItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(); + SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(); + SyncListItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(); + SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(); + SyncListItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").update(); + SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").update(); + SyncListItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1).setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListPermissionTest.java b/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListPermissionTest.java index c8abc8b8db..7da7fc081c 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListPermissionTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/synclist/SyncListPermissionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncListPermissionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(SyncListPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncListPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncListPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,6 +173,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncListPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemTest.java b/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemTest.java index d1e8baf59c..72e71e08da 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapItemTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncMapItemTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch(); + SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch()); + assertNotNull(SyncMapItem.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(); + SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(); + SyncMapItem.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").delete(tw); } @Test @@ -116,7 +114,7 @@ public void testCreateRequest() { }}; try { - SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(); + SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(); + SyncMapItem.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key", new java.util.HashMap()).create(tw); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapItem.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testUpdateRequest() { }}; try { - SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").update(); + SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").update(); + SyncMapItem.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "key").setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapPermissionTest.java b/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapPermissionTest.java index 322c44e741..429cb0a6d2 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapPermissionTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/syncmap/SyncMapPermissionTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SyncMapPermissionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(SyncMapPermission.fetcher("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + SyncMapPermission.deleter("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SyncMapPermission.reader("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,6 +173,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(); + SyncMapPermission.updater("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", true, true, true).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageTest.java b/src/test/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageTest.java index 260f5ae110..93024f7a92 100644 --- a/src/test/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageTest.java +++ b/src/test/java/com/twilio/rest/sync/v1/service/syncstream/StreamMessageTest.java @@ -31,9 +31,11 @@ public class StreamMessageTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - StreamMessage.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(); + StreamMessage.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - StreamMessage.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(); + StreamMessage.creator("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", new java.util.HashMap()).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/WorkspaceTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/WorkspaceTest.java index 725e1c07f2..89b7b77bc1 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/WorkspaceTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/WorkspaceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WorkspaceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Workspace.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Workspace.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Workspace.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Workspace.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Workspace.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Workspace.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Workspace.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Workspace.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - Workspace.reader().read(); + Workspace.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Workspace.reader().read()); + assertNotNull(Workspace.reader().read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Workspace.reader().read()); + assertNotNull(Workspace.reader().read(tw)); } @Test @@ -159,7 +157,7 @@ public void testCreateRequest() { }}; try { - Workspace.creator("friendly_name").create(); + Workspace.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Workspace.creator("friendly_name").create(); + Workspace.creator("friendly_name").create(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Workspace.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Workspace.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Workspace.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Workspace.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/ActivityTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/ActivityTest.java index efd30c907f..e7c04f7a21 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/ActivityTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/ActivityTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ActivityTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Activity.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Activity.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Activity.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Activity.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Activity.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Activity.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Activity.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Activity.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Activity.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Activity.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Activity.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Activity.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Activity.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Activity.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Activity.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Activity.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Activity.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Activity.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -191,7 +189,7 @@ public void testCreateRequest() { }}; try { - Activity.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Activity.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Activity.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Activity.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/EventTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/EventTest.java index 7c2e3a298c..3e697e8907 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/EventTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/EventTest.java @@ -31,9 +31,11 @@ public class EventTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Event.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Event.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Event.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "EVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Event.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Event.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Event.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,6 +111,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Event.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Event.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskChannelTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskChannelTest.java index da351480cf..b2e2c22c64 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskChannelTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - TaskChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +75,7 @@ public void testFetchUniqueNameResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +93,7 @@ public void testReadRequest() { }}; try { - TaskChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TaskChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TaskChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -121,7 +119,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TaskChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -139,7 +137,7 @@ public void testUpdateRequest() { }}; try { - TaskChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -153,7 +151,7 @@ public void testUpdateSidResponse() { result = new ObjectMapper(); }}; - TaskChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -165,7 +163,7 @@ public void testUpdateUniqueNameResponse() { result = new ObjectMapper(); }}; - TaskChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -183,7 +181,7 @@ public void testDeleteRequest() { }}; try { - TaskChannel.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TaskChannel.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -197,7 +195,7 @@ public void testDeleteSidResponse() { result = new ObjectMapper(); }}; - TaskChannel.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TaskChannel.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -209,7 +207,7 @@ public void testDeleteUniqueNameResponse() { result = new ObjectMapper(); }}; - TaskChannel.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TaskChannel.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "TCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -228,7 +226,7 @@ public void testCreateRequest() { }}; try { - TaskChannel.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "unique_name").create(); + TaskChannel.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -242,6 +240,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TaskChannel.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "unique_name").create(); + TaskChannel.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "unique_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskQueueTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskQueueTest.java index 804f26efd5..232e7c8937 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskQueueTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskQueueTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskQueueTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - TaskQueue.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskQueue.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueue.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskQueue.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - TaskQueue.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskQueue.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - TaskQueue.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TaskQueue.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - TaskQueue.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TaskQueue.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueue.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TaskQueue.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueue.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TaskQueue.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +157,7 @@ public void testCreateRequest() { }}; try { - TaskQueue.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + TaskQueue.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TaskQueue.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + TaskQueue.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - TaskQueue.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TaskQueue.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - TaskQueue.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TaskQueue.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskTest.java index aba8874900..a7e9e9372a 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/TaskTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TaskTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Task.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Task.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Task.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Task.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Task.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Task.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Task.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Task.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(); + Task.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Task.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(); + Task.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -185,7 +183,7 @@ public void testReadAssignmentStatusMultipleResponse() { result = new ObjectMapper(); }}; - assertNotNull(Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Task.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -203,7 +201,7 @@ public void testCreateRequest() { }}; try { - Task.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Task.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -217,6 +215,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Task.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Task.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkerTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkerTest.java index 72eb4d182b..835ba9fa2f 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkerTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkerTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WorkerTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Worker.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Worker.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Worker.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Worker.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Worker.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Worker.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testCreateRequest() { }}; try { - Worker.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Worker.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Worker.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(); + Worker.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").create(tw); } @Test @@ -127,7 +125,7 @@ public void testFetchRequest() { }}; try { - Worker.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Worker.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Worker.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Worker.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - Worker.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Worker.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Worker.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Worker.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - Worker.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(); + Worker.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Worker.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(); + Worker.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkflowTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkflowTest.java index 55f484df83..011a27c085 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkflowTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkflowTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WorkflowTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Workflow.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Workflow.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Workflow.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Workflow.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Workflow.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Workflow.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Workflow.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Workflow.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Workflow.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Workflow.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Workflow.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Workflow.deleter("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Workflow.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Workflow.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Workflow.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Workflow.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Workflow.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Workflow.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testCreateRequest() { }}; try { - Workflow.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "configuration").create(); + Workflow.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "configuration").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Workflow.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "configuration").create(); + Workflow.creator("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", "configuration").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceCumulativeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceCumulativeStatisticsTest.java index 8be644d4b3..1f3d1dadb6 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceCumulativeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceCumulativeStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkspaceCumulativeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkspaceCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkspaceCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkspaceCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkspaceCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceRealTimeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceRealTimeStatisticsTest.java index c4bb6593b0..037577a78e 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceRealTimeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceRealTimeStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkspaceRealTimeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkspaceRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkspaceRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkspaceRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkspaceRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceStatisticsTest.java index 8442a71364..d1fa3b6f5d 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/WorkspaceStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkspaceStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkspaceStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkspaceStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkspaceStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkspaceStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/task/ReservationTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/task/ReservationTest.java index beb2926420..d8891f3db6 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/task/ReservationTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/task/ReservationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ReservationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); } @Test @@ -153,6 +151,6 @@ public void testUpdateSuperviseInstructionResponse() { result = new ObjectMapper(); }}; - Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueCumulativeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueCumulativeStatisticsTest.java index 9ecfd2562d..54658d035e 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueCumulativeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueCumulativeStatisticsTest.java @@ -31,9 +31,11 @@ public class TaskQueueCumulativeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - TaskQueueCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskQueueCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueueCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskQueueCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueRealTimeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueRealTimeStatisticsTest.java index 3dde299b72..fbf88aa75c 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueRealTimeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueRealTimeStatisticsTest.java @@ -31,9 +31,11 @@ public class TaskQueueRealTimeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - TaskQueueRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskQueueRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueueRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskQueueRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueStatisticsTest.java index 7067b3b328..98788546ae 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueueStatisticsTest.java @@ -31,9 +31,11 @@ public class TaskQueueStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - TaskQueueStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TaskQueueStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueueStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TaskQueueStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WQXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueuesStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueuesStatisticsTest.java index 993700d3cd..7a49091b58 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueuesStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/taskqueue/TaskQueuesStatisticsTest.java @@ -31,9 +31,11 @@ public class TaskQueuesStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - TaskQueuesStatistics.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TaskQueuesStatistics.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueuesStatistics.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TaskQueuesStatistics.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,6 +79,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TaskQueuesStatistics.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TaskQueuesStatistics.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/ReservationTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/ReservationTest.java index 70e2a1083b..0242711bfc 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/ReservationTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/ReservationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ReservationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Reservation.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Reservation.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +139,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(); + Reservation.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").setIfMatch("if_match").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerChannelTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerChannelTest.java index c5c6128fb0..be8744c8df 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerChannelTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerChannelTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class WorkerChannelTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - WorkerChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + WorkerChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkerChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(WorkerChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkerChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(WorkerChannel.reader("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - WorkerChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkerChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkerChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkerChannel.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - WorkerChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + WorkerChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +139,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - WorkerChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + WorkerChannel.updater("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerStatisticsTest.java index e644f877b1..4a104a73d5 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkerStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkerStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkerStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkerStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkerStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkerStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersCumulativeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersCumulativeStatisticsTest.java index 9edfb0f692..967e613a17 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersCumulativeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersCumulativeStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkersCumulativeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkersCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkersCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkersCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkersCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersRealTimeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersRealTimeStatisticsTest.java index 85c94e92db..cb707e5c65 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersRealTimeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersRealTimeStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkersRealTimeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkersRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkersRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkersRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkersRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersStatisticsTest.java index 67b154d3e8..6f04ab0b64 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/worker/WorkersStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkersStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkersStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkersStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkersStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkersStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowCumulativeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowCumulativeStatisticsTest.java index 7c8a6b0e67..9c67253018 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowCumulativeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowCumulativeStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkflowCumulativeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkflowCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkflowCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkflowCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkflowCumulativeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowRealTimeStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowRealTimeStatisticsTest.java index ccca777142..49811cac95 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowRealTimeStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowRealTimeStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkflowRealTimeStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkflowRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkflowRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkflowRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkflowRealTimeStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowStatisticsTest.java b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowStatisticsTest.java index 9b4f491ecd..c0f54d70c6 100644 --- a/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowStatisticsTest.java +++ b/src/test/java/com/twilio/rest/taskrouter/v1/workspace/workflow/WorkflowStatisticsTest.java @@ -31,9 +31,11 @@ public class WorkflowStatisticsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - WorkflowStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + WorkflowStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(WorkflowStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(WorkflowStatistics.fetcher("WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "WWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trunking/v1/TrunkTest.java b/src/test/java/com/twilio/rest/trunking/v1/TrunkTest.java index b50b140b2c..46059e022e 100644 --- a/src/test/java/com/twilio/rest/trunking/v1/TrunkTest.java +++ b/src/test/java/com/twilio/rest/trunking/v1/TrunkTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TrunkTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Trunk.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Trunk.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Trunk.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Trunk.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testDeleteRequest() { }}; try { - Trunk.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Trunk.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Trunk.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Trunk.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +113,7 @@ public void testCreateRequest() { }}; try { - Trunk.creator().create(); + Trunk.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Trunk.creator().create(); + Trunk.creator().create(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Trunk.reader().read(); + Trunk.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Trunk.reader().read()); + assertNotNull(Trunk.reader().read(tw)); } @Test @@ -173,7 +171,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Trunk.reader().read()); + assertNotNull(Trunk.reader().read(tw)); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - Trunk.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Trunk.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Trunk.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Trunk.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trunking/v1/trunk/CredentialListTest.java b/src/test/java/com/twilio/rest/trunking/v1/trunk/CredentialListTest.java index 2793662c4f..3ed0d49e4f 100644 --- a/src/test/java/com/twilio/rest/trunking/v1/trunk/CredentialListTest.java +++ b/src/test/java/com/twilio/rest/trunking/v1/trunk/CredentialListTest.java @@ -31,9 +31,11 @@ public class CredentialListTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - CredentialList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CredentialList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CredentialList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - CredentialList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CredentialList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CredentialList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CredentialList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - CredentialList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CredentialList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CredentialList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CredentialList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "CLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - CredentialList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + CredentialList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +163,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CredentialList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +175,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CredentialList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CredentialList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trunking/v1/trunk/IpAccessControlListTest.java b/src/test/java/com/twilio/rest/trunking/v1/trunk/IpAccessControlListTest.java index 82c447527a..e260eab9dc 100644 --- a/src/test/java/com/twilio/rest/trunking/v1/trunk/IpAccessControlListTest.java +++ b/src/test/java/com/twilio/rest/trunking/v1/trunk/IpAccessControlListTest.java @@ -31,9 +31,11 @@ public class IpAccessControlListTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - IpAccessControlList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IpAccessControlList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IpAccessControlList.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - IpAccessControlList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAccessControlList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - IpAccessControlList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpAccessControlList.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - IpAccessControlList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + IpAccessControlList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - IpAccessControlList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + IpAccessControlList.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ALXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - IpAccessControlList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + IpAccessControlList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +163,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAccessControlList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +175,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpAccessControlList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(IpAccessControlList.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trunking/v1/trunk/OriginationUrlTest.java b/src/test/java/com/twilio/rest/trunking/v1/trunk/OriginationUrlTest.java index a6b2ba5707..45477eeb9c 100644 --- a/src/test/java/com/twilio/rest/trunking/v1/trunk/OriginationUrlTest.java +++ b/src/test/java/com/twilio/rest/trunking/v1/trunk/OriginationUrlTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class OriginationUrlTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +51,7 @@ public void testFetchRequest() { }}; try { - OriginationUrl.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + OriginationUrl.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +65,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(OriginationUrl.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(OriginationUrl.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +83,7 @@ public void testDeleteRequest() { }}; try { - OriginationUrl.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + OriginationUrl.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +97,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - OriginationUrl.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + OriginationUrl.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -119,7 +119,7 @@ public void testCreateRequest() { }}; try { - OriginationUrl.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1, true, "friendly_name", URI.create("https://example.com")).create(); + OriginationUrl.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1, true, "friendly_name", URI.create("https://example.com")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -133,7 +133,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - OriginationUrl.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1, true, "friendly_name", URI.create("https://example.com")).create(); + OriginationUrl.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1, true, "friendly_name", URI.create("https://example.com")).create(tw); } @Test @@ -151,7 +151,7 @@ public void testReadRequest() { }}; try { - OriginationUrl.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + OriginationUrl.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -165,7 +165,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(OriginationUrl.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(OriginationUrl.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -177,7 +177,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(OriginationUrl.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(OriginationUrl.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -195,7 +195,7 @@ public void testUpdateRequest() { }}; try { - OriginationUrl.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + OriginationUrl.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -209,6 +209,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - OriginationUrl.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + OriginationUrl.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "OUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trunking/v1/trunk/PhoneNumberTest.java b/src/test/java/com/twilio/rest/trunking/v1/trunk/PhoneNumberTest.java index 656378e7a5..d59f5523ce 100644 --- a/src/test/java/com/twilio/rest/trunking/v1/trunk/PhoneNumberTest.java +++ b/src/test/java/com/twilio/rest/trunking/v1/trunk/PhoneNumberTest.java @@ -31,9 +31,11 @@ public class PhoneNumberTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - PhoneNumber.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PhoneNumber.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PhoneNumber.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - PhoneNumber.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PhoneNumber.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - PhoneNumber.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + PhoneNumber.deleter("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testCreateRequest() { }}; try { - PhoneNumber.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - PhoneNumber.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + PhoneNumber.creator("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - PhoneNumber.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + PhoneNumber.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +163,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(PhoneNumber.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +175,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(PhoneNumber.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(PhoneNumber.reader("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trunking/v1/trunk/RecordingTest.java b/src/test/java/com/twilio/rest/trunking/v1/trunk/RecordingTest.java index 982f8fbbbd..567a0029dd 100644 --- a/src/test/java/com/twilio/rest/trunking/v1/trunk/RecordingTest.java +++ b/src/test/java/com/twilio/rest/trunking/v1/trunk/RecordingTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RecordingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Recording.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Recording.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Recording.fetcher("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Recording.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Recording.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Recording.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Recording.updater("TKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/CustomerProfilesTest.java b/src/test/java/com/twilio/rest/trusthub/v1/CustomerProfilesTest.java index 724335ad27..401ae3281c 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/CustomerProfilesTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/CustomerProfilesTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CustomerProfilesTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +51,7 @@ public void testCreateRequest() { }}; try { - CustomerProfiles.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfiles.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +65,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CustomerProfiles.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfiles.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -85,7 +83,7 @@ public void testReadRequest() { }}; try { - CustomerProfiles.reader().read(); + CustomerProfiles.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +97,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfiles.reader().read()); + assertNotNull(CustomerProfiles.reader().read(tw)); } @Test @@ -111,7 +109,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfiles.reader().read()); + assertNotNull(CustomerProfiles.reader().read(tw)); } @Test @@ -129,7 +127,7 @@ public void testFetchRequest() { }}; try { - CustomerProfiles.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CustomerProfiles.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +141,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfiles.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CustomerProfiles.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - CustomerProfiles.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + CustomerProfiles.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,7 +173,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - CustomerProfiles.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + CustomerProfiles.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -193,7 +191,7 @@ public void testDeleteRequest() { }}; try { - CustomerProfiles.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CustomerProfiles.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +205,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CustomerProfiles.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CustomerProfiles.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/EndUserTest.java b/src/test/java/com/twilio/rest/trusthub/v1/EndUserTest.java index b0b323e330..2e29530931 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/EndUserTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/EndUserTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class EndUserTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - EndUser.creator("friendly_name", "type").create(); + EndUser.creator("friendly_name", "type").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - EndUser.creator("friendly_name", "type").create(); + EndUser.creator("friendly_name", "type").create(tw); } @Test @@ -84,7 +82,7 @@ public void testReadRequest() { }}; try { - EndUser.reader().read(); + EndUser.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUser.reader().read()); + assertNotNull(EndUser.reader().read(tw)); } @Test @@ -110,7 +108,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUser.reader().read()); + assertNotNull(EndUser.reader().read(tw)); } @Test @@ -128,7 +126,7 @@ public void testFetchRequest() { }}; try { - EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(EndUser.fetcher("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + EndUser.updater("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + EndUser.deleter("ITXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/EndUserTypeTest.java b/src/test/java/com/twilio/rest/trusthub/v1/EndUserTypeTest.java index d14432c0e3..9db3705ceb 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/EndUserTypeTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/EndUserTypeTest.java @@ -31,9 +31,11 @@ public class EndUserTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - EndUserType.reader().read(); + EndUserType.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUserType.reader().read()); + assertNotNull(EndUserType.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUserType.reader().read()); + assertNotNull(EndUserType.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(EndUserType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/PoliciesTest.java b/src/test/java/com/twilio/rest/trusthub/v1/PoliciesTest.java index 1cb812cc39..e54bdcee19 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/PoliciesTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/PoliciesTest.java @@ -31,9 +31,11 @@ public class PoliciesTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Policies.reader().read(); + Policies.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Policies.reader().read()); + assertNotNull(Policies.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Policies.reader().read()); + assertNotNull(Policies.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - Policies.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Policies.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Policies.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Policies.fetcher("RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTest.java b/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTest.java index 738403f589..0080a61b54 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SupportingDocumentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - SupportingDocument.creator("friendly_name", "type").create(); + SupportingDocument.creator("friendly_name", "type").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SupportingDocument.creator("friendly_name", "type").create(); + SupportingDocument.creator("friendly_name", "type").create(tw); } @Test @@ -84,7 +82,7 @@ public void testReadRequest() { }}; try { - SupportingDocument.reader().read(); + SupportingDocument.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocument.reader().read()); + assertNotNull(SupportingDocument.reader().read(tw)); } @Test @@ -110,7 +108,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocument.reader().read()); + assertNotNull(SupportingDocument.reader().read(tw)); } @Test @@ -128,7 +126,7 @@ public void testFetchRequest() { }}; try { - SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +140,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SupportingDocument.fetcher("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SupportingDocument.updater("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SupportingDocument.deleter("RDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTypeTest.java b/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTypeTest.java index 90d3500dc0..8be4a97d8f 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTypeTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/SupportingDocumentTypeTest.java @@ -31,9 +31,11 @@ public class SupportingDocumentTypeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - SupportingDocumentType.reader().read(); + SupportingDocumentType.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocumentType.reader().read()); + assertNotNull(SupportingDocumentType.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocumentType.reader().read()); + assertNotNull(SupportingDocumentType.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SupportingDocumentType.fetcher("OYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/TrustProductsTest.java b/src/test/java/com/twilio/rest/trusthub/v1/TrustProductsTest.java index fb70b46ca8..8c2718f636 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/TrustProductsTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/TrustProductsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class TrustProductsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +51,7 @@ public void testCreateRequest() { }}; try { - TrustProducts.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProducts.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +65,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TrustProducts.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProducts.creator("friendly_name", "email", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -85,7 +83,7 @@ public void testReadRequest() { }}; try { - TrustProducts.reader().read(); + TrustProducts.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +97,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProducts.reader().read()); + assertNotNull(TrustProducts.reader().read(tw)); } @Test @@ -111,7 +109,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProducts.reader().read()); + assertNotNull(TrustProducts.reader().read(tw)); } @Test @@ -129,7 +127,7 @@ public void testFetchRequest() { }}; try { - TrustProducts.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TrustProducts.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -143,7 +141,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProducts.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TrustProducts.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -161,7 +159,7 @@ public void testUpdateRequest() { }}; try { - TrustProducts.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TrustProducts.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -175,7 +173,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - TrustProducts.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + TrustProducts.updater("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -193,7 +191,7 @@ public void testDeleteRequest() { }}; try { - TrustProducts.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TrustProducts.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -207,6 +205,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - TrustProducts.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TrustProducts.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesChannelEndpointAssignmentTest.java b/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesChannelEndpointAssignmentTest.java index 4463116469..2eb61768c9 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesChannelEndpointAssignmentTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesChannelEndpointAssignmentTest.java @@ -31,9 +31,11 @@ public class CustomerProfilesChannelEndpointAssignmentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - CustomerProfilesChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfilesChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CustomerProfilesChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfilesChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -84,7 +86,7 @@ public void testReadRequest() { }}; try { - CustomerProfilesChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + CustomerProfilesChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +100,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CustomerProfilesChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -110,7 +112,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CustomerProfilesChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +130,7 @@ public void testFetchRequest() { }}; try { - CustomerProfilesChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CustomerProfilesChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CustomerProfilesChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +162,7 @@ public void testDeleteRequest() { }}; try { - CustomerProfilesChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CustomerProfilesChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,6 +176,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CustomerProfilesChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CustomerProfilesChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEntityAssignmentsTest.java b/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEntityAssignmentsTest.java index 5c7a7d3e77..3c31e257ff 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEntityAssignmentsTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEntityAssignmentsTest.java @@ -31,9 +31,11 @@ public class CustomerProfilesEntityAssignmentsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - CustomerProfilesEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfilesEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CustomerProfilesEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfilesEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - CustomerProfilesEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + CustomerProfilesEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CustomerProfilesEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CustomerProfilesEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - CustomerProfilesEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CustomerProfilesEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CustomerProfilesEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - CustomerProfilesEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CustomerProfilesEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CustomerProfilesEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CustomerProfilesEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEvaluationsTest.java b/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEvaluationsTest.java index 79316f3ace..9fe7ca5978 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEvaluationsTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/customerprofiles/CustomerProfilesEvaluationsTest.java @@ -31,9 +31,11 @@ public class CustomerProfilesEvaluationsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - CustomerProfilesEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfilesEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CustomerProfilesEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + CustomerProfilesEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - CustomerProfilesEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + CustomerProfilesEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CustomerProfilesEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(CustomerProfilesEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - CustomerProfilesEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CustomerProfilesEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CustomerProfilesEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CustomerProfilesEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsChannelEndpointAssignmentTest.java b/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsChannelEndpointAssignmentTest.java index 1f53a3ba8c..90c693685b 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsChannelEndpointAssignmentTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsChannelEndpointAssignmentTest.java @@ -31,9 +31,11 @@ public class TrustProductsChannelEndpointAssignmentTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - TrustProductsChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProductsChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TrustProductsChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProductsChannelEndpointAssignment.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "channel_endpoint_type", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -84,7 +86,7 @@ public void testReadRequest() { }}; try { - TrustProductsChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TrustProductsChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +100,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TrustProductsChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -110,7 +112,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TrustProductsChannelEndpointAssignment.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -128,7 +130,7 @@ public void testFetchRequest() { }}; try { - TrustProductsChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TrustProductsChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -142,7 +144,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TrustProductsChannelEndpointAssignment.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -160,7 +162,7 @@ public void testDeleteRequest() { }}; try { - TrustProductsChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TrustProductsChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,6 +176,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - TrustProductsChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TrustProductsChannelEndpointAssignment.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEntityAssignmentsTest.java b/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEntityAssignmentsTest.java index 5e9cbd5204..7751e781fb 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEntityAssignmentsTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEntityAssignmentsTest.java @@ -31,9 +31,11 @@ public class TrustProductsEntityAssignmentsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - TrustProductsEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProductsEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TrustProductsEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProductsEntityAssignments.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - TrustProductsEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TrustProductsEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TrustProductsEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TrustProductsEntityAssignments.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - TrustProductsEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TrustProductsEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +143,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TrustProductsEntityAssignments.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -159,7 +161,7 @@ public void testDeleteRequest() { }}; try { - TrustProductsEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TrustProductsEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,6 +175,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - TrustProductsEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + TrustProductsEntityAssignments.deleter("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEvaluationsTest.java b/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEvaluationsTest.java index 6e7cf52609..4cbcf8707c 100644 --- a/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEvaluationsTest.java +++ b/src/test/java/com/twilio/rest/trusthub/v1/trustproducts/TrustProductsEvaluationsTest.java @@ -31,9 +31,11 @@ public class TrustProductsEvaluationsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - TrustProductsEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProductsEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - TrustProductsEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + TrustProductsEvaluations.creator("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - TrustProductsEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + TrustProductsEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TrustProductsEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(TrustProductsEvaluations.reader("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testFetchRequest() { }}; try { - TrustProductsEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + TrustProductsEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(TrustProductsEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(TrustProductsEvaluations.fetcher("BUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "ELXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/FormTest.java b/src/test/java/com/twilio/rest/verify/v2/FormTest.java index 15b2741d1f..e9eea3a8e7 100644 --- a/src/test/java/com/twilio/rest/verify/v2/FormTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/FormTest.java @@ -31,9 +31,11 @@ public class FormTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Form.fetcher(Form.FormTypes.FORM_PUSH).fetch(); + Form.fetcher(Form.FormTypes.FORM_PUSH).fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Form.fetcher(Form.FormTypes.FORM_PUSH).fetch()); + assertNotNull(Form.fetcher(Form.FormTypes.FORM_PUSH).fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/ServiceTest.java b/src/test/java/com/twilio/rest/verify/v2/ServiceTest.java index 7ee28ded08..82aaf18b8b 100644 --- a/src/test/java/com/twilio/rest/verify/v2/ServiceTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/ServiceTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ServiceTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateRecordResponse() { result = new ObjectMapper(); }}; - Service.creator("friendly_name").create(); + Service.creator("friendly_name").create(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Service.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Service.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchRecordResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Service.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testDeleteRequest() { }}; try { - Service.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Service.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Service.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - Service.reader().read(); + Service.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadAllResponse() { result = new ObjectMapper(); }}; - assertNotNull(Service.reader().read()); + assertNotNull(Service.reader().read(tw)); } @Test @@ -179,7 +177,7 @@ public void testUpdateRequest() { }}; try { - Service.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testUpdateRecordResponse() { result = new ObjectMapper(); }}; - Service.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Service.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/TemplateTest.java b/src/test/java/com/twilio/rest/verify/v2/TemplateTest.java index 10ab5d860f..b0656d8208 100644 --- a/src/test/java/com/twilio/rest/verify/v2/TemplateTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/TemplateTest.java @@ -31,9 +31,11 @@ public class TemplateTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - Template.reader().read(); + Template.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testListVerificationTemplatesResponse() { result = new ObjectMapper(); }}; - assertNotNull(Template.reader().read()); + assertNotNull(Template.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/VerificationAttemptTest.java b/src/test/java/com/twilio/rest/verify/v2/VerificationAttemptTest.java index 19af70d7ba..0ac47d9ce3 100644 --- a/src/test/java/com/twilio/rest/verify/v2/VerificationAttemptTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/VerificationAttemptTest.java @@ -31,9 +31,11 @@ public class VerificationAttemptTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - VerificationAttempt.reader().read(); + VerificationAttempt.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testListVerificationAttemptsEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(VerificationAttempt.reader().read()); + assertNotNull(VerificationAttempt.reader().read(tw)); } @Test @@ -77,7 +79,7 @@ public void testListVerificationAttemptsResponse() { result = new ObjectMapper(); }}; - assertNotNull(VerificationAttempt.reader().read()); + assertNotNull(VerificationAttempt.reader().read(tw)); } @Test @@ -95,7 +97,7 @@ public void testFetchRequest() { }}; try { - VerificationAttempt.fetcher("VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + VerificationAttempt.fetcher("VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,6 +111,6 @@ public void testFetchVerificationAttemptResponse() { result = new ObjectMapper(); }}; - assertNotNull(VerificationAttempt.fetcher("VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(VerificationAttempt.fetcher("VLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/AccessTokenTest.java b/src/test/java/com/twilio/rest/verify/v2/service/AccessTokenTest.java index 1071258e21..bf01523fe2 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/AccessTokenTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/AccessTokenTest.java @@ -31,9 +31,11 @@ public class AccessTokenTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - AccessToken.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", AccessToken.FactorTypes.PUSH).create(); + AccessToken.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", AccessToken.FactorTypes.PUSH).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreateWithTtlResponse() { result = new ObjectMapper(); }}; - AccessToken.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", AccessToken.FactorTypes.PUSH).create(); + AccessToken.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", AccessToken.FactorTypes.PUSH).create(tw); } @Test @@ -78,7 +80,7 @@ public void testCreateWithoutTtlResponse() { result = new ObjectMapper(); }}; - AccessToken.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", AccessToken.FactorTypes.PUSH).create(); + AccessToken.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", AccessToken.FactorTypes.PUSH).create(tw); } @Test @@ -96,7 +98,7 @@ public void testFetchRequest() { }}; try { - AccessToken.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + AccessToken.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -110,6 +112,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(AccessToken.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(AccessToken.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/EntityTest.java b/src/test/java/com/twilio/rest/verify/v2/service/EntityTest.java index 0de18d0fee..c06f1fc552 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/EntityTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/EntityTest.java @@ -31,9 +31,11 @@ public class EntityTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Entity.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Entity.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Entity.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(); + Entity.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").create(tw); } @Test @@ -83,7 +85,7 @@ public void testDeleteRequest() { }}; try { - Entity.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + Entity.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Entity.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(); + Entity.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").delete(tw); } @Test @@ -115,7 +117,7 @@ public void testFetchRequest() { }}; try { - Entity.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(); + Entity.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +131,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Entity.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch()); + assertNotNull(Entity.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").fetch(tw)); } @Test @@ -147,7 +149,7 @@ public void testReadRequest() { }}; try { - Entity.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Entity.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +163,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Entity.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Entity.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -173,6 +175,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Entity.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Entity.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/MessagingConfigurationTest.java b/src/test/java/com/twilio/rest/verify/v2/service/MessagingConfigurationTest.java index 959ef9310b..77fe7884b4 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/MessagingConfigurationTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/MessagingConfigurationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class MessagingConfigurationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - MessagingConfiguration.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + MessagingConfiguration.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - MessagingConfiguration.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + MessagingConfiguration.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -84,7 +82,7 @@ public void testUpdateRequest() { }}; try { - MessagingConfiguration.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + MessagingConfiguration.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - MessagingConfiguration.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + MessagingConfiguration.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country", "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -116,7 +114,7 @@ public void testFetchRequest() { }}; try { - MessagingConfiguration.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").fetch(); + MessagingConfiguration.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(MessagingConfiguration.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").fetch()); + assertNotNull(MessagingConfiguration.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").fetch(tw)); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - MessagingConfiguration.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + MessagingConfiguration.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(MessagingConfiguration.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(MessagingConfiguration.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(MessagingConfiguration.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(MessagingConfiguration.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - MessagingConfiguration.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").delete(); + MessagingConfiguration.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - MessagingConfiguration.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").delete(); + MessagingConfiguration.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "country").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/RateLimitTest.java b/src/test/java/com/twilio/rest/verify/v2/service/RateLimitTest.java index b183e9c257..876401fff3 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/RateLimitTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/RateLimitTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RateLimitTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - RateLimit.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + RateLimit.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateRateLimitResponse() { result = new ObjectMapper(); }}; - RateLimit.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(); + RateLimit.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "unique_name").create(tw); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - RateLimit.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RateLimit.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testUpdateRateLimitResponse() { result = new ObjectMapper(); }}; - RateLimit.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RateLimit.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -115,7 +113,7 @@ public void testFetchRequest() { }}; try { - RateLimit.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + RateLimit.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testFetchRateLimitResponse() { result = new ObjectMapper(); }}; - assertNotNull(RateLimit.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(RateLimit.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -147,7 +145,7 @@ public void testReadRequest() { }}; try { - RateLimit.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + RateLimit.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -161,7 +159,7 @@ public void testReadAllResponse() { result = new ObjectMapper(); }}; - assertNotNull(RateLimit.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(RateLimit.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -179,7 +177,7 @@ public void testDeleteRequest() { }}; try { - RateLimit.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RateLimit.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -193,6 +191,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - RateLimit.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RateLimit.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/VerificationCheckTest.java b/src/test/java/com/twilio/rest/verify/v2/service/VerificationCheckTest.java index 7ce5c7a141..2caf2c1b31 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/VerificationCheckTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/VerificationCheckTest.java @@ -31,9 +31,11 @@ public class VerificationCheckTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - VerificationCheck.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "code").create(); + VerificationCheck.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "code").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testVerificationChecksResponse() { result = new ObjectMapper(); }}; - VerificationCheck.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "code").create(); + VerificationCheck.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "code").create(tw); } @Test @@ -77,6 +79,6 @@ public void testEmailVerificationChecksResponse() { result = new ObjectMapper(); }}; - VerificationCheck.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "code").create(); + VerificationCheck.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "code").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/VerificationTest.java b/src/test/java/com/twilio/rest/verify/v2/service/VerificationTest.java index a077c851c9..cf48225e91 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/VerificationTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/VerificationTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class VerificationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(); + Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateVerificationResponse() { result = new ObjectMapper(); }}; - Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(); + Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(tw); } @Test @@ -78,7 +76,7 @@ public void testCreateVerificationWhatsappResponse() { result = new ObjectMapper(); }}; - Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(); + Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(tw); } @Test @@ -90,7 +88,7 @@ public void testCreateVerificationEmailResponse() { result = new ObjectMapper(); }}; - Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(); + Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(tw); } @Test @@ -102,7 +100,7 @@ public void testCreateVerificationWithRateLimitsResponse() { result = new ObjectMapper(); }}; - Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(); + Verification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "to", "channel").create(tw); } @Test @@ -120,7 +118,7 @@ public void testUpdateRequest() { }}; try { - Verification.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid", Verification.Status.CANCELED).update(); + Verification.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid", Verification.Status.CANCELED).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -134,7 +132,7 @@ public void testUpdateVerificationResponse() { result = new ObjectMapper(); }}; - Verification.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid", Verification.Status.CANCELED).update(); + Verification.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid", Verification.Status.CANCELED).update(tw); } @Test @@ -146,7 +144,7 @@ public void testApproveVerificationWithPnResponse() { result = new ObjectMapper(); }}; - Verification.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid", Verification.Status.CANCELED).update(); + Verification.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid", Verification.Status.CANCELED).update(tw); } @Test @@ -164,7 +162,7 @@ public void testFetchRequest() { }}; try { - Verification.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid").fetch(); + Verification.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -178,6 +176,6 @@ public void testFetchVerificationResponse() { result = new ObjectMapper(); }}; - assertNotNull(Verification.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid").fetch()); + assertNotNull(Verification.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "sid").fetch(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/WebhookTest.java b/src/test/java/com/twilio/rest/verify/v2/service/WebhookTest.java index b5f191cc30..4274d7ffce 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/WebhookTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/WebhookTest.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; @@ -22,8 +21,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +28,11 @@ public class WebhookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -53,7 +52,7 @@ public void testCreateRequest() { }}; try { - Webhook.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Promoter.listOfOne("event_types"), "webhook_url").create(); + Webhook.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Promoter.listOfOne("event_types"), "webhook_url").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -67,7 +66,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Webhook.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Promoter.listOfOne("event_types"), "webhook_url").create(); + Webhook.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name", Promoter.listOfOne("event_types"), "webhook_url").create(tw); } @Test @@ -85,7 +84,7 @@ public void testUpdateRequest() { }}; try { - Webhook.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -99,7 +98,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Webhook.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Webhook.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -117,7 +116,7 @@ public void testDeleteRequest() { }}; try { - Webhook.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -131,7 +130,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Webhook.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Webhook.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -149,7 +148,7 @@ public void testFetchRequest() { }}; try { - Webhook.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Webhook.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -163,7 +162,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Webhook.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "YWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -181,7 +180,7 @@ public void testReadRequest() { }}; try { - Webhook.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Webhook.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -195,7 +194,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -207,6 +206,6 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Webhook.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Webhook.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/entity/ChallengeTest.java b/src/test/java/com/twilio/rest/verify/v2/service/entity/ChallengeTest.java index a587b1cf57..818efb85a1 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/entity/ChallengeTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/entity/ChallengeTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ChallengeTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreatePushWithoutAuthPayloadResponse() { result = new ObjectMapper(); }}; - Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -77,7 +75,7 @@ public void testCreateTotpWithoutAuthPayloadResponse() { result = new ObjectMapper(); }}; - Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -89,7 +87,7 @@ public void testCreateTotpWithAuthPayloadResponse() { result = new ObjectMapper(); }}; - Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Challenge.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -107,7 +105,7 @@ public void testFetchRequest() { }}; try { - Challenge.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Challenge.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -121,7 +119,7 @@ public void testFetchSidResponse() { result = new ObjectMapper(); }}; - assertNotNull(Challenge.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Challenge.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -139,7 +137,7 @@ public void testReadRequest() { }}; try { - Challenge.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(); + Challenge.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -153,7 +151,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Challenge.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read()); + assertNotNull(Challenge.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw)); } @Test @@ -165,7 +163,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Challenge.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read()); + assertNotNull(Challenge.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw)); } @Test @@ -183,7 +181,7 @@ public void testUpdateRequest() { }}; try { - Challenge.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Challenge.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -197,7 +195,7 @@ public void testVerifyPushResponse() { result = new ObjectMapper(); }}; - Challenge.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Challenge.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -209,6 +207,6 @@ public void testVerifyTotpResponse() { result = new ObjectMapper(); }}; - Challenge.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Challenge.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/entity/FactorTest.java b/src/test/java/com/twilio/rest/verify/v2/service/entity/FactorTest.java index d2f8694a0a..c199d6238c 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/entity/FactorTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/entity/FactorTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class FactorTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testDeleteRequest() { }}; try { - Factor.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Factor.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Factor.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Factor.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - Factor.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Factor.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchPushResponse() { result = new ObjectMapper(); }}; - assertNotNull(Factor.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Factor.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -109,7 +107,7 @@ public void testFetchTotpResponse() { result = new ObjectMapper(); }}; - assertNotNull(Factor.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Factor.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testReadRequest() { }}; try { - Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(); + Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read()); + assertNotNull(Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw)); } @Test @@ -153,7 +151,7 @@ public void testReadFullPushResponse() { result = new ObjectMapper(); }}; - assertNotNull(Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read()); + assertNotNull(Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw)); } @Test @@ -165,7 +163,7 @@ public void testReadFullTotpResponse() { result = new ObjectMapper(); }}; - assertNotNull(Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read()); + assertNotNull(Factor.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity").read(tw)); } @Test @@ -183,7 +181,7 @@ public void testUpdateRequest() { }}; try { - Factor.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Factor.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -197,7 +195,7 @@ public void testVerifyPushResponse() { result = new ObjectMapper(); }}; - Factor.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Factor.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -209,6 +207,6 @@ public void testVerifyTotpResponse() { result = new ObjectMapper(); }}; - Factor.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Factor.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/entity/NewFactorTest.java b/src/test/java/com/twilio/rest/verify/v2/service/entity/NewFactorTest.java index 4b89179ccd..0e740e02e4 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/entity/NewFactorTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/entity/NewFactorTest.java @@ -31,9 +31,11 @@ public class NewFactorTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +54,7 @@ public void testCreateRequest() { }}; try { - NewFactor.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "friendly_name", NewFactor.FactorTypes.PUSH).create(); + NewFactor.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "friendly_name", NewFactor.FactorTypes.PUSH).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +68,7 @@ public void testCreatePushResponse() { result = new ObjectMapper(); }}; - NewFactor.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "friendly_name", NewFactor.FactorTypes.PUSH).create(); + NewFactor.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "friendly_name", NewFactor.FactorTypes.PUSH).create(tw); } @Test @@ -78,6 +80,6 @@ public void testCreateTotpResponse() { result = new ObjectMapper(); }}; - NewFactor.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "friendly_name", NewFactor.FactorTypes.PUSH).create(); + NewFactor.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "friendly_name", NewFactor.FactorTypes.PUSH).create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/entity/challenge/NotificationTest.java b/src/test/java/com/twilio/rest/verify/v2/service/entity/challenge/NotificationTest.java index 0681796dbf..5934c3cb37 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/entity/challenge/NotificationTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/entity/challenge/NotificationTest.java @@ -31,9 +31,11 @@ public class NotificationTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - Notification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Notification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testCreateWithTtlResponse() { result = new ObjectMapper(); }}; - Notification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Notification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -77,6 +79,6 @@ public void testCreateWithoutTtlResponse() { result = new ObjectMapper(); }}; - Notification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Notification.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "identity", "YCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/verify/v2/service/ratelimit/BucketTest.java b/src/test/java/com/twilio/rest/verify/v2/service/ratelimit/BucketTest.java index 920236a875..d2c13edd28 100644 --- a/src/test/java/com/twilio/rest/verify/v2/service/ratelimit/BucketTest.java +++ b/src/test/java/com/twilio/rest/verify/v2/service/ratelimit/BucketTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class BucketTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - Bucket.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1).create(); + Bucket.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateBucketResponse() { result = new ObjectMapper(); }}; - Bucket.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1).create(); + Bucket.creator("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 1, 1).create(tw); } @Test @@ -84,7 +82,7 @@ public void testUpdateRequest() { }}; try { - Bucket.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Bucket.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testUpdateBucketResponse() { result = new ObjectMapper(); }}; - Bucket.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Bucket.updater("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -116,7 +114,7 @@ public void testFetchRequest() { }}; try { - Bucket.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Bucket.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testFetchBucketResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bucket.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Bucket.fetcher("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -148,7 +146,7 @@ public void testReadRequest() { }}; try { - Bucket.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Bucket.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -162,7 +160,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bucket.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Bucket.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -174,7 +172,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Bucket.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Bucket.reader("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - Bucket.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Bucket.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Bucket.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Bucket.deleter("VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/CompositionHookTest.java b/src/test/java/com/twilio/rest/video/v1/CompositionHookTest.java index ef8e658683..421fc4021b 100644 --- a/src/test/java/com/twilio/rest/video/v1/CompositionHookTest.java +++ b/src/test/java/com/twilio/rest/video/v1/CompositionHookTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class CompositionHookTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - CompositionHook.fetcher("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + CompositionHook.fetcher("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CompositionHook.fetcher("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(CompositionHook.fetcher("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - CompositionHook.reader().read(); + CompositionHook.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(CompositionHook.reader().read()); + assertNotNull(CompositionHook.reader().read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(CompositionHook.reader().read()); + assertNotNull(CompositionHook.reader().read(tw)); } @Test @@ -127,7 +125,7 @@ public void testDeleteRequest() { }}; try { - CompositionHook.deleter("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CompositionHook.deleter("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - CompositionHook.deleter("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + CompositionHook.deleter("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -159,7 +157,7 @@ public void testCreateRequest() { }}; try { - CompositionHook.creator("friendly_name").create(); + CompositionHook.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CompositionHook.creator("friendly_name").create(); + CompositionHook.creator("friendly_name").create(tw); } @Test @@ -191,7 +189,7 @@ public void testUpdateRequest() { }}; try { - CompositionHook.updater("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + CompositionHook.updater("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,7 +203,7 @@ public void testUpdateAllFieldsResponse() { result = new ObjectMapper(); }}; - CompositionHook.updater("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + CompositionHook.updater("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); } @Test @@ -217,6 +215,6 @@ public void testUpdateWithDefaultsResponse() { result = new ObjectMapper(); }}; - CompositionHook.updater("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(); + CompositionHook.updater("HKXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "friendly_name").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/CompositionSettingsTest.java b/src/test/java/com/twilio/rest/video/v1/CompositionSettingsTest.java index 8b3c673dce..9603e97fb5 100644 --- a/src/test/java/com/twilio/rest/video/v1/CompositionSettingsTest.java +++ b/src/test/java/com/twilio/rest/video/v1/CompositionSettingsTest.java @@ -31,9 +31,11 @@ public class CompositionSettingsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - CompositionSettings.fetcher().fetch(); + CompositionSettings.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(CompositionSettings.fetcher().fetch()); + assertNotNull(CompositionSettings.fetcher().fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - CompositionSettings.creator("friendly_name").create(); + CompositionSettings.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - CompositionSettings.creator("friendly_name").create(); + CompositionSettings.creator("friendly_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/CompositionTest.java b/src/test/java/com/twilio/rest/video/v1/CompositionTest.java index a6827c30d0..a2d7fc2f64 100644 --- a/src/test/java/com/twilio/rest/video/v1/CompositionTest.java +++ b/src/test/java/com/twilio/rest/video/v1/CompositionTest.java @@ -31,9 +31,11 @@ public class CompositionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Composition.fetcher("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Composition.fetcher("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Composition.fetcher("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Composition.fetcher("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Composition.reader().read(); + Composition.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEnqueuedResponse() { result = new ObjectMapper(); }}; - assertNotNull(Composition.reader().read()); + assertNotNull(Composition.reader().read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Composition.reader().read()); + assertNotNull(Composition.reader().read(tw)); } @Test @@ -121,7 +123,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Composition.reader().read()); + assertNotNull(Composition.reader().read(tw)); } @Test @@ -139,7 +141,7 @@ public void testDeleteRequest() { }}; try { - Composition.deleter("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Composition.deleter("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -153,7 +155,7 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Composition.deleter("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Composition.deleter("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } @Test @@ -171,7 +173,7 @@ public void testCreateRequest() { }}; try { - Composition.creator("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Composition.creator("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -185,6 +187,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Composition.creator("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + Composition.creator("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/RecordingSettingsTest.java b/src/test/java/com/twilio/rest/video/v1/RecordingSettingsTest.java index e8f530440d..c3d1589564 100644 --- a/src/test/java/com/twilio/rest/video/v1/RecordingSettingsTest.java +++ b/src/test/java/com/twilio/rest/video/v1/RecordingSettingsTest.java @@ -31,9 +31,11 @@ public class RecordingSettingsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - RecordingSettings.fetcher().fetch(); + RecordingSettings.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(RecordingSettings.fetcher().fetch()); + assertNotNull(RecordingSettings.fetcher().fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testCreateRequest() { }}; try { - RecordingSettings.creator("friendly_name").create(); + RecordingSettings.creator("friendly_name").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - RecordingSettings.creator("friendly_name").create(); + RecordingSettings.creator("friendly_name").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/RecordingTest.java b/src/test/java/com/twilio/rest/video/v1/RecordingTest.java index 484b0d8b13..b24a6ec1d7 100644 --- a/src/test/java/com/twilio/rest/video/v1/RecordingTest.java +++ b/src/test/java/com/twilio/rest/video/v1/RecordingTest.java @@ -31,9 +31,11 @@ public class RecordingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Recording.fetcher("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Recording.fetcher("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.fetcher("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Recording.fetcher("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Recording.reader().read(); + Recording.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader().read()); + assertNotNull(Recording.reader().read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Recording.reader().read()); + assertNotNull(Recording.reader().read(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - Recording.deleter("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Recording.deleter("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Recording.deleter("RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/RoomTest.java b/src/test/java/com/twilio/rest/video/v1/RoomTest.java index 787a0a5e51..abddc5d8e5 100644 --- a/src/test/java/com/twilio/rest/video/v1/RoomTest.java +++ b/src/test/java/com/twilio/rest/video/v1/RoomTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RoomTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Room.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testCreateRequest() { }}; try { - Room.creator().create(); + Room.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -109,7 +107,7 @@ public void testCreateWebrtcGoResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -121,7 +119,7 @@ public void testCreateGroupRoomsResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -133,7 +131,7 @@ public void testCreateGroupRoomsWithAudioOnlyEnabledResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -145,7 +143,7 @@ public void testCreateSmallGroupRoomsResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -157,7 +155,7 @@ public void testCreateLargeGroupRoomsResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -169,7 +167,7 @@ public void testCreateLargeGroupRoomsWithAudioOnlyEnabledResponse() { result = new ObjectMapper(); }}; - Room.creator().create(); + Room.creator().create(tw); } @Test @@ -187,7 +185,7 @@ public void testReadRequest() { }}; try { - Room.reader().read(); + Room.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -201,7 +199,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Room.reader().read()); + assertNotNull(Room.reader().read(tw)); } @Test @@ -213,7 +211,7 @@ public void testReadWithStatusResponse() { result = new ObjectMapper(); }}; - assertNotNull(Room.reader().read()); + assertNotNull(Room.reader().read(tw)); } @Test @@ -231,7 +229,7 @@ public void testUpdateRequest() { }}; try { - Room.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Room.RoomStatus.IN_PROGRESS).update(); + Room.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Room.RoomStatus.IN_PROGRESS).update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -245,6 +243,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Room.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Room.RoomStatus.IN_PROGRESS).update(); + Room.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Room.RoomStatus.IN_PROGRESS).update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/room/ParticipantTest.java b/src/test/java/com/twilio/rest/video/v1/room/ParticipantTest.java index c078eb2734..9b6f851adc 100644 --- a/src/test/java/com/twilio/rest/video/v1/room/ParticipantTest.java +++ b/src/test/java/com/twilio/rest/video/v1/room/ParticipantTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ParticipantTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Participant.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFiltersResponse() { result = new ObjectMapper(); }}; - assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(Participant.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - Participant.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +139,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Participant.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Participant.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/room/RecordingRulesTest.java b/src/test/java/com/twilio/rest/video/v1/room/RecordingRulesTest.java index da8fb477f8..152771bc4f 100644 --- a/src/test/java/com/twilio/rest/video/v1/room/RecordingRulesTest.java +++ b/src/test/java/com/twilio/rest/video/v1/room/RecordingRulesTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RecordingRulesTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - RecordingRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + RecordingRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(RecordingRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(RecordingRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - RecordingRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RecordingRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - RecordingRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RecordingRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/room/RoomRecordingTest.java b/src/test/java/com/twilio/rest/video/v1/room/RoomRecordingTest.java index d28658ba2a..adcc6249df 100644 --- a/src/test/java/com/twilio/rest/video/v1/room/RoomRecordingTest.java +++ b/src/test/java/com/twilio/rest/video/v1/room/RoomRecordingTest.java @@ -31,9 +31,11 @@ public class RoomRecordingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - RoomRecording.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + RoomRecording.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(RoomRecording.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(RoomRecording.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - RoomRecording.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + RoomRecording.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +99,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(RoomRecording.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(RoomRecording.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -109,7 +111,7 @@ public void testReadResultsResponse() { result = new ObjectMapper(); }}; - assertNotNull(RoomRecording.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(RoomRecording.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -127,7 +129,7 @@ public void testDeleteRequest() { }}; try { - RoomRecording.deleter("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RoomRecording.deleter("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,6 +143,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - RoomRecording.deleter("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RoomRecording.deleter("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "RTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/room/participant/PublishedTrackTest.java b/src/test/java/com/twilio/rest/video/v1/room/participant/PublishedTrackTest.java index 3b764ec1e8..c845a08587 100644 --- a/src/test/java/com/twilio/rest/video/v1/room/participant/PublishedTrackTest.java +++ b/src/test/java/com/twilio/rest/video/v1/room/participant/PublishedTrackTest.java @@ -31,9 +31,11 @@ public class PublishedTrackTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - PublishedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + PublishedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(PublishedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(PublishedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - PublishedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + PublishedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(PublishedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(PublishedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesTest.java b/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesTest.java index 779d2a733e..d720f376cb 100644 --- a/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesTest.java +++ b/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribeRulesTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SubscribeRulesTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - SubscribeRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SubscribeRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SubscribeRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SubscribeRules.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - SubscribeRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SubscribeRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateFiltersResponse() { result = new ObjectMapper(); }}; - SubscribeRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SubscribeRules.updater("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribedTrackTest.java b/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribedTrackTest.java index 59b85ffd27..9a36c2f05f 100644 --- a/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribedTrackTest.java +++ b/src/test/java/com/twilio/rest/video/v1/room/participant/SubscribedTrackTest.java @@ -31,9 +31,11 @@ public class SubscribedTrackTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - SubscribedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SubscribedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SubscribedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SubscribedTrack.fetcher("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "MTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - SubscribedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + SubscribedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SubscribedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(SubscribedTrack.reader("RMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "PAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/ArchivedCallTest.java b/src/test/java/com/twilio/rest/voice/v1/ArchivedCallTest.java index 0c80f26304..e715cf3211 100644 --- a/src/test/java/com/twilio/rest/voice/v1/ArchivedCallTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/ArchivedCallTest.java @@ -31,9 +31,11 @@ public class ArchivedCallTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testDeleteRequest() { }}; try { - ArchivedCall.deleter(DateConverter.localDateFromString("2008-01-02"), "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ArchivedCall.deleter(DateConverter.localDateFromString("2008-01-02"), "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ArchivedCall.deleter(DateConverter.localDateFromString("2008-01-02"), "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ArchivedCall.deleter(DateConverter.localDateFromString("2008-01-02"), "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/ByocTrunkTest.java b/src/test/java/com/twilio/rest/voice/v1/ByocTrunkTest.java index 50e27e2fdc..81f3660c65 100644 --- a/src/test/java/com/twilio/rest/voice/v1/ByocTrunkTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/ByocTrunkTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ByocTrunkTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - ByocTrunk.creator().create(); + ByocTrunk.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ByocTrunk.creator().create(); + ByocTrunk.creator().create(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - ByocTrunk.fetcher("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ByocTrunk.fetcher("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ByocTrunk.fetcher("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ByocTrunk.fetcher("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - ByocTrunk.reader().read(); + ByocTrunk.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ByocTrunk.reader().read()); + assertNotNull(ByocTrunk.reader().read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ByocTrunk.reader().read()); + assertNotNull(ByocTrunk.reader().read(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - ByocTrunk.updater("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ByocTrunk.updater("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ByocTrunk.updater("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ByocTrunk.updater("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - ByocTrunk.deleter("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ByocTrunk.deleter("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ByocTrunk.deleter("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ByocTrunk.deleter("BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/ConnectionPolicyTest.java b/src/test/java/com/twilio/rest/voice/v1/ConnectionPolicyTest.java index 90b9eb6695..899e97330d 100644 --- a/src/test/java/com/twilio/rest/voice/v1/ConnectionPolicyTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/ConnectionPolicyTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class ConnectionPolicyTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - ConnectionPolicy.creator().create(); + ConnectionPolicy.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ConnectionPolicy.creator().create(); + ConnectionPolicy.creator().create(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - ConnectionPolicy.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ConnectionPolicy.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectionPolicy.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ConnectionPolicy.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - ConnectionPolicy.reader().read(); + ConnectionPolicy.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectionPolicy.reader().read()); + assertNotNull(ConnectionPolicy.reader().read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectionPolicy.reader().read()); + assertNotNull(ConnectionPolicy.reader().read(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - ConnectionPolicy.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ConnectionPolicy.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ConnectionPolicy.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ConnectionPolicy.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - ConnectionPolicy.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ConnectionPolicy.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ConnectionPolicy.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ConnectionPolicy.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/IpRecordTest.java b/src/test/java/com/twilio/rest/voice/v1/IpRecordTest.java index fbebf4e93a..3b60626012 100644 --- a/src/test/java/com/twilio/rest/voice/v1/IpRecordTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/IpRecordTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class IpRecordTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testCreateRequest() { }}; try { - IpRecord.creator("ip_address").create(); + IpRecord.creator("ip_address").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - IpRecord.creator("ip_address").create(); + IpRecord.creator("ip_address").create(tw); } @Test @@ -83,7 +81,7 @@ public void testFetchRequest() { }}; try { - IpRecord.fetcher("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + IpRecord.fetcher("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpRecord.fetcher("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(IpRecord.fetcher("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +113,7 @@ public void testReadRequest() { }}; try { - IpRecord.reader().read(); + IpRecord.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +127,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpRecord.reader().read()); + assertNotNull(IpRecord.reader().read(tw)); } @Test @@ -141,7 +139,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(IpRecord.reader().read()); + assertNotNull(IpRecord.reader().read(tw)); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - IpRecord.updater("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + IpRecord.updater("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - IpRecord.updater("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + IpRecord.updater("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - IpRecord.deleter("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpRecord.deleter("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - IpRecord.deleter("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + IpRecord.deleter("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/SourceIpMappingTest.java b/src/test/java/com/twilio/rest/voice/v1/SourceIpMappingTest.java index 95178a74d5..d59646f6ef 100644 --- a/src/test/java/com/twilio/rest/voice/v1/SourceIpMappingTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/SourceIpMappingTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SourceIpMappingTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -52,7 +50,7 @@ public void testCreateRequest() { }}; try { - SourceIpMapping.creator("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SourceIpMapping.creator("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -66,7 +64,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - SourceIpMapping.creator("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(); + SourceIpMapping.creator("ILXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").create(tw); } @Test @@ -84,7 +82,7 @@ public void testFetchRequest() { }}; try { - SourceIpMapping.fetcher("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + SourceIpMapping.fetcher("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -98,7 +96,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(SourceIpMapping.fetcher("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(SourceIpMapping.fetcher("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -116,7 +114,7 @@ public void testReadRequest() { }}; try { - SourceIpMapping.reader().read(); + SourceIpMapping.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -130,7 +128,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(SourceIpMapping.reader().read()); + assertNotNull(SourceIpMapping.reader().read(tw)); } @Test @@ -142,7 +140,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(SourceIpMapping.reader().read()); + assertNotNull(SourceIpMapping.reader().read(tw)); } @Test @@ -160,7 +158,7 @@ public void testUpdateRequest() { }}; try { - SourceIpMapping.updater("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SourceIpMapping.updater("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -174,7 +172,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - SourceIpMapping.updater("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + SourceIpMapping.updater("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -192,7 +190,7 @@ public void testDeleteRequest() { }}; try { - SourceIpMapping.deleter("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SourceIpMapping.deleter("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -206,6 +204,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - SourceIpMapping.deleter("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + SourceIpMapping.deleter("IBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/connectionpolicy/ConnectionPolicyTargetTest.java b/src/test/java/com/twilio/rest/voice/v1/connectionpolicy/ConnectionPolicyTargetTest.java index 8dab78ae0e..58feb42a85 100644 --- a/src/test/java/com/twilio/rest/voice/v1/connectionpolicy/ConnectionPolicyTargetTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/connectionpolicy/ConnectionPolicyTargetTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -31,9 +29,11 @@ public class ConnectionPolicyTargetTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +51,7 @@ public void testCreateRequest() { }}; try { - ConnectionPolicyTarget.creator("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).create(); + ConnectionPolicyTarget.creator("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +65,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - ConnectionPolicyTarget.creator("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).create(); + ConnectionPolicyTarget.creator("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", URI.create("https://example.com")).create(tw); } @Test @@ -83,7 +83,7 @@ public void testFetchRequest() { }}; try { - ConnectionPolicyTarget.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + ConnectionPolicyTarget.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +97,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectionPolicyTarget.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(ConnectionPolicyTarget.fetcher("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -115,7 +115,7 @@ public void testReadRequest() { }}; try { - ConnectionPolicyTarget.reader("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + ConnectionPolicyTarget.reader("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -129,7 +129,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectionPolicyTarget.reader("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ConnectionPolicyTarget.reader("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -141,7 +141,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(ConnectionPolicyTarget.reader("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(ConnectionPolicyTarget.reader("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } @Test @@ -159,7 +159,7 @@ public void testUpdateRequest() { }}; try { - ConnectionPolicyTarget.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ConnectionPolicyTarget.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +173,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - ConnectionPolicyTarget.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + ConnectionPolicyTarget.updater("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +191,7 @@ public void testDeleteRequest() { }}; try { - ConnectionPolicyTarget.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ConnectionPolicyTarget.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +205,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - ConnectionPolicyTarget.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + ConnectionPolicyTarget.deleter("NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "NEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/BulkCountryUpdateTest.java b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/BulkCountryUpdateTest.java index 304dae7f43..5102939ca1 100644 --- a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/BulkCountryUpdateTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/BulkCountryUpdateTest.java @@ -31,9 +31,11 @@ public class BulkCountryUpdateTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testCreateRequest() { }}; try { - BulkCountryUpdate.creator("update_request").create(); + BulkCountryUpdate.creator("update_request").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - BulkCountryUpdate.creator("update_request").create(); + BulkCountryUpdate.creator("update_request").create(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/CountryTest.java b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/CountryTest.java index f30a2e3727..284e027a21 100644 --- a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/CountryTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/CountryTest.java @@ -31,9 +31,11 @@ public class CountryTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Country.fetcher("US").fetch(); + Country.fetcher("US").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.fetcher("US").fetch()); + assertNotNull(Country.fetcher("US").fetch(tw)); } @Test @@ -83,7 +85,7 @@ public void testReadRequest() { }}; try { - Country.reader().read(); + Country.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +99,6 @@ public void testReadUsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Country.reader().read()); + assertNotNull(Country.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/SettingsTest.java b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/SettingsTest.java index 219ec8a92d..ef449e356b 100644 --- a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/SettingsTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/SettingsTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SettingsTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Settings.fetcher().fetch(); + Settings.fetcher().fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Settings.fetcher().fetch()); + assertNotNull(Settings.fetcher().fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testUpdateRequest() { }}; try { - Settings.updater().update(); + Settings.updater().update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,6 +95,6 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Settings.updater().update(); + Settings.updater().update(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/country/HighriskSpecialPrefixTest.java b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/country/HighriskSpecialPrefixTest.java index 951207c176..6bf3895eef 100644 --- a/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/country/HighriskSpecialPrefixTest.java +++ b/src/test/java/com/twilio/rest/voice/v1/dialingpermissions/country/HighriskSpecialPrefixTest.java @@ -31,9 +31,11 @@ public class HighriskSpecialPrefixTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - HighriskSpecialPrefix.reader("US").read(); + HighriskSpecialPrefix.reader("US").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testReadLvResponse() { result = new ObjectMapper(); }}; - assertNotNull(HighriskSpecialPrefix.reader("US").read()); + assertNotNull(HighriskSpecialPrefix.reader("US").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/wireless/v1/CommandTest.java b/src/test/java/com/twilio/rest/wireless/v1/CommandTest.java index e77ee8f9ab..bd4b51337a 100644 --- a/src/test/java/com/twilio/rest/wireless/v1/CommandTest.java +++ b/src/test/java/com/twilio/rest/wireless/v1/CommandTest.java @@ -31,9 +31,11 @@ public class CommandTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testFetchRequest() { }}; try { - Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +67,7 @@ public void testFetchCommandSmsResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -77,7 +79,7 @@ public void testFetchCommandIpResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Command.fetcher("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -95,7 +97,7 @@ public void testReadRequest() { }}; try { - Command.reader().read(); + Command.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +111,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } @Test @@ -121,7 +123,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } @Test @@ -133,7 +135,7 @@ public void testReadIpResponse() { result = new ObjectMapper(); }}; - assertNotNull(Command.reader().read()); + assertNotNull(Command.reader().read(tw)); } @Test @@ -151,7 +153,7 @@ public void testCreateRequest() { }}; try { - Command.creator("command").create(); + Command.creator("command").create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -165,7 +167,7 @@ public void testCreateCommandSmsResponse() { result = new ObjectMapper(); }}; - Command.creator("command").create(); + Command.creator("command").create(tw); } @Test @@ -177,7 +179,7 @@ public void testCreateCommandIpResponse() { result = new ObjectMapper(); }}; - Command.creator("command").create(); + Command.creator("command").create(tw); } @Test @@ -195,7 +197,7 @@ public void testDeleteRequest() { }}; try { - Command.deleter("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Command.deleter("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -209,6 +211,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Command.deleter("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Command.deleter("DCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/wireless/v1/RatePlanTest.java b/src/test/java/com/twilio/rest/wireless/v1/RatePlanTest.java index c4aaf2efb6..3298a7b308 100644 --- a/src/test/java/com/twilio/rest/wireless/v1/RatePlanTest.java +++ b/src/test/java/com/twilio/rest/wireless/v1/RatePlanTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class RatePlanTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testReadRequest() { }}; try { - RatePlan.reader().read(); + RatePlan.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(RatePlan.reader().read()); + assertNotNull(RatePlan.reader().read(tw)); } @Test @@ -77,7 +75,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(RatePlan.reader().read()); + assertNotNull(RatePlan.reader().read(tw)); } @Test @@ -95,7 +93,7 @@ public void testFetchRequest() { }}; try { - RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -109,7 +107,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(RatePlan.fetcher("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -127,7 +125,7 @@ public void testCreateRequest() { }}; try { - RatePlan.creator().create(); + RatePlan.creator().create(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testCreateResponse() { result = new ObjectMapper(); }}; - RatePlan.creator().create(); + RatePlan.creator().create(tw); } @Test @@ -159,7 +157,7 @@ public void testUpdateRequest() { }}; try { - RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -173,7 +171,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + RatePlan.updater("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -191,7 +189,7 @@ public void testDeleteRequest() { }}; try { - RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -205,6 +203,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + RatePlan.deleter("WPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/wireless/v1/SimTest.java b/src/test/java/com/twilio/rest/wireless/v1/SimTest.java index dfa63bc1bb..4f4a0600ae 100644 --- a/src/test/java/com/twilio/rest/wireless/v1/SimTest.java +++ b/src/test/java/com/twilio/rest/wireless/v1/SimTest.java @@ -9,8 +9,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.twilio.Twilio; -import com.twilio.converter.DateConverter; -import com.twilio.converter.Promoter; import com.twilio.exception.TwilioException; import com.twilio.http.HttpMethod; import com.twilio.http.Request; @@ -22,8 +20,6 @@ import org.junit.Before; import org.junit.Test; -import java.net.URI; - import static com.twilio.TwilioTest.serialize; import static org.junit.Assert.*; @@ -31,9 +27,11 @@ public class SimTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +49,7 @@ public void testFetchRequest() { }}; try { - Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(); + Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,7 +63,7 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()); + assertNotNull(Sim.fetcher("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch(tw)); } @Test @@ -83,7 +81,7 @@ public void testReadRequest() { }}; try { - Sim.reader().read(); + Sim.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -97,7 +95,7 @@ public void testReadEmptyResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -109,7 +107,7 @@ public void testReadFullResponse() { result = new ObjectMapper(); }}; - assertNotNull(Sim.reader().read()); + assertNotNull(Sim.reader().read(tw)); } @Test @@ -127,7 +125,7 @@ public void testUpdateRequest() { }}; try { - Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -141,7 +139,7 @@ public void testUpdateResponse() { result = new ObjectMapper(); }}; - Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -153,7 +151,7 @@ public void testUpdateMoveToSubaccountResponse() { result = new ObjectMapper(); }}; - Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -165,7 +163,7 @@ public void testUpdateResetConnectivityResponse() { result = new ObjectMapper(); }}; - Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(); + Sim.updater("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(tw); } @Test @@ -183,7 +181,7 @@ public void testDeleteRequest() { }}; try { - Sim.deleter("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sim.deleter("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -197,6 +195,6 @@ public void testDeleteResponse() { result = new ObjectMapper(); }}; - Sim.deleter("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(); + Sim.deleter("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete(tw); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/wireless/v1/UsageRecordTest.java b/src/test/java/com/twilio/rest/wireless/v1/UsageRecordTest.java index a688e26802..72aa8cf9c3 100644 --- a/src/test/java/com/twilio/rest/wireless/v1/UsageRecordTest.java +++ b/src/test/java/com/twilio/rest/wireless/v1/UsageRecordTest.java @@ -31,9 +31,11 @@ public class UsageRecordTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UsageRecord.reader().read(); + UsageRecord.reader().read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader().read()); + assertNotNull(UsageRecord.reader().read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/wireless/v1/sim/DataSessionTest.java b/src/test/java/com/twilio/rest/wireless/v1/sim/DataSessionTest.java index 54b763dc58..910932ec45 100644 --- a/src/test/java/com/twilio/rest/wireless/v1/sim/DataSessionTest.java +++ b/src/test/java/com/twilio/rest/wireless/v1/sim/DataSessionTest.java @@ -31,9 +31,11 @@ public class DataSessionTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - DataSession.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + DataSession.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(DataSession.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(DataSession.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/rest/wireless/v1/sim/UsageRecordTest.java b/src/test/java/com/twilio/rest/wireless/v1/sim/UsageRecordTest.java index ed7ef9f99b..24d91cafba 100644 --- a/src/test/java/com/twilio/rest/wireless/v1/sim/UsageRecordTest.java +++ b/src/test/java/com/twilio/rest/wireless/v1/sim/UsageRecordTest.java @@ -31,9 +31,11 @@ public class UsageRecordTest { @Mocked private TwilioRestClient twilioRestClient; + private Twilio tw; + @Before public void setUp() throws Exception { - Twilio.init("AC123", "AUTH TOKEN"); + tw = new Twilio("AC123", "AUTH TOKEN"); } @Test @@ -51,7 +53,7 @@ public void testReadRequest() { }}; try { - UsageRecord.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(); + UsageRecord.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw); fail("Expected TwilioException to be thrown for 500"); } catch (TwilioException e) {} } @@ -65,6 +67,6 @@ public void testFetchResponse() { result = new ObjectMapper(); }}; - assertNotNull(UsageRecord.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read()); + assertNotNull(UsageRecord.reader("DEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").read(tw)); } } \ No newline at end of file diff --git a/src/test/java/com/twilio/security/RequestValidatorTest.java b/src/test/java/com/twilio/security/RequestValidatorTest.java index a97418277c..855ad1e60f 100644 --- a/src/test/java/com/twilio/security/RequestValidatorTest.java +++ b/src/test/java/com/twilio/security/RequestValidatorTest.java @@ -41,6 +41,13 @@ public void testFailsWhenIncorrect() { Assert.assertFalse("Request should have failed validation, but didn't", isValid); } + @Test + public void testFailsWhenNull() { + boolean isValid = validator.validate(url, params, null); + + Assert.assertFalse("Request should have failed validation, but didn't", isValid); + } + @Test public void testValidateBody() { boolean isValid = validator.validateBody(body, bodyHash); @@ -55,6 +62,15 @@ public void testValidateBodyFailsWhenWrong() { Assert.assertFalse("Body validation should have failed, but didn't", isValid); } + @Test + public void testValidateBodyThrowsExceptionWhenNull() { + try { + validator.validateBody(null, "WRONG"); + } catch (NullPointerException e) { + Assert.assertEquals(NullPointerException.class, e.getClass()); + } + } + @Test public void testValidateWithBody() throws URISyntaxException { String url = this.url + "&bodySHA256=" + bodyHash; @@ -97,6 +113,15 @@ public void testValidateRemovesPortHttp() { Assert.assertTrue("Validator did not strip port from url", isValid); } + @Test + public void testValidateNotAllowedPort() { + String url = this.url.replace(".com", ".com:1234").replace("https", "hp"); + String expectedSignature = "Zmvh+3yNM1Phv2jhDCwEM3q5ebU="; // hash of http uri with port 1234 + boolean isValid = validator.validate(url, params, expectedSignature); + + Assert.assertFalse("Validator did not strip port from url", isValid); + } + @Test public void testValidateAddsPortHttps() { String expectedSignature = "kvajT1Ptam85bY51eRf/AJRuM3w="; // hash of https uri with port 443 @@ -114,4 +139,13 @@ public void testValidateAddsPortHttp() { Assert.assertTrue("Validator did not add port 80 to http url", isValid); } + @Test + public void testInvalidateAddsWrongPort() { + String url = this.url.replace("https", "http"); + String expectedSignature = "kvajT1Ptam85bY51eRf/AJRuM3w="; // hash of http uri with port 433 + boolean isValid = validator.validate(url, params, expectedSignature); + + Assert.assertFalse("Validator did not add port 80 to http url", isValid); + } + }