Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base values getters for the Telemetry class #63

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions auth0/src/main/java/com/auth0/android/util/Telemetry.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public Telemetry(String name, String version, String libraryVersion) {
this.libraryVersion = libraryVersion;
}

public String getName() {
return name;
}

public String getVersion() {
return version;
}

public String getLibraryVersion() {
return libraryVersion;
}

public String getValue() {
Map<String, String> values = new HashMap<>();
if (name != null) {
Expand Down
17 changes: 16 additions & 1 deletion auth0/src/test/java/com/auth0/android/util/TelemetryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class TelemetryTest {

@Before
public void setUp() throws Exception {
telemetry = new Telemetry("auth0-java", "1.0.0");
telemetry = new Telemetry("auth0-java", "1.0.0", "1.2.3");
}

@Test
Expand All @@ -27,4 +27,19 @@ public void shouldReturnNullWhenNoInfoIsProvided() throws Exception {
telemetry = new Telemetry(null, null);
assertThat(telemetry.getValue(), is(nullValue()));
}

@Test
public void shouldGetName() throws Exception {
assertThat(telemetry.getName(), is("auth0-java"));
}

@Test
public void shouldGetVersion() throws Exception {
assertThat(telemetry.getVersion(), is("1.0.0"));
}

@Test
public void shouldGetLibraryVersion() throws Exception {
assertThat(telemetry.getLibraryVersion(), is("1.2.3"));
}
}