BundleInfo implements Serializable { public static BundleInfo fromKey(String key) { if (key == null || key.indexOf('/') == -1) { throw new IllegalArgumentException("Illegal bundle key: " + key); } String bucketKey = StringUtils.substringBeforeLast(key, "/"); String version = StringUtils.substringAfterLast(key, "/"); BundleBucketInfo bucketInfo = BundleBucketInfo.fromKey(bucketKey); return new BundleInfo(bucketInfo, version); } BundleInfo(String symbolicName, String version);  BundleInfo(String groupId, String symbolicName, String version);  BundleInfo(BundleBucketInfo bucketInfo, String version); static BundleInfo fromBundle(Bundle bundle); static BundleInfo fromKey(String key); static BundleInfo fromModuleInfo(String moduleId, String moduleVersion); String getGroupId(); String getKey(); String getSymbolicName(); String getVersion(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testFromKey() throws Exception { BundleInfo info = BundleInfo.fromKey("org.jahia.modules/article/2.0.0"); assertEquals("org.jahia.modules", info.getGroupId()); assertEquals("article", info.getSymbolicName()); assertEquals("2.0.0", info.getVersion()); info = BundleInfo.fromKey("article/2.0.0"); assertNull(info.getGroupId()); assertEquals("article", info.getSymbolicName()); assertEquals("2.0.0", info.getVersion()); }
@Test(expected = IllegalArgumentException.class) public void testInvalid() throws Exception { BundleInfo.fromKey("article"); }