title: How to get full coverage for Java Code Coverage? Junit 5 Eclipse IDE
body: <p>I am doing an assignment for a course, I need to get full coverage of this method</p>
  <pre><code>public void ourcompanyname(String companyName) {
          if (companyName == (&quot;&quot;)) {
              throw new AirlineException(&quot;Warning. The company must have a name !&quot;);}
  </code></pre>
  <p>----&gt;This is the constructor</p>
  <pre><code>public String getCompanyName() {
          return companyName;
      }
      /**
       * @param companyName the companyName to set
       */
      public void setCompanyName(String companyName) {
          this.companyName = companyName;
  </code></pre>
  <p>-----&gt;And this is the test I used</p>
  <pre><code>public void testSet() throws AirlineException { 
          airlinecompany.setCompanyName((&quot;&quot;));
  
  Assertions.assertEquals((&quot;&quot;),airlinecompany.getCompanyName());
  Assertions.assertThrows(AirlineException.class,()-&gt;airlinecompany.ourcompanyname((&quot;&quot;)));
  </code></pre>
  <p>-----&gt;The problem is that I get 50% coverage when testing this code. The (&quot;&quot;) string represents a blank field, thus when you don't fill in the name, you get an AirlineException. But I also want to test it for a string like &quot;FLYAIR&quot;, that should not throw an exception.
  What choices do I have ? Better coding for the blank field (&quot;&quot;) or just changes to this one ?</p>
  <p>Many thanx in advance !</p>