?? libraryimportertests.java
字號(hào):
/**
* Copyright (c) 2003-2005 Craig Setera
* All Rights Reserved.
* Licensed under the Eclipse Public License - v 1.0
* For more information see http://www.eclipse.org/legal/epl-v10.html
*/
package eclipseme.core.model;
import java.io.File;
import java.net.MalformedURLException;
import eclipseme.core.importer.LibraryImporter;
import eclipseme.core.model.ILibrary;
/**
* Type description
* <p />
* Copyright (c) 2003-2005 Craig Setera<br>
* All Rights Reserved.<br>
* Licensed under the Eclipse Public License - v 1.0<p/>
* <br>
* $Revision: 1.2 $
* <br>
* $Date: 2006/02/13 01:16:53 $
* <br>
* @author Craig Setera
*/
public class LibraryImporterTests extends AbstractCoreTestCase {
public void testCLDC10() throws Exception {
ILibrary library = initialLibraryTest("wtk.lib.cldc10");
// Test the API
assertTrue("Expected configuration", library.hasConfiguration());
API[] apis = library.getAPIs();
assertNotNull("APIs are null", apis);
assertEquals("API length", 1, apis.length);
API api = apis[0];
assertNotNull("API is null", api);
assertEquals("API Identifier", "CLDC", api.getIdentifier());
assertEquals("API version", new Version("1.0"), api.getVersion());
assertEquals("API type", APIType.CONFIGURATION, api.getType());
assertNotNull("Configuration API should not be null", library.getAPI(APIType.CONFIGURATION));
assertNull("Profile API should be null", library.getAPI(APIType.PROFILE));
}
public void testCLDC11() throws Exception {
ILibrary library = initialLibraryTest("wtk.lib.cldc11");
// Test the API
assertTrue("Expected configuration", library.hasConfiguration());
API[] apis = library.getAPIs();
assertNotNull("APIs are null", apis);
assertEquals("API length", 1, apis.length);
API api = apis[0];
assertNotNull("API is null", api);
assertEquals("API Identifier", "CLDC", api.getIdentifier());
assertEquals("API version", new Version("1.1"), api.getVersion());
assertEquals("API type", APIType.CONFIGURATION, api.getType());
assertNotNull("Configuration API should not be null", library.getAPI(APIType.CONFIGURATION));
assertNull("Profile API should be null", library.getAPI(APIType.PROFILE));
}
public void testMIDP10() throws Exception {
ILibrary library = initialLibraryTest("wtk.lib.midp10");
// Test the API
assertTrue("Expected profile", library.hasProfile());
API[] apis = library.getAPIs();
assertNotNull("APIs are null", apis);
assertEquals("API length", 1, apis.length);
API api = apis[0];
assertNotNull("API is null", api);
assertEquals("API Identifier", "MIDP", api.getIdentifier());
assertEquals("API version", new Version("1.0"), api.getVersion());
assertEquals("API type", APIType.PROFILE, api.getType());
assertNull("Configuration API should be null", library.getAPI(APIType.CONFIGURATION));
assertNotNull("Profile API should not be null", library.getAPI(APIType.PROFILE));
}
public void testMIDP20() throws Exception {
ILibrary library = initialLibraryTest("wtk.lib.midp20");
// Test the API
assertTrue("Expected profile", library.hasProfile());
API[] apis = library.getAPIs();
assertNotNull("APIs are null", apis);
assertEquals("API length", 1, apis.length);
API api = apis[0];
assertNotNull("API is null", api);
assertEquals("API Identifier", "MIDP", api.getIdentifier());
assertEquals("API version", new Version("2.0"), api.getVersion());
assertEquals("API type", APIType.PROFILE, api.getType());
assertNull("Configuration API should be null", library.getAPI(APIType.CONFIGURATION));
assertNotNull("Profile API should not be null", library.getAPI(APIType.PROFILE));
}
public void testJSR75() throws Exception {
ILibrary library = initialLibraryTest("wtk.lib.jsr75");
// Test the API
assertFalse("Expected not configuration", library.hasConfiguration());
assertFalse("Expected not profile", library.hasProfile());
API[] apis = library.getAPIs();
assertNotNull("APIs are null", apis);
assertEquals("API length", 1, apis.length);
API api = apis[0];
assertNotNull("API is null", api);
assertEquals("API Identifier", "JSR75", api.getIdentifier());
assertEquals("API version", new Version("1.0"), api.getVersion());
assertEquals("API type", APIType.OPTIONAL, api.getType());
assertNull("Configuration API should be null", library.getAPI(APIType.CONFIGURATION));
assertNull("Profile API should be null", library.getAPI(APIType.PROFILE));
}
public void testWTK1() throws Exception {
ILibrary library = initialLibraryTest("wtk1.lib.combined");
// Test the API
assertTrue("Expected configuration", library.hasConfiguration());
assertTrue("Expected profile", library.hasProfile());
API[] apis = library.getAPIs();
assertNotNull("APIs are null", apis);
assertEquals("API length", 2, apis.length);
assertNotNull("Configuration API should not be null", library.getAPI(APIType.CONFIGURATION));
assertNotNull("Profile API should not be null", library.getAPI(APIType.PROFILE));
}
/**
* @param fileProperty
* @return
* @throws MalformedURLException
*/
private ILibrary initialLibraryTest(String fileProperty) throws MalformedURLException {
File testJar = getFileForProperty(fileProperty);
assertNotNull("Library", testJar);
assertTrue(testJar + " does not exist", testJar.exists());
LibraryImporter importer = new LibraryImporter();
ILibrary library = importer.createLibraryFor(testJar);
assertNotNull("Library ", library);
assertEquals("Library file", testJar, library.toFile());
assertEquals("Library URL", testJar.toURL(), library.toURL());
return library;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -