@@ -0,0 +1,2349 @@
+package pl.mycalories.common;%0D%0A%0D%0Aimport org.junit.Assert;%0D%0Aimport org.junit.Before;%0D%0Aimport org.junit.Rule;%0D%0Aimport org.junit.Test;%0D%0Aimport org.junit.rules.ExpectedException;%0D%0Aimport org.junit.runner.RunWith;%0D%0Aimport org.springframework.boot.test.context.SpringBootTest;%0D%0Aimport org.springframework.test.context.junit4.SpringRunner;%0D%0Aimport org.springframework.test.context.web.WebAppConfiguration;%0D%0Aimport pl.mycalories.CalorieeCApplication;%0D%0Aimport pl.mycalories.model.Category;%0D%0A%0D%0Aimport java.util.UnknownFormatConversionException;%0D%0A%0D%0A@RunWith(SpringRunner.class)%0D%0A@SpringBootTest(classes = CalorieeCApplication.class)%0D%0A@WebAppConfiguration%0D%0Apublic class NameConverterTest %7B%0D%0A%0D%0A    private NameConverter nameConverter;%0D%0A    private Category category;%0D%0A    private String expectedString = %22Name test%22;%0D%0A%0D%0A    @Rule%0D%0A    public ExpectedException expectedEx = ExpectedException.none();%0D%0A%0D%0A    @Before%0D%0A    public void init() %7B%0D%0A        category = new Category();%0D%0A        nameConverter = new NameConverter(category);%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void should_capitalize_first_letter() throws UnknownFormatConversionException %7B%0D%0A        category.setName(%22name test%22);%0D%0A        nameConverter.convertName();%0D%0A        Assert.assertEquals(expectedString, category.getName());%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void should_remove_leading_whitespaces() throws UnknownFormatConversionException %7B%0D%0A        category.setName(%22        Name test%22);%0D%0A        nameConverter.convertName();%0D%0A        Assert.assertEquals(expectedString, category.getName());%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void should_convert_string_to_lower_case_and_capitalize_first_letter() throws UnknownFormatConversionException %7B%0D%0A        category.setName(%22NAME TEST%22);%0D%0A        nameConverter.convertName();%0D%0A        Assert.assertEquals(expectedString, category.getName());%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void should_throw_exception() throws UnknownFormatConversionException %7B%0D%0A        expectedEx.expect(UnknownFormatConversionException.class);%0D%0A%0D%0A        category.setName(%22        %22);%0D%0A        nameConverter.convertName();%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void should_return_exception_message() throws UnknownFormatConversionException %7B%0D%0A        expectedEx.expectMessage(%22Name field should contain body!%22);%0D%0A%0D%0A        category.setName(%22  %22);%0D%0A        nameConverter.convertName();%0D%0A    %7D%0D%0A%0D%0A%7D%0D%0A

add unit tests for name converter class