@Test
    void verifyTempFilesIgnored() {
        val result = new AtomicBoolean(false);
        val mockAppContext = mock(ConfigurableApplicationContext.class);
        doAnswer(args -> {
            val clazz = args.getArgument(0).getClass();
            result.set(clazz.equals(CasRegisteredServiceDeletedEvent.class));
            return null;
        }).when(mockAppContext).publishEvent(any());
        val registry = new AbstractResourceBasedServiceRegistry(new ClassPathResource("services"),
            List.of(new RegisteredServiceJsonSerializer(mockAppContext)), mockAppContext,
            new ArrayList<>()) {
            @Override
            protected String[] getExtensions() {
                return new String[]{"json"};
            }
        };
        var results = registry.load();
        assertFalse(results.isEmpty());
        val watcher = new DeleteResourceBasedRegisteredServiceWatcher(registry);
        watcher.accept(new File(".Sample-1.json"));
        assertFalse(result.get());
        watcher.accept(new File("Sample-1.json.swp"));
        assertFalse(result.get());
        assertEquals(1, registry.size());
    }
This is {@link DeleteResourceBasedRegisteredServiceWatcherTests}.

@author Misagh Moayyed
@since 6.0.0
core/cas-server-core-services-registry/src/test/java/org/apereo/cas/services/resource/DeleteResourceBasedRegisteredServiceWatcherTests.java