title: Junit test function which returns a string
body: <p>I have a function inside a class :</p>
  
  <pre><code>public String covertToLowerCase(String sliceName) {
          sliceName = sliceName.trim().toLowerCase();
          sliceName = sliceName.replaceAll("\\.txt$|\\.dat$", "");
          return sliceName;
      }
  </code></pre>
  
  <p>I want to test this using Junit. I have created a separate test file which has the following:</p>
  
  <pre><code>  public class MyControllerTest {
  
    private MyController myController;
    private static final String SLICE_NAME = "Hello World";
  
    @Test
    public void shouldReturnSanitizedString() throws Exception {
    String expected = myController.covertToLowerCase(SLICE_NAME);
    // assert that actual and expected are same
    }
  </code></pre>
  
  <p>I am not able to understand how to test this and all the other examples are specific to their functions. I just want the function to return a sanitized string? How can I go about this?</p>