### Question:
ScriptExecutionCommand extends AbstractCclCommand { public void addWithReplace(final String recordName, final Record record) { if (recordName == null) throw new NullPointerException("Record name cannot be null."); if (record == null) throw new NullPointerException("Record cannot be null."); if (recordName.trim().length() == 0) throw new IllegalArgumentException("Record name cannot be blank."); final String upperName = recordName.toUpperCase(Locale.getDefault()); records.put(upperName, record); builder.addWithReplace(recordName, record); } ScriptExecutionCommand(final String scriptName, final List<Argument> arguments, final boolean authenticate);  ScriptExecutionCommand(final ScriptExecutionBuilder executionBuilder, final boolean authenticate); void addWithReplace(final String recordName, final Record record); @Override void run(final CclCommandTerminal terminal);  }### Answer:
@Test public void testAddWithReplace() { final ScriptExecutionCommand command = new ScriptExecutionCommand(scriptName, arguments, false); final Record reply = mock(Record.class); final String recordName = "reply"; command.addWithReplace(recordName, reply); assertThat(command.getRecordStructures()).includes(entry(recordName.toUpperCase(), reply)); }
@Test public void testAddWithReplaceBlankName() { final ScriptExecutionCommand command = new ScriptExecutionCommand(scriptName, arguments, false); IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> { command.addWithReplace(" ", mock(Record.class)); }); assertThat(e.getMessage()).isEqualTo("Record name cannot be blank."); }
@Test public void testAddWithReplaceNullName() { final ScriptExecutionCommand command = new ScriptExecutionCommand(scriptName, arguments, false); NullPointerException e = assertThrows(NullPointerException.class, () -> { command.addWithReplace(null, mock(Record.class)); }); assertThat(e.getMessage()).isEqualTo("Record name cannot be null."); }
@Test public void testAddWithReplaceNullRecord() { final ScriptExecutionCommand command = new ScriptExecutionCommand(scriptName, arguments, false); NullPointerException e = assertThrows(NullPointerException.class, () -> { command.addWithReplace("reply", null); }); assertThat(e.getMessage()).isEqualTo("Record cannot be null."); }