From 0ab21cfa945c941a7cc6ad6f8097e19a4b5c0ef8 Mon Sep 17 00:00:00 2001 From: Mantej Dheri Date: Mon, 25 Jul 2022 12:01:30 -0700 Subject: [PATCH] feat(smartcar): added support for simulated mode and feature flags (#111) --- README.md | 18 ++++---- README.mdt | 4 +- gradle.properties | 2 +- .../com/smartcar/sdk/helpers/AuthHelpers.java | 4 +- .../java/com/smartcar/sdk/AuthClient.java | 32 +++++++++++--- src/main/java/com/smartcar/sdk/Smartcar.java | 4 +- .../sdk/SmartcarCompatibilityRequest.java | 41 ++++++++++++++---- .../smartcar/sdk/SmartcarVehicleOptions.java | 26 ++++++++++- src/main/java/com/smartcar/sdk/Vehicle.java | 35 ++++++++++++--- .../java/com/smartcar/sdk/AuthClientTest.java | 43 +++++++++++++++++++ .../java/com/smartcar/sdk/SmartcarTest.java | 33 ++++++++++++++ .../java/com/smartcar/sdk/VehicleTest.java | 7 +++ 12 files changed, 213 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 4f026fe9..2c6e321e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The recommended method for obtaining the SDK is via Gradle or Maven through the ### Gradle ```groovy -compile "com.smartcar.sdk:java-sdk:3.2.3" +compile "com.smartcar.sdk:java-sdk:3.3.0" ``` ### Maven @@ -18,16 +18,16 @@ compile "com.smartcar.sdk:java-sdk:3.2.3" com.smartcar.sdk java-sdk - 3.2.3 + 3.3.0 ``` ### Jar Direct Download -* [java-sdk-3.2.3.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/3.2.3/java-sdk-3.2.3.jar) -* [java-sdk-3.2.3-sources.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/3.2.3/java-sdk-3.2.3-sources.jar) -* [java-sdk-3.2.3-javadoc.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/3.2.3/java-sdk-3.2.3-javadoc.jar) +* [java-sdk-3.3.0.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/3.3.0/java-sdk-3.3.0.jar) +* [java-sdk-3.3.0-sources.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/3.3.0/java-sdk-3.3.0-sources.jar) +* [java-sdk-3.3.0-javadoc.jar](https://search.maven.org/remotecontent?filepath=com/smartcar/sdk/java-sdk/3.3.0/java-sdk-3.3.0-javadoc.jar) -Signatures and other downloads available at [Maven Central](https://search.maven.org/artifact/com.smartcar.sdk/java-sdk/3.2.3/jar). +Signatures and other downloads available at [Maven Central](https://search.maven.org/artifact/com.smartcar.sdk/java-sdk/3.3.0/jar). ## Usage @@ -53,14 +53,14 @@ a valid access token for the target vehicle. String clientSecret = ""; String redirectUri = ""; String[] scope = {}; - boolean testMode = true; + String mode = "test"; // Initialize a new AuthClient with your credentials. AuthClient authClient = new AuthClient.Builder .clientId(clientId) .clientSecret(clientSecret) .redirectUri(redirectUri) - .testMode(testMode); + .mode(mode); // Retrieve the auth URL to start the OAuth flow. String authUrl = authClient.authUrlBuilder(scope) @@ -136,5 +136,5 @@ In accordance with the Semantic Versioning specification, the addition of suppor [ci-url]: https://travis-ci.com/smartcar/java-sdk [coverage-image]: https://codecov.io/gh/smartcar/java-sdk/branch/master/graph/badge.svg?token=nZAITx7w3X [coverage-url]: https://codecov.io/gh/smartcar/java-sdk -[javadoc-image]: https://img.shields.io/badge/javadoc-3.2.3-brightgreen.svg +[javadoc-image]: https://img.shields.io/badge/javadoc-3.3.0-brightgreen.svg [javadoc-url]: https://smartcar.github.io/java-sdk diff --git a/README.mdt b/README.mdt index db1766d0..d3a627ad 100644 --- a/README.mdt +++ b/README.mdt @@ -53,14 +53,14 @@ a valid access token for the target vehicle. String clientSecret = ""; String redirectUri = ""; String[] scope = {}; - boolean testMode = true; + String mode = "test"; // Initialize a new AuthClient with your credentials. AuthClient authClient = new AuthClient.Builder .clientId(clientId) .clientSecret(clientSecret) .redirectUri(redirectUri) - .testMode(testMode); + .mode(mode); // Retrieve the auth URL to start the OAuth flow. String authUrl = authClient.authUrlBuilder(scope) diff --git a/gradle.properties b/gradle.properties index 5e6a880c..8099c149 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ libGroup=com.smartcar.sdk libName=java-sdk -libVersion=3.2.3 +libVersion=3.3.0 libDescription=Smartcar Java SDK diff --git a/src/integration/java/com/smartcar/sdk/helpers/AuthHelpers.java b/src/integration/java/com/smartcar/sdk/helpers/AuthHelpers.java index 12f792ab..5d3f327a 100644 --- a/src/integration/java/com/smartcar/sdk/helpers/AuthHelpers.java +++ b/src/integration/java/com/smartcar/sdk/helpers/AuthHelpers.java @@ -53,12 +53,12 @@ public static String getWebhookId() { * Creates an AuthClient builder and sets Client ID, Client Secret, and Redirect URI and also * enables test mode. */ - public static AuthClient.Builder getConfiguredAuthClientBuilder() { + public static AuthClient.Builder getConfiguredAuthClientBuilder() throws Exception { return new AuthClient.Builder() .clientId(getClientId()) .clientSecret(getClientSecret()) .redirectUri("https://example.com/auth") - .testMode(true); + .mode("test"); } public static String runAuthFlow(String authorizeURL) { diff --git a/src/main/java/com/smartcar/sdk/AuthClient.java b/src/main/java/com/smartcar/sdk/AuthClient.java index 3f5c33bc..2c5e459d 100644 --- a/src/main/java/com/smartcar/sdk/AuthClient.java +++ b/src/main/java/com/smartcar/sdk/AuthClient.java @@ -9,6 +9,8 @@ import java.lang.reflect.Type; import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** Smartcar OAuth 2.0 Authentication Client */ public class AuthClient { @@ -43,7 +45,7 @@ public Auth deserialize(JsonElement json, Type typeOfT, JsonDeserializationConte private final String clientId; private final String clientSecret; private final String redirectUri; - private final boolean testMode; + private final String mode; /** * Builds a new AuthClient. @@ -53,13 +55,14 @@ public static class Builder { private String clientId; private String clientSecret; private String redirectUri; - private boolean testMode; + private String mode; + private final Set validModes = Stream.of("test", "live", "simulated").collect(Collectors.toSet()); public Builder() { this.clientId = System.getenv("SMARTCAR_CLIENT_ID"); this.clientSecret = System.getenv("SMARTCAR_CLIENT_SECRET"); this.redirectUri = System.getenv("SMARTCAR_REDIRECT_URI"); - this.testMode = false; + this.mode = "live"; } public Builder clientId(String clientId) { @@ -77,11 +80,27 @@ public Builder redirectUri(String redirectUri) { return this; } + /** + * @deprecated use {@link Builder#mode(String)} instead. + */ + @Deprecated public Builder testMode(boolean testMode) { - this.testMode = testMode; + this.mode = testMode ? "test" : "live"; + return this; + } + + public Builder mode(String mode) throws Exception { + if (!this.validModes.contains(mode)) { + throw new Exception( + "The \"mode\" parameter MUST be one of the following: \"test\", \"live\", \"simulated\"" + ); + } + + this.mode = mode; return this; } + public AuthClient build() throws Exception { if (this.clientId == null) { throw new Exception("clientId must be defined"); @@ -100,7 +119,7 @@ private AuthClient(Builder builder) { this.clientId = builder.clientId; this.clientSecret = builder.clientSecret; this.redirectUri = builder.redirectUri; - this.testMode = builder.testMode; + this.mode = builder.mode; ApiClient.gson.registerTypeAdapter(Auth.class, new AuthDeserializer()); } @@ -120,6 +139,7 @@ public AuthUrlBuilder authUrlBuilder(String[] scope) { */ public class AuthUrlBuilder { private HttpUrl.Builder urlBuilder; + private String mode = AuthClient.this.mode; private List flags = new ArrayList<>(); public AuthUrlBuilder(String[] scope) { @@ -133,7 +153,7 @@ public AuthUrlBuilder(String[] scope) { .addQueryParameter("response_type", "code") .addQueryParameter("client_id", AuthClient.this.clientId) .addQueryParameter("redirect_uri", AuthClient.this.redirectUri) - .addQueryParameter("mode", AuthClient.this.testMode ? "test" : "live") + .addQueryParameter("mode", AuthClient.this.mode) .addQueryParameter("scope", Utils.join(scope, " ")); } diff --git a/src/main/java/com/smartcar/sdk/Smartcar.java b/src/main/java/com/smartcar/sdk/Smartcar.java index e913c9a4..7c19618e 100644 --- a/src/main/java/com/smartcar/sdk/Smartcar.java +++ b/src/main/java/com/smartcar/sdk/Smartcar.java @@ -148,8 +148,8 @@ public static Compatibility getCompatibility(SmartcarCompatibilityRequest compat if (compatibilityRequest.getFlags() != null) { urlBuilder.addQueryParameter("flags", compatibilityRequest.getFlags()); } - if (compatibilityRequest.getTestMode()) { - urlBuilder.addQueryParameter("mode", "test"); + if (compatibilityRequest.getMode() != null) { + urlBuilder.addQueryParameter("mode", compatibilityRequest.getMode()); } if (compatibilityRequest.getTestModeCompatibilityLevel() != null) { urlBuilder.addQueryParameter("test_mode_compatibility_level", compatibilityRequest.getTestModeCompatibilityLevel()); diff --git a/src/main/java/com/smartcar/sdk/SmartcarCompatibilityRequest.java b/src/main/java/com/smartcar/sdk/SmartcarCompatibilityRequest.java index 74aafe42..b6b7f340 100644 --- a/src/main/java/com/smartcar/sdk/SmartcarCompatibilityRequest.java +++ b/src/main/java/com/smartcar/sdk/SmartcarCompatibilityRequest.java @@ -2,6 +2,9 @@ import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; /** * Class encompassing optional arguments for Smartcar compatibility requests @@ -14,7 +17,7 @@ public final class SmartcarCompatibilityRequest { private final String flags; private final String clientId; private final String clientSecret; - private final boolean testMode; + private final String mode; private final String testModeCompatibilityLevel; public static class Builder { @@ -25,8 +28,9 @@ public static class Builder { private final List flags; private String clientId; private String clientSecret; - private boolean testMode; + private String mode; private String testModeCompatibilityLevel; + private final Set validModes = Stream.of("test", "live", "simulated").collect(Collectors.toSet()); public Builder() { this.vin = ""; @@ -36,7 +40,7 @@ public Builder() { this.flags = new ArrayList<>(); this.clientId = System.getenv("SMARTCAR_CLIENT_ID"); this.clientSecret = System.getenv("SMARTCAR_CLIENT_SECRET"); - this.testMode = false; + this.mode = null; this.testModeCompatibilityLevel = null; } @@ -80,13 +84,28 @@ public Builder clientSecret(String clientSecret) { return this; } + /** + * @deprecated use {@link #mode(String)} instead. + */ + @Deprecated public Builder testMode(boolean testMode) { - this.testMode = testMode; + this.mode = testMode ? "test" : "live"; + return this; + } + + public Builder mode(String mode) throws Exception { + if (!this.validModes.contains(mode)) { + throw new Exception( + "The \"mode\" parameter MUST be one of the following: \"test\", \"live\", \"simulated\"" + ); + } + + this.mode = mode; return this; } public Builder testModeCompatibilityLevel(String level) { - this.testMode = true; + this.mode = "test"; this.testModeCompatibilityLevel = level; return this; } @@ -115,7 +134,7 @@ private SmartcarCompatibilityRequest(Builder builder) { } this.clientId = builder.clientId; this.clientSecret = builder.clientSecret; - this.testMode = builder.testMode; + this.mode = builder.mode; this.testModeCompatibilityLevel = builder.testModeCompatibilityLevel; } @@ -135,7 +154,13 @@ public String getVin() { public String getClientSecret() { return this.clientSecret; } - public boolean getTestMode() { return this.testMode; } + /** + * @deprecated use {@link Builder#getMode()} which returns the mode as a String. + */ + @Deprecated + public boolean getTestMode() { return this.mode.equals("test"); } + + public String getMode() { return this.mode; } public String getTestModeCompatibilityLevel() { return this.testModeCompatibilityLevel; } -} \ No newline at end of file +} diff --git a/src/main/java/com/smartcar/sdk/SmartcarVehicleOptions.java b/src/main/java/com/smartcar/sdk/SmartcarVehicleOptions.java index b07feaec..363cf1f6 100644 --- a/src/main/java/com/smartcar/sdk/SmartcarVehicleOptions.java +++ b/src/main/java/com/smartcar/sdk/SmartcarVehicleOptions.java @@ -1,20 +1,26 @@ package com.smartcar.sdk; +import java.util.ArrayList; +import java.util.List; + /** Class encompassing any optional arguments for constructing a new Vehicle instance */ public final class SmartcarVehicleOptions { private final String version; private final Vehicle.UnitSystem unitSystem; private final String origin; + private final String flags; public static class Builder { private String version; private Vehicle.UnitSystem unitSystem; private String origin; + private final List flags; public Builder() { this.version = "2.0"; this.unitSystem = Vehicle.UnitSystem.METRIC; this.origin = Smartcar.getApiOrigin(); + this.flags = new ArrayList<>(); } public Builder version(String version) { @@ -27,6 +33,16 @@ public Builder unitSystem(Vehicle.UnitSystem unitSystem) { return this; } + public Builder addFlag(String key, String value) { + this.flags.add(key + ":" + value); + return this; + } + + public Builder addFlag(String key, boolean value) { + this.flags.add(key + ":" + value); + return this; + } + public Builder origin(String origin) { this.origin = origin; return this; @@ -41,6 +57,11 @@ private SmartcarVehicleOptions(Builder builder) { this.version = builder.version; this.unitSystem = builder.unitSystem; this.origin = builder.origin; + if (!builder.flags.isEmpty()) { + this.flags = String.join(" ", builder.flags); + } else { + this.flags = null; + } } public String getVersion() { @@ -51,8 +72,11 @@ public Vehicle.UnitSystem getUnitSystem() { return this.unitSystem; } + public String getFlags() { + return this.flags; + } + public String getOrigin() { return this.origin; } } - diff --git a/src/main/java/com/smartcar/sdk/Vehicle.java b/src/main/java/com/smartcar/sdk/Vehicle.java index 8fb0e421..25ccdabd 100644 --- a/src/main/java/com/smartcar/sdk/Vehicle.java +++ b/src/main/java/com/smartcar/sdk/Vehicle.java @@ -13,6 +13,8 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.ArrayList; + /** Smartcar Vehicle API Object */ public class Vehicle { @@ -26,6 +28,7 @@ public enum UnitSystem { private Vehicle.UnitSystem unitSystem; private final String version; private final String origin; + private final String flags; private ApplicationPermissions permissions; /** @@ -50,6 +53,7 @@ public Vehicle(String vehicleId, String accessToken, SmartcarVehicleOptions opti this.version = options.getVersion(); this.unitSystem = options.getUnitSystem(); this.origin = options.getOrigin(); + this.flags = options.getFlags(); } /** @@ -60,6 +64,14 @@ public String getVersion() { return this.version; } + /** + * Gets the flags that are passed to the vehicle object as a serialized string + * @return serialized string of the flags + */ + public String getFlags(){ + return this.flags; + } + /** * Executes an API request under the VehicleIds endpoint. * @@ -72,13 +84,19 @@ public String getVersion() { */ protected T call( String path, String method, RequestBody body, String accessToken, Class type) throws SmartcarException { - HttpUrl url = + HttpUrl.Builder urlBuilder = HttpUrl.parse(this.origin) - .newBuilder().addPathSegments("v" + this.version) + .newBuilder() + .addPathSegments("v" + this.version) .addPathSegments("vehicles") .addPathSegments(this.vehicleId) - .addPathSegments(path) - .build(); + .addPathSegments(path); + + + if (this.getFlags() != null) { + urlBuilder.addQueryParameter("flags", this.getFlags()); + } + HttpUrl url = urlBuilder.build(); Map headers = new HashMap<>(); headers.put("Authorization", "Bearer " + accessToken); @@ -105,7 +123,9 @@ protected T call(String path, String method, RequestBody bod for (Map.Entry entry: query.entrySet()) { urlBuilder.addQueryParameter(entry.getKey(), entry.getValue()); } - + if (this.getFlags() != null) { + urlBuilder.addQueryParameter("flags", this.getFlags()); + } HttpUrl url = urlBuilder.build(); Map headers = new HashMap<>(); @@ -378,6 +398,11 @@ public VehicleResponse request(SmartcarVehicleRequest vehicleRequest) throws Sma .addPathSegments(this.vehicleId) .addPathSegments(vehicleRequest.getPath()); + if (this.flags != null) { + urlBuilder.addQueryParameter("flags", this.flags); + } + + // This overrides the defaults flags if (vehicleRequest.getFlags() != null) { urlBuilder.addQueryParameter("flags", vehicleRequest.getFlags()); } diff --git a/src/test/java/com/smartcar/sdk/AuthClientTest.java b/src/test/java/com/smartcar/sdk/AuthClientTest.java index 90261e23..7e561c9c 100644 --- a/src/test/java/com/smartcar/sdk/AuthClientTest.java +++ b/src/test/java/com/smartcar/sdk/AuthClientTest.java @@ -211,4 +211,47 @@ public void testAuthUrlBuilderWithOptions() throws Exception { .build(); Assert.assertEquals(authUrl, "https://connect.smartcar.com/oauth/authorize?response_type=code&client_id=cl13nt1d-t35t-46dc-aa25-bdd042f54e7d&redirect_uri=https%3A%2F%2Fexample.com%2F&mode=live&scope=read_vehicle_info%20read_location%20read_odometer&state=sampleState&approval_prompt=force&make=TESLA&single_select=true&single_select=true&single_select_vin=sampleVin&flags=foo%3Abar%20test%3Atrue"); } + + @Test + public void testAuthUrlBuilderWithSimulatedMode() throws Exception { + PowerMockito.mockStatic(System.class); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_ID")).thenReturn(this.sampleClientId); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_SECRET")).thenReturn(this.sampleClientSecret); + PowerMockito.when(System.getenv("SMARTCAR_REDIRECT_URI")).thenReturn(this.sampleRedirectUri); + AuthClient client = new AuthClient.Builder().mode("simulated").build(); + + String authUrl = client.authUrlBuilder(this.sampleScope).build(); + + Assert.assertEquals(authUrl, "https://connect.smartcar.com/oauth/authorize?response_type=code&client_id=cl13nt1d-t35t-46dc-aa25-bdd042f54e7d&redirect_uri=https%3A%2F%2Fexample.com%2F&mode=simulated&scope=read_vehicle_info%20read_location%20read_odometer"); + } + + @Test + public void testAuthUrlBuilderWithTestModeParameter() throws Exception { + PowerMockito.mockStatic(System.class); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_ID")).thenReturn(this.sampleClientId); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_SECRET")).thenReturn(this.sampleClientSecret); + PowerMockito.when(System.getenv("SMARTCAR_REDIRECT_URI")).thenReturn(this.sampleRedirectUri); + AuthClient client = new AuthClient.Builder().testMode(true).build(); + + String authUrl = client.authUrlBuilder(this.sampleScope).build(); + + Assert.assertEquals(authUrl, "https://connect.smartcar.com/oauth/authorize?response_type=code&client_id=cl13nt1d-t35t-46dc-aa25-bdd042f54e7d&redirect_uri=https%3A%2F%2Fexample.com%2F&mode=test&scope=read_vehicle_info%20read_location%20read_odometer"); + } + + @Test + public void testAuthUrlBuilderWithInvaildMode() { + PowerMockito.mockStatic(System.class); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_ID")).thenReturn(this.sampleClientId); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_SECRET")).thenReturn(this.sampleClientSecret); + PowerMockito.when(System.getenv("SMARTCAR_REDIRECT_URI")).thenReturn(this.sampleRedirectUri); + + boolean thrown = false; + try{ + AuthClient client = new AuthClient.Builder().mode("invalid").build(); + } catch (Exception e) { + thrown = true; + Assert.assertEquals(e.getMessage(), "The \"mode\" parameter MUST be one of the following: \"test\", \"live\", \"simulated\""); + } + Assert.assertTrue(thrown); + } } diff --git a/src/test/java/com/smartcar/sdk/SmartcarTest.java b/src/test/java/com/smartcar/sdk/SmartcarTest.java index caddd9d2..c8d0bec7 100644 --- a/src/test/java/com/smartcar/sdk/SmartcarTest.java +++ b/src/test/java/com/smartcar/sdk/SmartcarTest.java @@ -133,6 +133,39 @@ public void testGetCompatibilityWithOptions() throws Exception { Assert.assertEquals(req.getPath(), "/v1.0/compatibility?vin=1234&scope=read_odometer&country=GB&flags=foo%3Abar%20test%3Atrue&mode=test&test_mode_compatibility_level=hello"); } + @Test + @PrepareForTest(System.class) + public void testGetCompatibilitySimulatedMode() throws Exception { + String vin = "1234"; + String[] scope; + scope = new String[]{"read_odometer"}; + + MockResponse response = new MockResponse() + .setBody("{ \"compatible\": true }") + .addHeader("sc-request-id", this.sampleRequestId); + TestExecutionListener.mockWebServer.enqueue(response); + + PowerMockito.mockStatic(System.class); + PowerMockito.when(System.getenv("SMARTCAR_API_ORIGIN")).thenReturn( + "http://localhost:" + TestExecutionListener.mockWebServer.getPort() + ); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_ID")).thenReturn(this.sampleClientId); + PowerMockito.when(System.getenv("SMARTCAR_CLIENT_SECRET")).thenReturn(this.sampleClientSecret); + + SmartcarCompatibilityRequest request = new SmartcarCompatibilityRequest.Builder() + .clientId(this.sampleClientId) + .clientSecret(this.sampleClientSecret) + .vin(vin) + .scope(scope) + .mode("simulated") + .build(); + Compatibility comp = Smartcar.getCompatibility(request); + Assert.assertTrue(comp.getCompatible()); + Assert.assertEquals(comp.getMeta().getRequestId(), this.sampleRequestId); + RecordedRequest req = TestExecutionListener.mockWebServer.takeRequest(); + Assert.assertEquals(req.getPath(), "/v2.0/compatibility?vin=1234&scope=read_odometer&country=US&mode=simulated"); + } + @Test @PrepareForTest(System.class) public void testGetCompatibilityWithoutRequiredOptions() { diff --git a/src/test/java/com/smartcar/sdk/VehicleTest.java b/src/test/java/com/smartcar/sdk/VehicleTest.java index 107fca1e..0ba98c99 100644 --- a/src/test/java/com/smartcar/sdk/VehicleTest.java +++ b/src/test/java/com/smartcar/sdk/VehicleTest.java @@ -64,6 +64,8 @@ private void loadAndEnqueueResponse(String resourceName) throws FileNotFoundExce private void beforeMethod() throws IOException { SmartcarVehicleOptions options = new SmartcarVehicleOptions.Builder() + .addFlag("foo", "bar") + .addFlag("test", true) .origin("http://localhost:" + TestExecutionListener.mockWebServer.getPort()) .build(); this.subject = new Vehicle(this.vehicleId, this.accessToken, options); @@ -99,6 +101,11 @@ public void testGetVersion() { Assert.assertEquals(this.subject.getVersion(), "2.0"); } + @Test + public void testFlags() { + Assert.assertEquals(this.subject.getFlags(), "foo:bar test:true"); + } + @Test public void testInfo() throws Exception { loadAndEnqueueResponse("GetVehicleInfo");