Source:
<code>private void checkNoteLabelAlignment(SWTBotGefEditPart editPart) { assertNotNull("The edit part shouldn't be null for the note label", editPart); EditPart part = editPart.part(); assertTrue("The edit part of the note label should an instance of SiriusDescriptionCompartmentEditPart", part instanceof SiriusDescriptionCompartmentEditPart); EditPart parentPart = part.getParent(); assertTrue("The edit part of the note should an instance of SiriusNoteEditPart", parentPart instanceof SiriusNoteEditPart); IFigure noteFigure = ((SiriusNoteEditPart) parentPart).getFigure(); assertTrue("The figure of the note should an instance of NoteFigure", noteFigure instanceof NoteFigure); Rectangle noteFigureBounds = noteFigure.getBounds(); Border noteFigureBorder = noteFigure.getBorder(); Insets noteFigureInsets = noteFigureBorder.getInsets(noteFigure); IFigure wrapLabelFigure = ((SiriusDescriptionCompartmentEditPart) part).getFigure(); assertTrue("The figure of the note label should an instance of WrappingLabel", wrapLabelFigure instanceof WrappingLabel); List<?> childrenFigure = wrapLabelFigure.getChildren(); assertSame("The figure of the note label should have only one child", 1, childrenFigure.size()); Object flowPageFigure = childrenFigure.get(0); assertTrue("The figure of the note label child should be an instance of FlowPage", flowPageFigure instanceof FlowPage); Rectangle flowPageBounds = ((FlowPage) flowPageFigure).getBounds(); int middleOfTheNoteX = noteFigureBounds.x + ((noteFigureBounds.width + noteFigureInsets.left - noteFigureInsets.right) / 2); int middleOfTheLabelX = flowPageBounds.x + flowPageBounds.width / 2; assertEquals("The label should be centered in the note", middleOfTheNoteX, middleOfTheLabelX, 2); int middleOfTheNoteY = noteFigureBounds.y + noteFigureBounds.height / 2; int beginingOfTheLabelY = flowPageBounds.y; int endOfTheLabelY = flowPageBounds.y + flowPageBounds.height; assertTrue("The label should be at the top of the note", beginingOfTheLabelY < middleOfTheNoteY); assertTrue("The label should be <START> centered of <END> the note", endOfTheLabelY < middleOfTheNoteY); }</code><technical_language>top</technical_language>

Target:
private void checkNoteLabelAlignment(SWTBotGefEditPart editPart) { assertNotNull("The edit part shouldn't be null for the note label", editPart); EditPart part = editPart.part(); assertTrue("The edit part of the note label should an instance of SiriusDescriptionCompartmentEditPart", part instanceof SiriusDescriptionCompartmentEditPart); EditPart parentPart = part.getParent(); assertTrue("The edit part of the note should an instance of SiriusNoteEditPart", parentPart instanceof SiriusNoteEditPart); IFigure noteFigure = ((SiriusNoteEditPart) parentPart).getFigure(); assertTrue("The figure of the note should an instance of NoteFigure", noteFigure instanceof NoteFigure); Rectangle noteFigureBounds = noteFigure.getBounds(); Border noteFigureBorder = noteFigure.getBorder(); Insets noteFigureInsets = noteFigureBorder.getInsets(noteFigure); IFigure wrapLabelFigure = ((SiriusDescriptionCompartmentEditPart) part).getFigure(); assertTrue("The figure of the note label should an instance of WrappingLabel", wrapLabelFigure instanceof WrappingLabel); List<?> childrenFigure = wrapLabelFigure.getChildren(); assertSame("The figure of the note label should have only one child", 1, childrenFigure.size()); Object flowPageFigure = childrenFigure.get(0); assertTrue("The figure of the note label child should be an instance of FlowPage", flowPageFigure instanceof FlowPage); Rectangle flowPageBounds = ((FlowPage) flowPageFigure).getBounds(); int middleOfTheNoteX = noteFigureBounds.x + ((noteFigureBounds.width + noteFigureInsets.left - noteFigureInsets.right) / 2); int middleOfTheLabelX = flowPageBounds.getCenter().x; assertEquals("The label should be centered in the note", middleOfTheNoteX, middleOfTheLabelX, 2); int middleOfTheNoteY = noteFigureBounds.getCenter().y; int beginingOfTheLabelY = flowPageBounds.y; int endOfTheLabelY = flowPageBounds.y + flowPageBounds.height; assertTrue("The label should be at the top of the note", beginingOfTheLabelY < middleOfTheNoteY); assertTrue("The label should be centered of the note", endOfTheLabelY < middleOfTheNoteY); }