assertEquals("Incorrect exception thrown for invalid image file name", SWT.ERROR_INVALID_IMAGE, e);
public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String() {	String fileName = null;	try {		Image image = new Image(display, fileName);		image.dispose();		fail("No exception thrown for file name == null");	} catch (IllegalArgumentException e) {		assertEquals("Incorrect exception thrown for file name == null", SWT.ERROR_NULL_ARGUMENT, e);	}	try {		String pathName = "nonexistent.txt";		Image image = new Image(display, pathName);		image.dispose();		fail("No exception thrown for non-existent file name");	} catch (SWTException e) {		assertEquals("Incorrect exception thrown for non-existent file name", SWT.ERROR_IO, e);	}	// j2se and j2me(cdc) can load from a file name but, j2me(cldc) throws an exception	if (!isJ2ME()) {		try {			String pathName = getPath("empty.txt");			Image image = new Image(display, pathName);			image.dispose();			fail("No exception thrown for invalid file name");		} catch (SWTException e) {// Causes failure// TODO: Find out why//			assertEquals("Incorrect exception thrown for invalid file name", SWT.ERROR_UNSUPPORTED_FORMAT, e);		}			int numFormats = SwtTestCase.imageFormats.length;		fileName = SwtTestCase.invalidImageFilenames[0];		Display[] displays = {display, null};		for (int j = 0; j < displays.length; j++) {			Display tempDisplay = displays[j];			for (int i=0; i<numFormats; i++) {				String format = SwtTestCase.imageFormats[i];					try {					String pathName = getPath(fileName + "." + format);					Image image = new Image(display, pathName);					image.dispose();					fail("No exception thrown for invalid file name");				} catch (SWTException e) {//					 Bug 70167 - Image(Device, InputStream) throws incorrect exception for bad PNG//					 remove comment when bug is fixed.//					assertEquals("Incorrect exception thrown for invalid image file name", SWT.ERROR_INVALID_IMAGE, e);				}			}		}			try {			String pathName = getPath(SwtTestCase.invalidImageFilenames[1]);			Image image = new Image(display, pathName);			image.dispose();			fail("No exception thrown for invalid file name");		} catch (SWTException e) {//			 Causes failure//			 TODO: Find out why//			assertEquals("Incorrect exception thrown for invalid image file name", SWT.ERROR_INVALID_IMAGE, e);		}					// create valid images//		 Causes failure//		 TODO: Find out why/*		for (int j = 0; j < displays.length; j++) {			Display tempDisplay = displays[j];			int numFileNames = SwtTestCase.imageFilenames.length;			for (int k=0; k<numFileNames; k++) {				fileName = SwtTestCase.imageFilenames[k];				for (int i=0; i<numFormats; i++) {					String format = SwtTestCase.imageFormats[i];					String pathName = getPath(fileName + "." + format);					Image image = new Image(display, pathName);					image.dispose();				}			}		}*/	}}