### Question:
DynamicCompilerAdderImpl extends AbstractCompilerAdder implements DynamicCompilerAdder<DynamicCompilerAdderImpl> { @Override public DynamicCompilerAdderImpl withScriptName(final String scriptName) { if (scriptName == null) { throw new NullPointerException("Script name cannot be null."); } if (scriptName.trim().length() == 0) { throw new IllegalArgumentException("Script name cannot be blank."); } if (scriptName.length() > MAX_SCRIPT_NAME_LENGTH) { throw new IllegalArgumentException(String.format("Script name exceeds max length: %d > %d", scriptName.length(), MAX_SCRIPT_NAME_LENGTH)); } this.scriptName = scriptName; return this; } DynamicCompilerAdderImpl(final File sourceFile, final CommandQueue queue); @Override DynamicCompilerAdderImpl withDebugModeEnabled(final boolean debugModeEnabled); @Override DynamicCompilerAdderImpl withDependency(final File file); @Override DynamicCompilerAdderImpl withListingOutput(final File file); @Override DynamicCompilerAdderImpl withScriptName(final String scriptName); @Override void commit();  }### Answer:
@Test public void testWithScriptNameBlankName() { IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> { adder.withScriptName(""); }); assertThat(e.getMessage()).isEqualTo("Script name cannot be blank."); }
@Test public void testWithScriptNameNullName() { NullPointerException e = assertThrows(NullPointerException.class, () -> { adder.withScriptName(null); }); assertThat(e.getMessage()).isEqualTo("Script name cannot be null."); }
@Test public void testWithScriptNameTooLong() { final StringBuilder nameBuilder = new StringBuilder(); nameBuilder.append(StringUtils.repeat("a", 31)); IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> { adder.withScriptName(nameBuilder.toString()); }); assertThat(e.getMessage()).isEqualTo("Script name exceeds max length: 31 > 30"); }