title: Testing: Parameter input validation
body: <p>In the following code I was wondering if it's okay to adjust the tests that do the name checking. Because once I add the code that checks that the ID cannot be null my first 3 tests fail. </p>
  
  <p>The same goes for the last 3 tests that do the id testing. I have to use 'foo' as a name cause otherwise those tests will fail too. Not sure if that's okay either?</p>
  
  <p>Code to be tested:</p>
  
  <pre><code>class Error
  
  class Node
      constructor: (name, id) -&gt;
          if not name?
              throw new Error('Name cannot be null')
  
          @name = name
  
          if not id?
              throw new Error('Id cannot be null')
  
          @id = id
  
  window.Node = Node
  </code></pre>
  
  <p>The spec:</p>
  
  <pre><code>node_spec = describe 'Node', () -&gt;
  
      it 'should have the name foo', () -&gt;
          expect( new Node('foo').name ).toEqual('foo')
  
      it 'should have the name bar', () -&gt;
          expect( new Node('bar').name ).toEqual('bar')
  
      it 'should throw an error if the name is null', () -&gt;
          expect( () -&gt; new Node() ).toThrow()
  
      it 'should have an id of 0', () -&gt;
          expect( new Node('foo', 0).id ).toEqual(0)
  
      it 'should have an of 1', () -&gt;
          expect( new Node('foo', 1).id ).toEqual(1)
  
      it 'should throw an error if id is null', () -&gt;
          expect( new Node('foo') ).toThrow()
  
  window.node_spec = node_spec
  </code></pre>
  
  <p><strong>Update:</strong>
  I guess one solution is to have a getter and setter methods for both id and name and test those instead.</p>