Foundation { public static Selector selector(String selectorName) { Selector cached = selectorCache.get(selectorName); if (cached != null) { return cached; } Selector result = foundationLibrary.sel_registerName(selectorName).initName(selectorName); selectorCache.put(selectorName, result); return result; } private  Foundation(); static void nsLog(String format, Object thing); static ID cfString(String s); static ID cfRetain(ID id); static void cfRelease(ID id); static int cfGetRetainCount(ID cfTypeRef); static String toString(ID cfString); static ID getClass(String className); static Selector selector(String selectorName); static T send(ID receiver, String selectorName, Class<T> returnType, Object... args); @SuppressWarnings("unchecked") static T send(ID receiver, Selector selector, Class<T> returnType, Object... args); static ID sendReturnsID(ID receiver, String selectorName, Object... args); static void sendReturnsVoid(ID receiver, String selectorName, Object... args); static boolean isMainThread(); static T callOnMainThread(final Callable<T> callable); static void runOnMainThread(final Runnable runnable); static void runOnMainThread(Runnable runnable, boolean waitUntilDone); static ID newOCProxy(OCInvocationCallbacks callbacks); static boolean selectorNameMeansWeOwnReturnedObject(String selectorName);  }
@Test public void testSelector() { Selector selector = Foundation.selector("selectorName:"); assertTrue(selector.longValue() != 0); assertSame("selectorName:", selector.getName()); Selector noSuchSelector = Foundation.selector("noSelector:NamedThis:OrribleThing:"); assertTrue(noSuchSelector.longValue() != 0); assertSame("noSelector:NamedThis:OrribleThing:", noSuchSelector.getName()); }