@Test
public void storeSecrets_noKey() {

    //GIVEN
    final TypedSecret typedSecret = new TypedSecret();
    typedSecret.setSecretType(SecretType.E_METER_MASTER_KEY);
    typedSecret.setSecret(HexUtils.toHexString("$3cr3t".getBytes()));
    //WHEN
    when(this.secretRepository.findIdOfValidMostRecent(any(), any(), any())).thenReturn(null);
    when(this.keyRepository.findByTypeAndValid(any(), any(), any())).thenReturn(Page.empty());
    //THEN
    assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(
            () -> this.service.storeSecrets("SOME_DEVICE", Arrays.asList(typedSecret)));
}