|
20 | 20 | package com.sap.prd.mobile.ios.mios.xcodeprojreader.jaxb; |
21 | 21 |
|
22 | 22 | import static org.junit.Assert.assertEquals; |
| 23 | +import static org.junit.Assert.assertFalse; |
23 | 24 | import static org.junit.Assert.assertNotNull; |
| 25 | +import static org.junit.Assert.assertTrue; |
24 | 26 |
|
25 | 27 | import java.io.ByteArrayInputStream; |
26 | 28 | import java.io.File; |
|
34 | 36 |
|
35 | 37 | import junit.framework.Assert; |
36 | 38 |
|
| 39 | +import org.apache.commons.lang3.SystemUtils; |
37 | 40 | import org.custommonkey.xmlunit.XMLAssert; |
38 | 41 | import org.custommonkey.xmlunit.XMLUnit; |
39 | 42 | import org.junit.Test; |
@@ -93,9 +96,19 @@ public void convertOpenStepToXML() throws Exception |
93 | 96 | File xmlProj = File.createTempFile("project", ".pbxproj"); |
94 | 97 | xmlProj.deleteOnExit(); |
95 | 98 |
|
96 | | - parser.convert(fileNameOpenStep, xmlProj.getAbsolutePath()); |
97 | | - Plist plist = parser.load(xmlProj.getAbsolutePath()); |
98 | | - assertEquals("1.0", plist.getVersion()); |
| 99 | + try |
| 100 | + { |
| 101 | + parser.convert(fileNameOpenStep, xmlProj.getAbsolutePath()); |
| 102 | + Plist plist = parser.load(xmlProj.getAbsolutePath()); |
| 103 | + assertEquals("1.0", plist.getVersion()); |
| 104 | + } |
| 105 | + catch (UnsupportedOperationException ex) |
| 106 | + { |
| 107 | + // If we are running on a non Mac OS X system an UnsupportedOperationException is expected |
| 108 | + assertFalse("The convert function should only fail on non Mac OS X systems", SystemUtils.IS_OS_MAC_OSX); |
| 109 | + assertTrue("Wrong UnsupportedOperationException message", ex.getMessage().contains("Mac OS X")); |
| 110 | + } |
| 111 | + |
99 | 112 | } |
100 | 113 |
|
101 | 114 | @Test(expected = javax.xml.bind.UnmarshalException.class) |
|
0 commit comments