How to use assertNotSame method of junit.framework.TestCase class

Best junit code snippet using junit.framework.TestCase.assertNotSame

Run junit automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

copy
1/**
2 * 
3 */
4package gov.nasa.worldwind.formats.models.loader;
5
6import gov.nasa.worldwind.formats.models.ModelLoadException;
7import gov.nasa.worldwind.formats.models.geometry.Mesh;
8import gov.nasa.worldwind.formats.models.geometry.Model;
9import junit.framework.TestCase;
10
11/**
12 * @author Tisham
13 *
14 */
15public class ColladaTest extends TestCase {
16
17	/**
18	 * @param name
19	 */
20	public ColladaTest(String name) {
21		super(name);
22	}
23
24	/* (non-Javadoc)
25	 * @see junit.framework.TestCase#setUp()
26	 */
27	protected void setUp() throws Exception {
28		super.setUp();
29	}
30
31	/* (non-Javadoc)
32	 * @see junit.framework.TestCase#tearDown()
33	 */
34	protected void tearDown() throws Exception {
35		super.tearDown();
36	}
37
38	/**
39	 * Test method for {@link gov.nasa.worldwind.formats.models.loader.ColladaLoader#load(java.lang.String)}.
40	 */
41	public void testLoad() {
42		ColladaLoader loader = new ColladaLoader();
43		Model m = null;
44		try {
45			m = loader.load("testmodels/collada.dae");
46		} catch (ModelLoadException e) {
47			//e.printStackTrace();
48		}
49		assertNotNull(m);
50		assertNotSame(0,m.getNumberOfMeshes());
51		Mesh mesh = m.getMesh(0);
52		assertNotNull(mesh);
53		assertNotNull(mesh.vertices);
54		assertNotSame(0, mesh.numOfVerts);
55		assertNotNull(mesh.faces);
56		assertNotSame(0,mesh.numOfFaces);
57		assertNotNull(mesh.normals);
58		//Collada normals equate to number of faces
59		assertEquals(mesh.normals.length, mesh.numOfFaces);
60		assertNotNull(m.getMaterial(0));
61		
62		try {
63			m = loader.load("testmodels/superdome.dae");
64		} catch (ModelLoadException e) {
65			//e.printStackTrace();
66		}
67		assertNotNull(m);
68		assertNotSame(0,m.getNumberOfMeshes());
69		mesh = m.getMesh(0);
70		assertNotNull(mesh);
71		assertNotNull(mesh.vertices);
72		assertNotSame(0, mesh.numOfVerts);
73		assertNotNull(mesh.faces);
74		assertNotSame(0,mesh.numOfFaces);
75		assertNotNull(mesh.normals);
76		//Collada normals equate to number of faces
77//		assertEquals(mesh.normals.length, mesh.numOfFaces);
78		assertNotNull(m.getMaterial(0));
79		//5th(4 ordinal from 0) Material has a texture
80		assertNotNull(m.getMaterial(4));
81		assertNotNull(m.getMaterial(4).strFile);
82		assertEquals("../images/texture1.jpg", m.getMaterial(4).strFile);
83	}
84
85}
86
Full Screen
copy
1/**
2 * 
3 */
4package gov.nasa.worldwind.formats.models.loader;
5
6import junit.framework.TestCase;
7import net.java.joglutils.model.geometry.Mesh;
8import net.java.joglutils.model.geometry.Model;
9import net.java.joglutils.model.loader.MaxLoader;
10
11/**
12 * @author Tisham
13 *
14 */
15public class MaxLoaderTest extends TestCase {
16
17	/**
18	 * @param name
19	 */
20	public MaxLoaderTest(String name) {
21		super(name);
22	}
23
24	/* (non-Javadoc)
25	 * @see junit.framework.TestCase#setUp()
26	 */
27	protected void setUp() throws Exception {
28		super.setUp();
29	}
30
31	/* (non-Javadoc)
32	 * @see junit.framework.TestCase#tearDown()
33	 */
34	protected void tearDown() throws Exception {
35		super.tearDown();
36	}
37
38	/**
39	 * Test method for {@link gov.nasa.worldwind.formats.models.loader.MaxLoader#load(java.lang.String)}.
40	 */
41	public void testLoadString() {
42		MaxLoader loader = new MaxLoader();
43		Model m = null;
44		
45		m = loader.load("testmodels/spaceship.3ds");
46		 
47		assertNotNull(m);
48		assertNotSame(0,m.getNumberOfMeshes());
49		Mesh mesh = m.getMesh(0);
50		assertNotNull(mesh);
51		assertNotNull(mesh.vertices);
52		assertNotSame(0, mesh.numOfVerts);
53		assertNotNull(mesh.faces);
54		assertNotSame(0,mesh.numOfFaces);
55		assertNotNull(mesh.normals);
56		//Max normals equate to number of vertices
57		assertEquals(mesh.normals.length, mesh.numOfVerts);
58		//Ensure we have a material
59		assertNotNull(m.getMaterial(0));
60		//We have a texture materials string file is not null
61		assertNotNull(m.getMaterial(0).strFile);
62		assertTrue(m.getMaterial(0).strFile.
63				equalsIgnoreCase("POLYSHIP.JPG"));
64	}
65
66}
67
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger assertNotSame code on LambdaTest Cloud Grid

Execute automation tests with assertNotSame on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)