@Test
    void verifyOperation() throws Throwable {
        val applicationContext = new StaticApplicationContext();
        applicationContext.refresh();
        
        System.setProperty("CAS_UID", "casuser");
        val usernameContext = RegisteredServiceUsernameProviderContext.builder()
            .registeredService(CoreAuthenticationTestUtils.getRegisteredService())
            .service(CoreAuthenticationTestUtils.getService())
            .principal(CoreAuthenticationTestUtils.getPrincipal("casuser"))
            .applicationContext(applicationContext)
            .build();
        val provider = new StaticRegisteredServiceUsernameProvider();
        provider.setValue("${#systemProperties['CAS_UID']}");
        assertEquals("casuser", provider.resolveUsername(usernameContext));

        val jsonFile = Files.createTempFile(RandomUtils.randomAlphabetic(8), ".json").toFile();
        MAPPER.writeValue(jsonFile, provider);
        val policyRead = MAPPER.readValue(jsonFile, StaticRegisteredServiceUsernameProvider.class);
        assertEquals(provider, policyRead);
    }
This is {@link StaticRegisteredServiceUsernameProviderTests}.

@author Misagh Moayyed
@since 7.0.0
core/cas-server-core-services-api/src/test/java/org/apereo/cas/services/StaticRegisteredServiceUsernameProviderTests.java