Musings about this and that

March 12, 2009

Java Pearls: Why not copy the attribute’s value onto itself

Filed under: Java Pearls — ajesse @ 2:47 pm
Tags:

I like it, when values are set into attributes from where they have been fetched. Makes for readable code.

UserBean deputyChange = myTransferObject.getDeputy();
if (deputyChange != null && deputyChange.getUid() != null) {
  if (!checkUserRole(deputyChange.getUid(), FunctionGroups.ROLE_TO_CHECK.getRole())) {
    throw new IllegalArgumentException("Deputy user-id not valid: " + deputyChange.getUid());
  }
  myTransferObject.setDeputy(deputyChange);
  myContext.getMyBean().getMyOtherTransferObject().setAssistanceUserDetail(deputyChange);
}

Apart from the fact that the webapplications user gets a nice looking Exception Message in his browser if he selected the wrong user from a list… It really makes sense to set the originating attribute to the value it delivered just a few lines above…

March 5, 2009

JSFUnit 1.0.0.GA available

Filed under: JSF, JSFUnit, Unit Testing, UnitTest — ajesse @ 9:47 am

According to the projects website JSFUnit has gone live with release 1.0.0.
Time to get serious about JSF unit testing again.

Blog at WordPress.com.