public Method get(Object object) {
        return get(object, null);
    }
@Test
    void testCache() throws Exception {

        URL url = MethodCacheTest.class.getClassLoader().getResource("dummy").toURI().resolve(".").toURL();

        class MyLoader extends URLClassLoader {
            MyLoader() { super(new URL[] { url }, MethodCacheTest.class.getClassLoader()); }
            public Class<?> loadClass(String name) throws ClassNotFoundException {
                if (name.equals(Dummy.class.getName())) synchronized (getClassLoadingLock(name)) { return findClass(name); }
                else return super.loadClass(name);
            }
        }

        try (MyLoader myLoader = new MyLoader()) {
            Class<?> applicationClass = Dummy.class;
            Class<?> customClass = myLoader.loadClass(Dummy.class.getName());

            assertNotSame(applicationClass, customClass);
            assertSame(applicationClass.getName(), customClass.getName());

            MethodCache methods = new MethodCache("clone");
            AtomicBoolean updatedCache = new AtomicBoolean();
            Object applicationDummy = applicationClass.getConstructor().newInstance();
            Object customDummy = customClass.getConstructor().newInstance();

            Method applicationMethod = methods.get(applicationDummy, __ -> updatedCache.set(true));
            assertTrue(updatedCache.getAndSet(false), "cache was updated");

            Method cachedApplicationMethod = methods.get(applicationDummy, __ -> updatedCache.set(true));
            assertFalse(updatedCache.getAndSet(false), "cache was updated");

            Method customMethod = methods.get(customDummy, __ -> updatedCache.set(true));
            assertTrue(updatedCache.getAndSet(false), "cache was updated");

            Method cachedCustomMethod = methods.get(customDummy, __ -> updatedCache.set(true));
            assertFalse(updatedCache.getAndSet(false), "cache was updated");

            assertSame(applicationMethod, cachedApplicationMethod);
            assertNotSame(applicationMethod, customMethod);
            assertSame(customMethod, cachedCustomMethod);

            cachedApplicationMethod.invoke(applicationDummy);
            cachedCustomMethod.invoke(customDummy);
            assertThrows(IllegalArgumentException.class, () -> applicationMethod.invoke(customDummy));
            assertThrows(IllegalArgumentException.class, () -> customMethod.invoke(applicationDummy));

            Object noDummy = new NoDummy();
            Method noMethod = methods.get(noDummy, __ -> updatedCache.set(true));
            assertTrue(updatedCache.getAndSet(false), "cache was updated");
            assertNull(noMethod);

            Method cachedNoMethod = methods.get(noDummy, __ -> updatedCache.set(true));
            assertFalse(updatedCache.getAndSet(false), "cache was updated");
            assertNull(cachedNoMethod);
        }
    }