@Test
public void testRoleTokenInvalidParamsAtEnd() throws CryptoException {

    // Add some roles
    List<String> roles = new ArrayList<>();
    roles.add("reader");
    roles.add("writer");
    // Create a token for validation using the signed data
    String testKeyVersionK1 = "1";
    // Create token and sign
    RoleToken rollTokenToSign = new RoleToken.Builder(rolVersion, svcDomain, roles)
            .salt(salt).expirationWindow(expirationTime).keyId(testKeyVersionK1).build();
    rollTokenToSign.sign(ztsPrivateKeyStringK1);
    String signedToken = rollTokenToSign.getSignedToken() + ";d=newdomain;r=newroles";
    RoleToken rollTokenToValidate = new RoleToken(signedToken);
    assertNotNull(rollTokenToValidate.getSignedToken());
    // Validate all input data, we'll be ignoring the data
    // after the signature
    assertEquals(rollTokenToValidate.getDomain(), svcDomain);
    List<String> rolesToValidate = rollTokenToValidate.getRoles();
    assertEquals(rolesToValidate.size(), roles.size());
    assertEquals(rolesToValidate, roles);
    assertEquals(rollTokenToValidate.getKeyId(), testKeyVersionK1);
    // Validate the signature and that expiration time had not elapsed
    // we should get invalid validation due to extra arguments at
    // end of the string
    assertFalse(rollTokenToValidate.validate(ztsPublicKeyStringK1, 300, false));
}