static public void assertTopAligned(View first,View second,int margin){
  int[] xy=new int[2];
  first.getLocationOnScreen(xy);
  int firstTop=xy[1];
  second.getLocationOnScreen(xy);
  int secondTop=xy[1];
  assertEquals("views are not top aligned",Math.abs(firstTop - secondTop),margin);
}

static public void assertTopAligned ( View first , View second , int margin ) { int [ ] xy = new int [ 2 ] ; first . getLocationOnScreen ( xy ) ; int firstTop = xy [ 1 ] ; second . getLocationOnScreen ( xy ) ; int secondTop = xy [ 1 ] ; assertEquals ( "views are not top aligned" , Math . abs ( firstTop - secondTop ) , margin ) ; }
assert that two views are top aligned , that is that their top edges are on the same y location , with respect to the specified margin .
