FileTypeServiceImpl implements FileTypeService { void validateAndTrimFileTypeKey(FileTypeKey fileTypeKey) throws IllegalArgumentException { Assert.notNull(fileTypeKey, "A file type key must be specified."); fileTypeKey.setFileTypeCode(alternateKeyHelper.validateStringParameter("file type code", fileTypeKey.getFileTypeCode())); }  @Override FileType createFileType(FileTypeCreateRequest fileTypeCreateRequest); @Override FileType getFileType(FileTypeKey fileTypeKey); @Override FileType deleteFileType(FileTypeKey fileTypeKey); @Override FileTypeKeys getFileTypes();  }
@Test public void testValidateAndTrimFileTypeKeyExtraSpaces() { when(alternateKeyHelper.validateStringParameter(anyString(), anyString())).thenReturn(FORMAT_FILE_TYPE_CODE); assertEquals(FILE_TYPE_CODE_WITH_EXTRA_SPACES, FILE_TYPE_KEY_WITH_EXTRA_SPACES_IN_NAME.getFileTypeCode()); fileTypeMockService.validateAndTrimFileTypeKey(FILE_TYPE_KEY_WITH_EXTRA_SPACES_IN_NAME); assertEquals(FORMAT_FILE_TYPE_CODE, FILE_TYPE_KEY_WITH_EXTRA_SPACES_IN_NAME.getFileTypeCode()); }