@Test
  public void shouldNotAllowUserToBecomeApprover() throws Exception {
    final B2BUnitModel unit = modelService.create(B2BUnitModel.class);
    unit.setUid("aUnit");

    final B2BCustomerModel customer = modelService.create(B2BCustomerModel.class);
    customer.setUid("test");
    customer.setName("test");
    customer.setEmail("*****@*****.**");

    final Set<PrincipalGroupModel> groups = new HashSet<PrincipalGroupModel>(customer.getGroups());
    groups.add(unit);
    customer.setGroups(groups);

    final Set<B2BCustomerModel> approvers = new HashSet<B2BCustomerModel>();
    approvers.add(customer);
    unit.setApprovers(approvers);

    try {
      modelService.save(unit);
    } catch (final ModelSavingException e) {
      Assert.assertTrue(
          e.getMessage().contains("error.b2bunit.approverNotMemberOfB2BApproverGroup"));
    }
  }
  private void assertLocalization(
      final Locale sessionLocale, final String expectedMessage, final ItemModel model) {
    i18nService.setCurrentLocale(sessionLocale);

    try {
      modelService.save(model);
      Assert.fail("Missing expected " + ModelSavingException.class.getSimpleName());
    } catch (final ModelSavingException e) {
      Assert.assertTrue(e.getCause() instanceof ValidationViolationException);
      final String gotMessage = e.getMessage().trim().toLowerCase();
      Assert.assertTrue(
          "expected: " + expectedMessage.toLowerCase() + " got: " + gotMessage, //
          gotMessage.contains(expectedMessage.toLowerCase()));
    }
  }