?? bluetoothlocationprovidertest.java
字號(hào):
package org.j4me.bluetoothgps;
import j2meunit.framework.*;
import org.j4me.*;
/**
* Tests the <code>BluetoothLocationProvider</code> class. It is responsible for mapping
* between JSR 179's <code>LocationProvider</code> interface and <code>BluetoothGPS</code>.
*
* @see org.j4me.bluetoothgps.BluetoothLocationProvider
*/
public class BluetoothLocationProviderTest
extends J4METestCase
{
public BluetoothLocationProviderTest ()
{
super();
}
public BluetoothLocationProviderTest (String name, TestMethod method)
{
super( name, method );
}
public Test suite ()
{
TestSuite suite = new TestSuite();
suite.addTest(new BluetoothLocationProviderTest("testConstructBTURL", new TestMethod()
{ public void run(TestCase tc) {((BluetoothLocationProviderTest) tc).testConstructBTURL(); } }));
return suite;
}
/**
* Tests the <code>constructBTURL</code> method.
* <p>
* Bluetooth GPS URLs should look like the following example:
* <pre><code>
* btspp://0123456789:1;master=false;encrypt=false;authenticate=false
* </code></pre>
*/
public void testConstructBTURL ()
{
String fullURL = "btspp://0123456789:1;master=false;encrypt=false;authenticate=false";
String channel = "1";
String addressOnly = "0123456789";
String withoutChannel = "btspp://0123456789";
String withoutParams = "btspp://0123456789:1";
String withoutProtocol = "0123456789:1;master=false;encrypt=false;authenticate=false";
// Test if we put in the address only we get out the whole URL.
String result = BluetoothLocationProvider.constructBTURL( addressOnly, channel );
assertEquals("Address only", fullURL, result);
// Test with whole URL.
result = BluetoothLocationProvider.constructBTURL( fullURL, channel );
assertEquals("Whole URL", fullURL, result);
// Test without the channel.
result = BluetoothLocationProvider.constructBTURL( withoutChannel, channel );
assertEquals("Missing channel and parameters", fullURL, result);
// Test without params.
result = BluetoothLocationProvider.constructBTURL( withoutParams, channel );
assertEquals("Missing parameters", fullURL, result);
// Test without the protocol.
result = BluetoothLocationProvider.constructBTURL( withoutProtocol, channel );
assertEquals("Missing protocol", fullURL, result);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -