WorkbenchLayoutInfoImpl implements WorkbenchLayoutInfo { @Override public int getHeaderHeight() { try { return workbenchLayout.getHeaderPanel().getBoundingClientRect().getHeight().intValue(); } catch (Exception e) { return 0; } }  @Override int getHeaderHeight();  }
@Test public void defaultToZeroWhenSomethingGoesWrong() throws Exception { assertEquals(0, workbenchLayoutInfo.getHeaderHeight()); }
@Test public void digTheHeightTheNormalWay() throws Exception { final Div div = mock(Div.class); final DOMClientRect domClientRect = mock(DOMClientRect.class); doReturn(div).when(workbenchLayout).getHeaderPanel(); doReturn(domClientRect).when(div).getBoundingClientRect(); doReturn(new Double(12)).when(domClientRect).getHeight(); assertEquals(12, workbenchLayoutInfo.getHeaderHeight()); }