@Test public void convertsReturnedIDToNSObjectSubclass() {
FromNativeConverter converter = new ObjCObjectTypeConverter(NSNumber.class);
// returning is based on declared type, see RococoaTypeMapper
NSNumber number = Rococoa.create("NSNumber", NSNumber.class, "numberWithInt:", 45);
// We can cope with 64 bits on 64 and 32
Number nativeValue = new Long(number.id().longValue());
NSNumber converted = (NSNumber) converter.fromNative(nativeValue, null);
assertEquals(converted.id(), number.id());
assertEquals(45, converted.intValue());
// We must cope with 32 bits on 32-bit
if (NativeLong.SIZE == 4) {
nativeValue = new Integer(number.id().intValue());
converted = (NSNumber) converter.fromNative(nativeValue, null);
assertEquals(45, converted.intValue());
}
}