### Question:
Pop3Store extends RemoteStore { @Override @NonNull public Pop3Folder getFolder(String name) { Pop3Folder folder = mFolders.get(name); if (folder == null) { folder = new Pop3Folder(this, name); mFolders.put(folder.getId(), folder); } return folder; } Pop3Store(StoreConfig storeConfig, TrustedSocketFactory socketFactory); static ServerSettings decodeUri(String uri); static String createUri(ServerSettings server); @Override @NonNull Pop3Folder getFolder(String name); @Override @NonNull List <Pop3Folder> getFolders(boolean forceListAll); @NonNull @Override List<? extends Folder> getSubFolders(String parentFolderId, boolean forceListAll); @Override void checkSettings(); @Override boolean isSeenFlagSupported(); Pop3Connection createConnection();  }### Answer:
@Test public void getFolder_shouldReturnSameFolderEachTime() { Pop3Folder folderOne = store.getFolder("TestFolder"); Pop3Folder folderTwo = store.getFolder("TestFolder"); assertSame(folderOne, folderTwo); }
@Test public void getFolder_shouldReturnFolderWithCorrectName() throws Exception { Pop3Folder folder = store.getFolder("TestFolder"); assertEquals("TestFolder", folder.getId()); }
@Test public void open_withAuthResponseUsingAuthPlain_shouldRetrieveMessageCountOnAuthenticatedSocket() throws Exception { String response = INITIAL_RESPONSE + AUTH_HANDLE_RESPONSE + CAPA_RESPONSE + AUTH_PLAIN_AUTHENTICATED_RESPONSE + STAT_RESPONSE; when(mockSocket.getInputStream()).thenReturn(new ByteArrayInputStream(response.getBytes("UTF-8"))); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); when(mockSocket.getOutputStream()).thenReturn(byteArrayOutputStream); Pop3Folder folder = store.getFolder("Inbox"); folder.open(Folder.OPEN_MODE_RW); assertEquals(20, folder.getMessageCount()); assertEquals(AUTH + CAPA + AUTH_PLAIN_WITH_LOGIN + STAT, byteArrayOutputStream.toString("UTF-8")); }
@Test(expected = AuthenticationFailedException.class) public void open_withFailedAuth_shouldThrow() throws Exception { String response = INITIAL_RESPONSE + AUTH_HANDLE_RESPONSE + CAPA_RESPONSE + AUTH_PLAIN_FAILED_RESPONSE; when(mockSocket.getInputStream()).thenReturn(new ByteArrayInputStream(response.getBytes("UTF-8"))); Pop3Folder folder = store.getFolder("Inbox"); folder.open(Folder.OPEN_MODE_RW); }