/
BundleTest.java
35 lines (28 loc) · 1.02 KB
/
BundleTest.java
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
35
package com.rcpcompany.uibindings.moao.tests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.Dictionary;
import org.eclipse.core.runtime.Platform;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;
import org.osgi.framework.Bundle;
/**
* Tests the tested bundle dependencies are correct - e.g. it may not depend on org.eclipse.ui...
*
* @author Tonny Madsen, tonny.madsen@gmail.com
*/
public class BundleTest {
@Rule
public Timeout globalTimeout = new Timeout(60000); // 60 seconds max per method tested
@Test
public void testBundle() {
final Bundle bundle = Platform.getBundle(this.getClass().getPackage().getName().replace(".tests", ""));
assertNotNull("no bundle", bundle);
final Dictionary<String, String> headers = bundle.getHeaders();
assertNotNull("no headers", headers);
final String value = headers.get("Require-Bundle");
assertNotNull(value);
assertTrue("org.eclipse.ui used", !value.contains("org.eclipse.ui"));
}
}