@Test public void testDecideNotificationForIntygBasedOnDraft() { final var unitId = "unitId"; final var certificateType = "certificateType"; final var draft = mock(Utkast.class); doReturn(unitId).when(draft).getEnhetsId(); doReturn(certificateType).when(draft).getIntygsTyp(); final var schemaVersion = SchemaVersion.VERSION_3; final var optionalSchemaVersion = Optional.of(schemaVersion); doReturn(optionalSchemaVersion).when(integreradeEnheterRegistry).getSchemaVersion(unitId, certificateType); final var actualOptionalSchemaVersion = defaultSendNotificationStrategy.decideNotificationForIntyg(draft); assertNotNull(actualOptionalSchemaVersion); assertEquals(optionalSchemaVersion.isPresent(), actualOptionalSchemaVersion.isPresent()); assertEquals(optionalSchemaVersion.get(), actualOptionalSchemaVersion.get()); }
@Override public Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast) { Optional<SchemaVersion> schemaVersion = integreradeEnheterRegistry.getSchemaVersion(utkast.getEnhetsId(), utkast.getIntygsTyp()); if (!schemaVersion.isPresent()) { LOG.debug("Utkast '{}' (type = '{}', unit = '{}') will not spawn notifications", utkast.getIntygsId(), utkast.getIntygsTyp(), utkast.getEnhetsId()); } return schemaVersion; }
DefaultSendNotificationStrategyImpl implements SendNotificationStrategy { @Override public Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast) { Optional<SchemaVersion> schemaVersion = integreradeEnheterRegistry.getSchemaVersion(utkast.getEnhetsId(), utkast.getIntygsTyp()); if (!schemaVersion.isPresent()) { LOG.debug("Utkast '{}' (type = '{}', unit = '{}') will not spawn notifications", utkast.getIntygsId(), utkast.getIntygsTyp(), utkast.getEnhetsId()); } return schemaVersion; } }
DefaultSendNotificationStrategyImpl implements SendNotificationStrategy { @Override public Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast) { Optional<SchemaVersion> schemaVersion = integreradeEnheterRegistry.getSchemaVersion(utkast.getEnhetsId(), utkast.getIntygsTyp()); if (!schemaVersion.isPresent()) { LOG.debug("Utkast '{}' (type = '{}', unit = '{}') will not spawn notifications", utkast.getIntygsId(), utkast.getIntygsTyp(), utkast.getEnhetsId()); } return schemaVersion; }  }
DefaultSendNotificationStrategyImpl implements SendNotificationStrategy { @Override public Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast) { Optional<SchemaVersion> schemaVersion = integreradeEnheterRegistry.getSchemaVersion(utkast.getEnhetsId(), utkast.getIntygsTyp()); if (!schemaVersion.isPresent()) { LOG.debug("Utkast '{}' (type = '{}', unit = '{}') will not spawn notifications", utkast.getIntygsId(), utkast.getIntygsTyp(), utkast.getEnhetsId()); } return schemaVersion; }  @Override Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast); @Override Optional<SchemaVersion> decideNotificationForIntyg(Utlatande certificate); }
DefaultSendNotificationStrategyImpl implements SendNotificationStrategy { @Override public Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast) { Optional<SchemaVersion> schemaVersion = integreradeEnheterRegistry.getSchemaVersion(utkast.getEnhetsId(), utkast.getIntygsTyp()); if (!schemaVersion.isPresent()) { LOG.debug("Utkast '{}' (type = '{}', unit = '{}') will not spawn notifications", utkast.getIntygsId(), utkast.getIntygsTyp(), utkast.getEnhetsId()); } return schemaVersion; }  @Override Optional<SchemaVersion> decideNotificationForIntyg(Utkast utkast); @Override Optional<SchemaVersion> decideNotificationForIntyg(Utlatande certificate);  }