@Test public void testWithReplaceBlankRecordName() { IllegalArgumentException e = assertThrows(IllegalArgumentException.class, () -> { adder.withReplace(" ", mock(Record.class)); }); assertThat(e.getMessage()).isEqualTo("Record name cannot be blank."); }
@Override public ScriptExecutionAdder withReplace(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); return this; }
ScriptExecutionAdderImpl implements ScriptExecutionAdder { @Override public ScriptExecutionAdder withReplace(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); return this; } }
ScriptExecutionAdderImpl implements ScriptExecutionAdder { @Override public ScriptExecutionAdder withReplace(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); return this; } ScriptExecutionAdderImpl(final String scriptName, final CommandQueue queue); }
ScriptExecutionAdderImpl implements ScriptExecutionAdder { @Override public ScriptExecutionAdder withReplace(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); return this; } ScriptExecutionAdderImpl(final String scriptName, final CommandQueue queue); @Override void commit(); @Override ScriptExecutionAdder withReplace(final String recordName, final Record record); @Override ScriptExecutionAdder withArguments(final Argument... arguments); @Override ScriptExecutionAdder withAuthentication(final boolean authenticate); }
ScriptExecutionAdderImpl implements ScriptExecutionAdder { @Override public ScriptExecutionAdder withReplace(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); return this; } ScriptExecutionAdderImpl(final String scriptName, final CommandQueue queue); @Override void commit(); @Override ScriptExecutionAdder withReplace(final String recordName, final Record record); @Override ScriptExecutionAdder withArguments(final Argument... arguments); @Override ScriptExecutionAdder withAuthentication(final boolean authenticate);  }