Layouts { public static int heightOrDefault(PanelDefinition def) { Integer height = toInteger(def.getHeightAsInt()); return height == null ? DEFAULT_CHILD_SIZE : height; }  static void setToFillParent(Widget w); static String getContainmentHierarchy(Widget w); static String getContainmentHierarchy(Widget w,
                                                 boolean setDebugIds); static String getContainedHierarchy(final Widget startAt); static int widthOrHeight(CompassPosition position,
                                    PanelDefinition definition); static int heightOrDefault(PanelDefinition def); static int widthOrDefault(PanelDefinition def); static boolean disableNearestScrollPanel(Widget w); static final int DEFAULT_CHILD_SIZE; }
@Test public void heightOrDefault() { when(panelDef.getHeightAsInt()).thenReturn(42); Integer height = Layouts.heightOrDefault(panelDef); assertEquals(42, height.intValue()); when(panelDef.getHeightAsInt()).thenReturn(-1); height = Layouts.heightOrDefault(panelDef); assertEquals(Layouts.DEFAULT_CHILD_SIZE, height.intValue()); }