本文整理汇总了Java中junit.framework.TestCase.assertNotNull方法的典型用法代码示例。如果您正苦于以下问题:Java TestCase.assertNotNull方法的具体用法?Java TestCase.assertNotNull怎么用?Java TestCase.assertNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junit.framework.TestCase
的用法示例。
在下文中一共展示了TestCase.assertNotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: incCheckNested
import junit.framework.TestCase; //导入方法依赖的package包/类
public static void incCheckNested(String message, Document doc,
TokenSequence<?> batch, TokenHierarchy<?> batchTH,
TokenSequence<?> inc, TokenHierarchy<?> incTH
) {
int i = 0;
while (inc.moveNext()) {
TestCase.assertTrue("No more tokens in batch token sequence", batch.moveNext());
TokenSequence<?> batchE = batch.embedded();
TokenSequence<?> incE = inc.embedded();
String messageE = message + "->[" + i + "]";
if (incE != null) {
TestCase.assertNotNull("Batch embedded sequence is null", batchE);
assertTokenSequencesEqual(messageE, batchE, batchTH, incE, incTH, true, true);
incE.moveStart();
batchE.moveStart();
incCheckNested(messageE, doc, batchE, batchTH, incE, incTH);
} else { // Inc embedded is null
TestCase.assertNull("Batch embedded sequence non-null", batchE);
}
i++;
}
}
示例2: convertMultiPolygon
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test the PolyhedralSurface conversion
*
* @param converter
* @param polyhedralSurface
*/
private static void convertMultiPolygon(GoogleMapShapeConverter converter,
PolyhedralSurface polyhedralSurface) {
MultiPolygonOptions mapPolygons = converter
.toPolygons(polyhedralSurface);
TestCase.assertNotNull(mapPolygons);
TestCase.assertFalse(mapPolygons.getPolygonOptions().isEmpty());
List<Polygon> polygons = polyhedralSurface.getPolygons();
comparePolygonsAndMapPolygons(converter, polygons, mapPolygons.getPolygonOptions());
PolyhedralSurface polyhedralSurface2 = converter
.toPolyhedralSurfaceWithOptions(mapPolygons);
comparePolygons(polygons, polyhedralSurface.getPolygons());
}
示例3: convertMultiLineString
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test the MultiLineString conversion
*
* @param converter
* @param multiLineString
*/
private static void convertMultiLineString(
GoogleMapShapeConverter converter, MultiLineString multiLineString) {
MultiPolylineOptions polylines = converter.toPolylines(multiLineString);
TestCase.assertNotNull(polylines);
TestCase.assertFalse(polylines.getPolylineOptions().isEmpty());
List<LineString> lineStrings = multiLineString.getLineStrings();
compareLineStringsAndPolylines(converter, lineStrings,
polylines.getPolylineOptions());
MultiLineString multiLineString2 = converter
.toMultiLineStringFromOptions(polylines);
compareLineStrings(lineStrings, multiLineString2.getLineStrings());
}
示例4: getJoinedBodies
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests the getJoinedBodies method.
*/
@Test
public void getJoinedBodies() {
Body b1 = new Body();
Body b2 = new Body();
List<Body> bodies = b1.getJoinedBodies();
TestCase.assertNotNull(bodies);
TestCase.assertTrue(bodies.isEmpty());
Joint j = new DistanceJoint(b1, b2, new Vector2(), new Vector2());
JointEdge je1 = new JointEdge(b2, j);
JointEdge je2 = new JointEdge(b1, j);
b1.joints.add(je1);
b2.joints.add(je2);
bodies = b1.getJoinedBodies();
TestCase.assertNotNull(bodies);
TestCase.assertFalse(bodies.isEmpty());
TestCase.assertSame(b2, bodies.get(0));
}
示例5: convertPolygon
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test the Polygon conversion
*
* @param converter
* @param polygon
*/
private static void convertPolygon(GoogleMapShapeConverter converter,
Polygon polygon) {
PolygonOptions polygonOptions = converter.toPolygon(polygon);
TestCase.assertNotNull(polygonOptions);
comparePolygonAndMapPolygon(converter, polygon, polygonOptions);
Polygon polygon2 = converter.toPolygon(polygonOptions);
comparePolygons(polygon, polygon2);
}
示例6: processResponse
import junit.framework.TestCase; //导入方法依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceived) {
try {
ResponseEventExt responseReceivedEvent = (ResponseEventExt) responseReceived;
Response response = (Response) responseReceivedEvent.getResponse();
ClientTransaction tid = responseReceivedEvent.getClientTransaction();
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
logger.info("Response received : Status Code = "
+ response.getStatusCode() + " " + cseq);
logger.info("Response = " + response + " class=" + response.getClass() );
Dialog dialog = responseReceivedEvent.getDialog();
this.forkedDialogs.add(dialog);
if(createDialogAfterRequest) {
TestCase.assertNull( dialog );
return;
} else {
TestCase.assertNotNull( dialog );
}
System.out.println("original Tx " + responseReceivedEvent.getOriginalTransaction());
if (tid != null)
logger.info("transaction state is " + tid.getState());
else
logger.info("transaction = " + tid);
logger.info("Dialog = " + dialog);
logger.info("Dialog state is " + dialog.getState());
if ( response.getStatusCode() == Response.OK && cseq.getMethod().equals(Request.INVITE) ) {
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
dialog.sendAck(ackRequest);
this.timer.schedule( new SendBye(dialog),500);
}
} catch (Throwable ex) {
ex.printStackTrace();
// System.exit(0);
}
}
示例7: assertNotNull
import junit.framework.TestCase; //导入方法依赖的package包/类
public static void assertNotNull(String reason, Object thing) {
if (thing != null) {
logSuccess("assertNotNull " + reason);
} else {
logFailure(reason);
}
TestCase.assertNotNull(reason, thing);
}
示例8: getUserData
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Make sure the user data is stored.
*/
@Test
public void getUserData() {
String obj = "hello";
Body b = new Body();
TestCase.assertNull(b.getUserData());
b.setUserData(obj);
TestCase.assertNotNull(b.getUserData());
TestCase.assertSame(obj, b.getUserData());
}
示例9: getFixtureByPoint
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests getting fixtures using a world space point.
*
* @since 3.1.8
*/
@Test
public void getFixtureByPoint() {
Body b = new Body();
b.addFixture(Geometry.createCircle(1.0));
BodyFixture bf = b.addFixture(Geometry.createUnitCirclePolygon(5, 1.0));
bf.getShape().translate(0.5, 0);
// test not in body
bf = b.getFixture(new Vector2(-1.0, -1.0));
TestCase.assertNull(bf);
// confirm there are two fixtures at this location
TestCase.assertEquals(2, b.getFixtures(new Vector2(0.5, 0.25)).size());
// test getting the first one
bf = b.getFixture(new Vector2(0.5, 0.25));
TestCase.assertNotNull(bf);
TestCase.assertTrue(bf.getShape() instanceof Circle);
// test not in body
List<BodyFixture> bfs = b.getFixtures(new Vector2(-1.0, -1.0));
TestCase.assertNotNull(bfs);
TestCase.assertEquals(0, bfs.size());
// test in body remove one
bfs = b.getFixtures(new Vector2(1.25, 0.10));
TestCase.assertNotNull(bfs);
TestCase.assertEquals(1, bfs.size());
TestCase.assertTrue(bfs.get(0).getShape() instanceof Polygon);
// test in body remove both
bfs = b.getFixtures(new Vector2(0.75, 0.10));
TestCase.assertNotNull(bfs);
TestCase.assertEquals(2, bfs.size());
}
示例10: getAxes
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests the getAxes method.
*/
@Test
public void getAxes() {
Vector2[] vertices = new Vector2[]{
new Vector2(0.0, 1.0),
new Vector2(-1.0, -1.0),
new Vector2(1.0, -1.0)
};
Polygon p = new Polygon(vertices);
Transform t = new Transform();
Vector2[] axes = p.getAxes(null, t);
TestCase.assertNotNull(axes);
TestCase.assertEquals(3, axes.length);
// test passing some focal points
Vector2 pt = new Vector2(-3.0, 2.0);
axes = p.getAxes(new Vector2[]{pt}, t);
TestCase.assertEquals(4, axes.length);
// make sure the axes are perpendicular to the edges
Vector2 ab = p.vertices[0].to(p.vertices[1]);
Vector2 bc = p.vertices[1].to(p.vertices[2]);
Vector2 ca = p.vertices[2].to(p.vertices[0]);
TestCase.assertEquals(0.000, ab.dot(axes[0]), 1.0e-3);
TestCase.assertEquals(0.000, bc.dot(axes[1]), 1.0e-3);
TestCase.assertEquals(0.000, ca.dot(axes[2]), 1.0e-3);
// make sure that the focal axes are correct
TestCase.assertEquals(0.000, p.vertices[0].to(pt).cross(axes[3]), 1.0e-3);
}
示例11: convertLineString
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test the LineString conversion
*
* @param converter
* @param lineString
*/
private static void convertLineString(GoogleMapShapeConverter converter,
LineString lineString) {
PolylineOptions polyline = converter.toPolyline(lineString);
TestCase.assertNotNull(polyline);
compareLineStringAndPolyline(converter, lineString, polyline);
LineString lineString2 = converter.toLineString(polyline);
compareLineStrings(lineString, lineString2);
}
示例12: convertMultiPoint
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Test the MultiPoint conversion
*
* @param converter
* @param multiPoint
*/
private static void convertMultiPoint(GoogleMapShapeConverter converter,
MultiPoint multiPoint) {
MultiLatLng latLngs = converter.toLatLngs(multiPoint);
TestCase.assertNotNull(latLngs);
TestCase.assertFalse(latLngs.getLatLngs().isEmpty());
List<Point> points = multiPoint.getPoints();
comparePointsAndLatLngs(converter, points, latLngs.getLatLngs());
MultiPoint multiPoint2 = converter.toMultiPoint(latLngs);
comparePoints(multiPoint.getPoints(), multiPoint2.getPoints());
}
示例13: getUserData
import junit.framework.TestCase; //导入方法依赖的package包/类
/**
* Tests the getProperty/set of the user data.
*/
@Test
public void getUserData() {
String obj = "hello";
World w = new World();
TestCase.assertNull(w.getUserData());
w.setUserData(obj);
TestCase.assertNotNull(w.getUserData());
TestCase.assertSame(obj, w.getUserData());
}
示例14: assertStartVertex
import junit.framework.TestCase; //导入方法依赖的package包/类
private void assertStartVertex() {
SWTBotGefEditPart botPart = editor.getEditPart(Constant.START_VERTEX_NAME);
TestCase.assertNotNull(botPart);
TestCase.assertTrue(botPart.part() instanceof StartVertexPart);
}
示例15: assertVertex
import junit.framework.TestCase; //导入方法依赖的package包/类
private void assertVertex(String name) {
SWTBotGefEditPart botPart = editor.getEditPart(name);
TestCase.assertNotNull(botPart);
TestCase.assertTrue(botPart.part() instanceof VertexPart);
}