Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 467f7ab5b0623be0a31370a21f36111acb92867a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package org.eclipse.jpt.jpadiagrameditor.swtbot.tests.ui.editor;

import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;

public class ConnectionIsShown extends DefaultCondition{
	
	private SWTBotGefEditPart entity;
	private int sourceConnectionSize;
	
	public ConnectionIsShown(SWTBotGefEditPart entity, int sourceConnectionSize){
		super();
		this.entity = entity;
		this.sourceConnectionSize = sourceConnectionSize;
	}
	
	public ConnectionIsShown(SWTBotGefEditPart entity){
		super();
		this.entity = entity;
	}

	public boolean test() throws Exception {
		if(sourceConnectionSize != 0) {
			return ((!entity.sourceConnections().isEmpty() && (entity.sourceConnections().size() == sourceConnectionSize + 1)) || !entity.targetConnections().isEmpty());
		}
		return (!entity.sourceConnections().isEmpty() || !entity.targetConnections().isEmpty());
	}

	public String getFailureMessage() {
		return "Relationship did not show.";
	}

}

Back to the top