### Question:
NativeProfileCreator extends BaseStepExecutor<EmptyArguments> { @Override public void execute(EmptyArguments arguments) { try { profileService.createIfNotExists(ProfileId.NATIVE, Profile.NATIVE); } catch (RuntimeException e) { throw new RetryableException(e); } } @Inject  NativeProfileCreator(ProfileService profileService); @Override void execute(EmptyArguments arguments);  }### Answer:
@Test public void testCreation() throws Exception { try { profileService.getProfile(ProfileId.NATIVE); Assert.fail("Native profile should not exist."); } catch (NotFoundException e) { } BootstrapStepResult result = nativeProfileCreator.execute("label", new JsonObject()); BootstrapStepResult expected = new BootstrapStepResult("label", BootstrapStepResult.Status.SUCCEEDED); Assert.assertEquals(expected, result); Assert.assertEquals(Profile.NATIVE, profileService.getProfile(ProfileId.NATIVE)); }
@Test public void testAlreadyExistsDoesNotError() throws Exception { profileService.saveProfile(ProfileId.NATIVE, Profile.NATIVE); BootstrapStepResult result = nativeProfileCreator.execute("label", new JsonObject()); BootstrapStepResult expected = new BootstrapStepResult("label", BootstrapStepResult.Status.SUCCEEDED); Assert.assertEquals(expected, result); Assert.assertEquals(Profile.NATIVE, profileService.getProfile(ProfileId.NATIVE)); }