LicenseManager { public String tryGetRegisteredLicenseName(T ownerModel, LicenseHeaderInfo headerInfo) { return impl.tryGetRegisteredLicenseName(ownerModel, headerInfo); } <LK, LD extends LicenseDef> LicenseManager(
            TaskExecutor executor,
            LicenseStore<LD> licenseStore,
            BiFunction<? super T, ? super LicenseHeaderInfo, ? extends LK> licenseKeyFactory,
            BiFunction<? super T, ? super LK, ? extends LD> licenseDefFactory); String tryGetRegisteredLicenseName(T ownerModel, LicenseHeaderInfo headerInfo); PropertySource<CloseableAction> getRegisterListenerAction(
            PropertySource<? extends T> modelProperty,
            PropertySource<? extends LicenseHeaderInfo> headerProperty);  }
@Test public void testGetOnEmpty() { MemLicenseStore licenseStore = new MemLicenseStore(); LicenseManager<String> manager = createTestManager(licenseStore); LicenseHeaderInfo info = testLicenseInfo("LicenseName", "LicenseFile"); assertNull(manager.tryGetRegisteredLicenseName("TestModel", info)); licenseStore.assertEmpty(); }
@Test public void testWithoutLicenseFileAndWithoutRegistering() { MemLicenseStore licenseStore = new MemLicenseStore(); LicenseManager<String> manager = createTestManager(licenseStore); LicenseHeaderInfo info = testLicenseInfo("LicenseName", null); licenseStore.addToStore(info); String licenseId = manager.tryGetRegisteredLicenseName("TestModel", info); assertEquals(info.getLicenseName(), licenseId); }
@Test public void testWithoutLicenseFileAndWithoutRegisteringNotInStore() { MemLicenseStore licenseStore = new MemLicenseStore(); LicenseManager<String> manager = createTestManager(licenseStore); LicenseHeaderInfo info = testLicenseInfo("LicenseName", null); assertNull(manager.tryGetRegisteredLicenseName("TestModel", info)); }