@Test public void should_return_jvm_option_objects_from_jvm_options_as_a_string() { JvmOptions jvmOptionsAsAnnotation = mock(JvmOptions.class); when(jvmOptionsAsAnnotation.value()).thenReturn(" -XX:+UseCompressedOops -XX:+UseCompressedClassPointers "); List<JvmOption> jvmOptions = jvmOptionConverter.jvmOptionFrom(jvmOptionsAsAnnotation); SoftAssertions softAssertions = new SoftAssertions(); softAssertions.assertThat(jvmOptions).hasSize(2); JvmOption firstJvmOption = jvmOptions.get(0); softAssertions.assertThat(firstJvmOption.asString()) .isEqualTo("-XX:+UseCompressedOops"); JvmOption secondJvmOption = jvmOptions.get(1); softAssertions.assertThat(secondJvmOption.asString()) .isEqualTo("-XX:+UseCompressedClassPointers"); softAssertions.assertAll(); }
public List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions) { if (!jvmOptionsExist(jvmOptions)) { return Collections.emptyList(); } String jvmOptionsAsAString = jvmOptions.value(); List<String> jvmOptionsAsStrings = extractJvmOptionsAsStrings(jvmOptionsAsAString); return buildJvmOptionsAsObjects(jvmOptionsAsStrings); }
JvmOptionConverter { public List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions) { if (!jvmOptionsExist(jvmOptions)) { return Collections.emptyList(); } String jvmOptionsAsAString = jvmOptions.value(); List<String> jvmOptionsAsStrings = extractJvmOptionsAsStrings(jvmOptionsAsAString); return buildJvmOptionsAsObjects(jvmOptionsAsStrings); } }
JvmOptionConverter { public List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions) { if (!jvmOptionsExist(jvmOptions)) { return Collections.emptyList(); } String jvmOptionsAsAString = jvmOptions.value(); List<String> jvmOptionsAsStrings = extractJvmOptionsAsStrings(jvmOptionsAsAString); return buildJvmOptionsAsObjects(jvmOptionsAsStrings); } private  JvmOptionConverter(); }
JvmOptionConverter { public List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions) { if (!jvmOptionsExist(jvmOptions)) { return Collections.emptyList(); } String jvmOptionsAsAString = jvmOptions.value(); List<String> jvmOptionsAsStrings = extractJvmOptionsAsStrings(jvmOptionsAsAString); return buildJvmOptionsAsObjects(jvmOptionsAsStrings); } private  JvmOptionConverter(); List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions); }
JvmOptionConverter { public List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions) { if (!jvmOptionsExist(jvmOptions)) { return Collections.emptyList(); } String jvmOptionsAsAString = jvmOptions.value(); List<String> jvmOptionsAsStrings = extractJvmOptionsAsStrings(jvmOptionsAsAString); return buildJvmOptionsAsObjects(jvmOptionsAsStrings); } private  JvmOptionConverter(); List<JvmOption> jvmOptionFrom(JvmOptions jvmOptions); static final JvmOptionConverter INSTANCE; }