### Question:
DatasourceModel extends XulEventSourceAdapter implements IRelationalModelValidationListener, IModelInfoValidationListener { public String generateTableName() { if ( datasourceName == null ) { throw new IllegalStateException( "DatasourceName must not be null, cannot generate a valid table name" ); } return URL.encode( datasourceName.trim().replace( " ", "_" ) ) .replaceAll( "[^A-Za-z0-9_-]", "" ) .toLowerCase(); } DatasourceModel(); @Bindable GuiStateModel getGuiStateModel(); @Bindable void setGuiStateModel( GuiStateModel guiStateModel ); @Bindable String getDatasourceName(); @Bindable void setDatasourceName( String datasourceName ); @Bindable IDatabaseConnection getSelectedRelationalConnection(); @Bindable void setSelectedRelationalConnection( IDatabaseConnection value ); @Bindable String getQuery(); @Bindable void setQuery( String value ); Domain getDomain(); void setDomain( Domain domain ); @Bindable ModelInfo getModelInfo(); @Bindable void setModelInfo( ModelInfo modelInfo ); @Bindable boolean isValidated(); @Bindable DatasourceType getDatasourceType(); @Bindable void setDatasourceType( DatasourceType datasourceType ); void validate(); void clearModel(); void onRelationalModelInValid(); void onRelationalModelValid(); void copyOverMetadata( Domain oldDomain, Domain newDomain ); void onModelInfoInvalid(); void onModelInfoValid(); String generateTableName(); void onCsvInValid(); void onCsvValid(); boolean isEditing(); void setEditing( boolean editing );  }### Answer:
@Test( expected = IllegalStateException.class ) public void testGenerateTablename_nullDatasourceName() throws Exception { DatasourceModel model = new DatasourceModel(); model.generateTableName(); }