/**
  * Attempts to convert profile with invalid component provider class.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_component_invalid() throws Exception {
   ProcessProfile profile = profile(KEY_RETRY_COUNT, "1", KEY_COMPONENT, String.class.getName());
   try {
     RetryableProcessProfile.convert(profile);
     fail();
   } catch (IllegalArgumentException e) {
     // ok.
   }
 }
 /**
  * Attempts to convert profile without retry count.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_count_unknown() throws Exception {
   ProcessProfile profile = profile(KEY_COMPONENT, DummyProcess.class.getName());
   try {
     RetryableProcessProfile.convert(profile);
     fail();
   } catch (IllegalArgumentException e) {
     // ok.
   }
 }
 /**
  * Attempts to convert profile without component provider class.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_component_missing() throws Exception {
   ProcessProfile profile = profile(KEY_RETRY_COUNT, "1");
   try {
     RetryableProcessProfile.convert(profile);
     fail();
   } catch (IllegalArgumentException e) {
     // ok.
   }
 }
 /**
  * Attempts to convert profile with invalid retry interval.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_interval_illeval() throws Exception {
   ProcessProfile profile =
       profile(KEY_RETRY_INTERVAL, "-1", KEY_COMPONENT, DummyProcess.class.getName());
   try {
     RetryableProcessProfile.convert(profile);
     fail();
   } catch (IllegalArgumentException e) {
     // ok.
   }
 }
 /**
  * Converts a profile with options.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_options() throws Exception {
   ProcessProfile profile =
       profile(
           KEY_RETRY_COUNT,
           "10",
           KEY_RETRY_INTERVAL,
           "1000",
           KEY_COMPONENT,
           DummyProcess.class.getName(),
           PREFIX_COMPONENT + "hello1",
           "world1",
           PREFIX_COMPONENT + "hello2",
           "world2",
           PREFIX_COMPONENT + "hello3",
           "world3");
   RetryableProcessProfile result = RetryableProcessProfile.convert(profile);
   assertThat(result.getRetryCount(), is(10));
   assertThat(result.getRetryInterval(), is(1000L));
   assertThat(result.getComponent(), instanceOf(DummyProcess.class));
   ProcessProfile inner = ((DummyProcess) result.getComponent()).inner;
   assertThat(inner.getName(), is(not(profile.getName())));
   assertThat(
       inner.getConfiguration(),
       is(
           map(
               "hello1", "world1",
               "hello2", "world2",
               "hello3", "world3")));
 }
 /**
  * Attempts to convert profile with invalid component provider class.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_component_unknown() throws Exception {
   ProcessProfile profile =
       profile(
           KEY_RETRY_COUNT, "1",
           KEY_COMPONENT, "__UNKNOWN__");
   try {
     RetryableProcessProfile.convert(profile);
     fail();
   } catch (IllegalArgumentException e) {
     // ok.
   }
 }
 /**
  * Converts simple profile.
  *
  * @throws Exception if failed
  */
 @Test
 public void convert_simple() throws Exception {
   ProcessProfile profile =
       profile(KEY_RETRY_COUNT, "1", KEY_COMPONENT, DummyProcess.class.getName());
   RetryableProcessProfile result = RetryableProcessProfile.convert(profile);
   assertThat(result.getRetryCount(), is(1));
   assertThat(result.getRetryInterval(), is(DEFAULT_RETRY_INTERVAL));
   assertThat(result.getComponent(), instanceOf(DummyProcess.class));
   ProcessProfile inner = ((DummyProcess) result.getComponent()).inner;
   assertThat(inner.getName(), is(not(profile.getName())));
   assertThat(inner.getConfiguration(), is(map()));
 }