title: Unit Tests for spring boot application
body: <p>I have never used JUnit testing before.I need to test my code with JUnit.
  I have been searching google for all day but the problem is that I found examples using Mockito but in my code I didn't use dependency injections(@Autowired).
  How can i use it for these methods?</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>public class WordService {
  
  public WordService() {
  
  }
  
  
  public static String upperCaseFirst(String value) {
      char[] listChar = value.toCharArray();
      listChar[0] = Character.toUpperCase(listChar[0]);
      return new String(listChar);
  }
  
  /**
   * Find and return the search word
   * @param name
   * @return the word sought or null if not found
   */
  public Word findWordByName(String name){
  
      String nameUpper = upperCaseFirst(name);
  
      WordDao w = new WordDao();
      Word found = w.findWord(nameUpper);
  
      List&lt;String&gt; definitions = new ArrayList&lt;&gt;();
  
      if(found != null) {
          for(int i=0; i&lt;found.getDefinition().size(); i++) {
              StringBuffer defBuffer = new StringBuffer();
  
              String definitionFound = found.getDefinition().get(i);
              definitionFound = definitionFound.replace("\n", "");
  
              defBuffer.append(definitionFound);
              defBuffer.append("_");
  
              definitions.add(i, defBuffer.toString());
          }
          found.setDefinition(definitions);
      }
      return found;
  }
  
  
  /**
   * 
   * @return Return a list of words
   */
  public List&lt;Word&gt; findAllWord(){
  
      WordDao w = new WordDao();
      return w.findAllWords();
  }
  
  }
  </code></pre>