Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
add DeviceCredentials#toString
Browse files Browse the repository at this point in the history
  • Loading branch information
Ursula Walenciak committed May 22, 2017
1 parent cb6505b commit e0e7a42
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ public String getTenantId() {
public String getUsername() {
return username;
}

@Override
public String toString() {
return "DeviceCredentials{" + "id='" + id + '\'' +
", tenantId='" + tenantId + '\'' +
", username='" + username + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.telekom.m2m.cot.restsdk.devicecontrol;

import org.testng.annotations.Test;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

public class DeviceCredentialsTest {

@Test
public void testToString() {

final DeviceCredentials deviceCredentials = new DeviceCredentials();

deviceCredentials.setId("id_" + System.currentTimeMillis());
deviceCredentials.setUsername("username_" + System.currentTimeMillis());
deviceCredentials.setPassword("password_" + System.currentTimeMillis());
deviceCredentials.setTenantId("tenantId_" + System.currentTimeMillis());

final String stringRepresentation = deviceCredentials.toString();
assertNotNull(stringRepresentation);
assertFalse(stringRepresentation.contains(deviceCredentials.getPassword()));
assertTrue(stringRepresentation.contains(deviceCredentials.getId()));
assertTrue(stringRepresentation.contains(deviceCredentials.getUsername()));
assertTrue(stringRepresentation.contains(deviceCredentials.getTenantId()));
}

}

0 comments on commit e0e7a42

Please sign in to comment.