@@ -0,0 +1,1372 @@
+package org.sagebionetworks.upload.discussion;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.springframework.test.util.ReflectionTestUtils;%0A%0Aimport com.amazonaws.services.s3.AmazonS3Client;%0Aimport com.amazonaws.services.s3.model.PutObjectRequest;%0A%0Apublic class UploadContentToS3DAOImplTest %7B%0A%0A%09@Mock%0A%09private AmazonS3Client mockS3Client;%0A%09private String bucketName = %22bucket%22;%0A%09private UploadContentToS3DAOImpl dao;%0A%0A%09@Before%0A%09public void before() %7B%0A%09%09MockitoAnnotations.initMocks(this);%0A%0A%09%09dao = new UploadContentToS3DAOImpl();%0A%09%09ReflectionTestUtils.setField(dao, %22s3Client%22, mockS3Client);%0A%09%09ReflectionTestUtils.setField(dao, %22bucketName%22, bucketName);%0A%09%7D%0A%0A%09@Test%0A%09public void testUploadDiscussionContent() throws Exception %7B%0A%09%09String content = %22this is a message%22;%0A%09%09String forumId = %221%22;%0A%09%09String threadId = %222%22;%0A%09%09String key = dao.uploadDiscussionContent(content, forumId, threadId);%0A%09%09Mockito.verify(mockS3Client).putObject((PutObjectRequest) Mockito.any());%0A%09%09assertNotNull(key);%0A%09%09String%5B%5D parts = key.split(%22/%22);%0A%09%09assertTrue(parts.length == 3);%0A%09%09assertEquals(parts%5B0%5D, forumId);%0A%09%09assertEquals(parts%5B1%5D, threadId);%0A%09%7D%0A%7D%0A

add unit test