### Question:
OathMaker { OathDeviceSettings createDeviceProfile(int minSharedSecretLength) { Reject.ifFalse(minSharedSecretLength >= 0, "minSharedSecretLength must not be negative"); int sharedSecretByteLength = Math.max(MIN_SHARED_SECRET_BYTE_LENGTH, (int)Math.ceil(minSharedSecretLength / 2d)); byte[] secretBytes = new byte[sharedSecretByteLength]; secureRandom.nextBytes(secretBytes); String sharedSecret = DatatypeConverter.printHexBinary(secretBytes); return new OathDeviceSettings(sharedSecret, DEVICE_NAME, INITIAL_LAST_LOGIN_TIME, INITIAL_COUNTER_VALUE); } @Inject  OathMaker(final @Nonnull OathDevicesDao devicesDao,
              final @Nonnull @Named("amAuthOATH") Debug debug,
              final @Nonnull SecureRandom secureRandom,
              final @Nonnull DeviceJsonUtils<OathDeviceSettings> jsonUtils);   }### Answer:
@Test public void shouldGenerateCorrectLengthSecret() throws Exception { OathDeviceSettings deviceSettings = testFactory.createDeviceProfile(SECRET_HEX_LENGTH); assertThat(deviceSettings.getSharedSecret()).hasSize(SECRET_HEX_LENGTH); }
@Test public void shouldNotGenerateLessThan8BytesOfSecret() throws Exception { OathDeviceSettings deviceSettings = testFactory.createDeviceProfile(0); assertThat(deviceSettings.getSharedSecret()).hasSize(16); }
@Test public void shouldDefaultCounterToZero() throws Exception { OathDeviceSettings deviceSettings = testFactory.createDeviceProfile(SECRET_HEX_LENGTH); assertThat(deviceSettings.getCounter()).isEqualTo(0); }
@Test public void shouldDefaultLastLoginTimeToZero() throws Exception { OathDeviceSettings deviceSettings = testFactory.createDeviceProfile(SECRET_HEX_LENGTH); assertThat(deviceSettings.getLastLogin()).isEqualTo(0); }
@Test public void shouldDefaultDeviceName() throws Exception { OathDeviceSettings deviceSettings = testFactory.createDeviceProfile(SECRET_HEX_LENGTH); assertThat(deviceSettings.getDeviceName()).isNotEmpty(); }