TestLandmarkpublic class TestLandmark extends com.sun.midp.i3test.TestCase Tests for Landmark implementation. |
Methods Summary |
---|
void | Test1()Body of the test 1.
This test emulates a situation when the name
is null when Landmark is created.
Should be caused a NullPointerException.
QualifiedCoordinates testCoord = new QualifiedCoordinates(
0, 0, 0f, 0f, 0f);
AddressInfo testAddr = new AddressInfo();
try {
Landmark testLandmark = new Landmark(null, "Descr",
testCoord, testAddr);
fail("NullPointerException wasn't caused");
} catch (java.lang.NullPointerException e) {
assertTrue("NullPointerException was caused", true);
} catch (Throwable e) {
fail("Wrong exception was caused");
}
| void | Test2()Body of the test 2.
This test sets and checks the name
of landmark.
QualifiedCoordinates testCoord = new QualifiedCoordinates(
0, 0, 0f, 0f, 0f);
AddressInfo testAddr = new AddressInfo();
Landmark testLandmark = new Landmark("testName", "Descr",
testCoord, testAddr);
assertTrue(testLandmark.getName() == "testName");
| void | Test3()Body of the test 3.
This test sets and checks the description
of landmark.
QualifiedCoordinates testCoord = new QualifiedCoordinates(
0, 0, 0f, 0f, 0f);
AddressInfo testAddr = new AddressInfo();
Landmark testLandmark = new Landmark("Name", "testDescr",
testCoord, testAddr);
assertTrue(testLandmark.getDescription() == "testDescr");
| void | Test4()Body of the test 4.
This test sets and checks the coordinates
of landmark.
QualifiedCoordinates testCoord = new QualifiedCoordinates(
1, 2, 3f, 4f, 5f);
AddressInfo testAddr = new AddressInfo();
Landmark testLandmark = new Landmark("Name", "testDescr",
testCoord, testAddr);
QualifiedCoordinates savedCoord =
testLandmark.getQualifiedCoordinates();
assertTrue(savedCoord.getLatitude() ==
testCoord.getLatitude());
assertTrue(savedCoord.getLongitude() ==
testCoord.getLongitude());
assertTrue(savedCoord.getAltitude() ==
testCoord.getAltitude());
assertTrue(savedCoord.getHorizontalAccuracy() ==
testCoord.getHorizontalAccuracy());
assertTrue(savedCoord.getVerticalAccuracy() ==
testCoord.getVerticalAccuracy());
| public void | runTests()Tests execute
declare("Name is null when landmark is created");
Test1();
declare("Set/get name");
Test2();
declare("Set/get description");
Test3();
declare("Set/get coordinates");
Test4();
|
|