title: Assert a good practice or not?
body: <p>Is it a good practice to use Assert for function parameters to enforce their validity. I was going through the source code of Spring Framework and I noticed that they use <code>Assert.notNull</code> a lot. Here's an example</p>
  
  <pre><code>public static ParsedSql parseSqlStatement(String sql) {
      Assert.notNull(sql, "SQL must not be null");
  }
  </code></pre>
  
  <p>Here's Another one:</p>
  
  <pre><code>public NamedParameterJdbcTemplate(DataSource dataSource) {
      Assert.notNull(dataSource,
              "The [dataSource] argument cannot be null.");
      this.classicJdbcTemplate = new JdbcTemplate(dataSource);
  }
  
  public NamedParameterJdbcTemplate(JdbcOperations classicJdbcTemplate) {
      Assert.notNull(classicJdbcTemplate,
              "JdbcTemplate must not be null");
      this.classicJdbcTemplate = classicJdbcTemplate;
  }
  </code></pre>
  
  <p>FYI, The <code>Assert.notNull</code> (not the <code>assert</code> statement) is defined in a util class as follows:</p>
  
  <pre><code>public abstract class Assert { 
     public static void notNull(Object   object, String   message) {
        if (object == null) {
            throw new IllegalArgumentException  (message);
        }
     }
  }
  </code></pre>