@Test
public void shouldProperlyMapPermissionModelCollectionIntoPermissionCollection()
    throws Exception {

  PermissionModel permissionModel1 = PermissionModel.builder()
      .permission("CAMERA")
      .rationaleTitle("Permission Request")
      .rationaleMessage("You should allow it")
      .deniedMessage("Allow it!")
      .build();
  PermissionModel permissionModel2 = PermissionModel.builder()
      .permission("CONTACTS")
      .rationaleTitle("Permission Request")
      .rationaleMessage("You should allow it, please")
      .deniedMessage("ALLOW IT!!")
      .build();
  ArrayList<PermissionModel> permissionModels = new ArrayList<>();
  permissionModels.add(permissionModel1);
  permissionModels.add(permissionModel2);
  Collection<Permission> permissions =
      permissionModelDataMapper.transformInverse(permissionModels);
  assertThat(permissions, notNullValue());
  assertThat(permissions.size(), is(2));
  Permission permission1 = (Permission) permissions.toArray()[0];
  assertThat(permission1, notNullValue());
  assertThat(permission1, instanceOf(Permission.class));
  assertThat(permission1.permission(), notNullValue());
  assertThat(permission1.permission(), is("CAMERA"));
  Permission permission2 = (Permission) permissions.toArray()[1];
  assertThat(permission2, notNullValue());
  assertThat(permission2, instanceOf(Permission.class));
  assertThat(permission2.permission(), notNullValue());
  assertThat(permission2.permission(), is("CONTACTS"));
}