method2testcases
stringlengths 118
6.63k
|
---|
### Question:
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }### Answer:
@Test public void normalizeResourcePathSlash01() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/")); }
@Test public void normalizeResourcePathSlash02() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" /")); }
@Test public void normalizeResourcePathSlash03() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" / ")); }
@Test public void normalizeResourcePathSlash04() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/ ")); }
|
### Question:
WebAppParser { protected WebAppType parseWebXml(URL url) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); NamespaceFilter inFilter = new NamespaceFilter("http: inFilter.setParent(reader); JAXBContext context = JAXBContext.newInstance(WebAppType.class); Unmarshaller unmarshaller = context.createUnmarshaller(); SAXSource source = new SAXSource(inFilter, new InputSource(url.openStream())); return unmarshaller.unmarshal(source, WebAppType.class).getValue(); } catch (JAXBException | IOException | SAXException exc) { LOG.error("error parsing web.xml", exc); } return null; } WebAppParser(ServiceTracker<PackageAdmin, PackageAdmin> packageAdmin); void parse(final Bundle bundle, WebApp webApp); static Boolean canSeeClass(Bundle bundle, Class<?> clazz); }### Answer:
@SuppressWarnings("deprecation") @Test public void testParseWebXml() throws Exception { WebAppParser parser = new WebAppParser(null); File file = new File("src/test/resources/web.xml"); assertTrue(file.exists()); WebAppType parseWebXml = parser.parseWebXml(file.toURL()); assertNotNull(parseWebXml); List<JAXBElement<?>> list = parseWebXml.getModuleNameOrDescriptionAndDisplayName(); for (JAXBElement<?> jaxbElement : list) { Object value = jaxbElement.getValue(); if (value instanceof SessionConfigType) { SessionConfigType sessionConfig = (SessionConfigType) value; BigInteger value2 = sessionConfig.getSessionTimeout().getValue(); assertThat(value2.intValue(), is(30)); } } }
|
### Question:
DeployerUtils { public static String[] extractNameVersionType(String url) { Matcher m = ARTIFACT_MATCHER.matcher(url); if (!m.matches()) { return new String[]{url.split("\\.")[0], DEFAULT_VERSION}; } else { StringBuilder v = new StringBuilder(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.group(4); String d5 = m.group(5); String d6 = m.group(6); if (d2 != null) { v.append(d2); if (d3 != null) { v.append('.'); v.append(d3); if (d4 != null) { v.append('.'); v.append(d4); if (d5 != null) { v.append("."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0."); cleanupModifier(v, d5); } } else if (d5 != null) { v.append(".0.0."); cleanupModifier(v, d5); } } return new String[]{d1, v.toString(), d6}; } } private DeployerUtils(); static String[] extractNameVersionType(String url); }### Answer:
@Test public void testExtractNameVersionType() { String[] nameVersion; nameVersion = DeployerUtils.extractNameVersionType("test-1.0.0.war"); assertEquals("test", nameVersion[0]); assertEquals("1.0.0", nameVersion[1]); nameVersion = DeployerUtils.extractNameVersionType("test.war"); assertEquals("test", nameVersion[0]); assertEquals("0.0.0", nameVersion[1]); }
|
### Question:
HttpServiceFactoryImpl implements
ServiceFactory<HttpService> { @Override public HttpService getService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration) { LOG.info("Binding bundle: [" + bundle + "] to http service"); return createService(bundle); } @Override HttpService getService(final Bundle bundle,
final ServiceRegistration<HttpService> serviceRegistration); @Override void ungetService(final Bundle bundle,
final ServiceRegistration<HttpService> serviceRegistration,
final HttpService httpService); }### Answer:
@Test public void checkGetServiceFlow() { replay(bundle, serviceRegistration, httpService); Object result = underTest.getService(bundle, serviceRegistration); assertNotNull("expect not null", result); verify(bundle, serviceRegistration, httpService); }
|
### Question:
HttpServiceFactoryImpl implements
ServiceFactory<HttpService> { @Override public void ungetService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration, final HttpService httpService) { LOG.info("Unbinding bundle: [" + bundle + "]"); ((StoppableHttpService) httpService).stop(); } @Override HttpService getService(final Bundle bundle,
final ServiceRegistration<HttpService> serviceRegistration); @Override void ungetService(final Bundle bundle,
final ServiceRegistration<HttpService> serviceRegistration,
final HttpService httpService); }### Answer:
@Test public void checkUngetServiceFlow() { httpService.stop(); replay(bundle, serviceRegistration, httpService); underTest.ungetService(bundle, serviceRegistration, httpService); verify(bundle, serviceRegistration, httpService); }
|
### Question:
DefaultHttpContext implements WebContainerContext { @Override public boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException { return true; } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final HttpServletRequest httpServletRequest,
final HttpServletResponse httpServletResponse); @Override URL getResource(final String name); @Override String getMimeType(String name); @Override Set<String> getResourcePaths(final String name); @Override String getContextId(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }### Answer:
@Test public void handleSecurity() throws IOException { assertTrue(contextUnderTest.handleSecurity(null, null)); }
|
### Question:
DefaultHttpContext implements WebContainerContext { @Override public String getMimeType(String name) { return null; } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final HttpServletRequest httpServletRequest,
final HttpServletResponse httpServletResponse); @Override URL getResource(final String name); @Override String getMimeType(String name); @Override Set<String> getResourcePaths(final String name); @Override String getContextId(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }### Answer:
@Test public void getMimeType() { assertEquals(null, contextUnderTest.getMimeType(null)); }
|
### Question:
DefaultHttpContext implements WebContainerContext { @Override public URL getResource(final String name) { final String normalizedname = Path.normalizeResourcePath(name); LOG.debug("Searching bundle [" + bundle + "] for resource [" + normalizedname + "]"); return bundle.getResource(normalizedname); } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final HttpServletRequest httpServletRequest,
final HttpServletResponse httpServletResponse); @Override URL getResource(final String name); @Override String getMimeType(String name); @Override Set<String> getResourcePaths(final String name); @Override String getContextId(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }### Answer:
@Test public void getResource() throws MalformedURLException { URL url = new URL("file: expect(bundle.getResource("test")).andReturn(url); replay(bundle); contextUnderTest.getResource("test"); verify(bundle); }
|
### Question:
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static String normalizePattern(final String pattern); }### Answer:
@Test public void replaceSlashesWithNull() { assertEquals("Replaced", null, Path.replaceSlashes(null)); }
@Test public void replaceSlashes01() { assertEquals("Replaced", "/foo/bar/", Path.replaceSlashes("/foo/bar/")); }
@Test public void replaceSlashes02() { assertEquals("Replaced", "/", Path.replaceSlashes("/")); }
@Test public void replaceSlashes03() { assertEquals("Replaced", "/", Path.replaceSlashes(" }
@Test public void replaceSlashes04() { assertEquals("Replaced", "/foo/bar", Path.replaceSlashes(" }
@Test public void replaceSlashes05() { assertEquals("Replaced", "foo/bar/", Path.replaceSlashes("foo/bar }
@Test public void replaceSlashes06() { assertEquals("Replaced", "foo/bar", Path.replaceSlashes("foo }
@Test public void replaceSlashes07() { assertEquals("Replaced", "/foo/bar/car/", Path.replaceSlashes("/foo }
|
### Question:
JettyServerWrapper extends Server { HttpServiceContext getContext(final HttpContext httpContext) { readLock.lock(); try { ServletContextInfo servletContextInfo = contexts.get(httpContext); if (servletContextInfo != null) { return servletContextInfo.getHandler(); } return null; } finally { readLock.unlock(); } } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); HandlerCollection getRootHandlerCollection(); void configureContext(final Map<String, Object> attributes, final Integer timeout, final String cookie,
final String domain, final String path, final String url, final Boolean cookieHttpOnly,
final Boolean sessionCookieSecure, final String workerName, final Boolean lazy, final String directory,
Integer maxAge, final Boolean showStacks); void setServerConfigDir(File serverConfigDir); File getServerConfigDir(); URL getServerConfigURL(); void setServerConfigURL(URL serverConfigURL); String getDefaultAuthMethod(); void setDefaultAuthMethod(String defaultAuthMethod); String getDefaultRealmName(); void setDefaultRealmName(String defaultRealmName); }### Answer:
@Test public void registrationAndUnregistrationOfTwoServletsThereShouldBeNoContexts() throws Exception { JettyServerImpl server = new JettyServerImpl(serverModelMock, null); server.start(); try { Bundle testBundle = mock(Bundle.class); ContextModel contextModel = new ContextModel(httpContextMock, testBundle, getClass().getClassLoader(), null); ServletModel servletModel1 = new ServletModel(contextModel, new DefaultServlet(), "/s1", null, null, null); ServletModel servletModel2 = new ServletModel(contextModel, new DefaultServlet(), "/s2", null, null, null); assertNull(server.getServer().getContext(httpContextMock)); server.addServlet(servletModel1); assertNotNull(server.getServer().getContext(httpContextMock)); server.addServlet(servletModel2); assertNotNull(server.getServer().getContext(httpContextMock)); server.removeServlet(servletModel1); assertNotNull(server.getServer().getContext(httpContextMock)); server.removeServlet(servletModel2); assertNull(server.getServer().getContext(httpContextMock)); } finally { server.stop(); } }
|
### Question:
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static String normalizePattern(final String pattern); }### Answer:
@Test public void normalizeResourcePathSlash01() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/")); }
@Test public void normalizeResourcePathSlash02() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" /")); }
@Test public void normalizeResourcePathSlash03() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" / ")); }
@Test public void normalizeResourcePathSlash04() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/ ")); }
|
### Question:
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter,
final String[] urlPatterns, final String[] servletNames,
final Dictionary<String, ?> initParameter, final boolean asyncSupported); FilterModel(final ContextModel contextModel, final Class<? extends Filter> filterClass,
final String[] urlPatterns, final String[] servletNames,
final Dictionary<String, ?> initParameter, final boolean asyncSupported); FilterModel(final ContextModel contextModel, final Filter filter,
final Class<? extends Filter> filterClass,
final String[] urlPatterns, final String[] servletNames,
final Dictionary<String, ?> initParameter,
final boolean asyncSupported); Filter getFilter(); Class<? extends Filter> getFilterClass(); String getName(); String[] getUrlPatterns(); String[] getServletNames(); Map<String, String> getInitParams(); String[] getDispatcher(); boolean isAsyncSupported(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }### Answer:
@Test public void registerWithNoDispatcherInitParams() { FilterModel fm = new FilterModel(new ContextModel( createMock(WebContainerContext.class), null, getClass() .getClassLoader(), null), createMock(Filter.class), new String[]{"/*"}, null, new Hashtable<>(), false); System.out.println(Arrays.asList(fm.getDispatcher())); }
@Test public void registerWithCorrectSubsetOfDispatcherInitParams() { FilterModel fm = new FilterModel(new ContextModel( createMock(WebContainerContext.class), null, getClass() .getClassLoader(), null), createMock(Filter.class), new String[]{" private static final long serialVersionUID = 6291128067491953259L; { put(WebContainerConstants.FILTER_MAPPING_DISPATCHER, "REQUEST, FORWARD"); } }, false); System.out.println(Arrays.asList(fm.getDispatcher())); }
@Test public void registerWithFullComplimentOfDispatcherInitParams() { FilterModel fm = new FilterModel(new ContextModel( createMock(WebContainerContext.class), null, getClass() .getClassLoader(), null), createMock(Filter.class), new String[]{" private static final long serialVersionUID = 4025173284250768044L; { put(WebContainerConstants.FILTER_MAPPING_DISPATCHER, "REQUEST, FORWARD, ERROR , include"); } }, false); System.out.println(Arrays.asList(fm.getDispatcher())); }
|
### Question:
FileTools { public static boolean createBlankProject(String path, String projectName) { boolean result = true; result &= createDirectory(path + File.separator + projectName); result &= createAssetDirectories(path + File.separator + projectName); return result; } static String getJreDirectory(); static String getBuildsDirectory(); static String getProjectsDirectory(); static String getExecutionPath(Class clazz); static boolean createBlankProject(String path, String projectName); static Project createProjectFromTemplate(String path, String projectName, String template); static boolean createAssetDirectories(String path); static File doChoosePath(); static File doChooseFile(String extension, String directory, String type); static void saveAsset(AbstractAsset asset); }### Answer:
@Test public void testCreateDirectoryStructure() { System.out.println("createDirectoryStructure"); String path = System.getProperty("user.home"); String project = "Test"; boolean expResult = true; boolean result = FileTools.createBlankProject(path, project); assertEquals(expResult, result); }
|
### Question:
FileTools { public static File doChoosePath() { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getCurrentDirectory(); } return null; } static String getJreDirectory(); static String getBuildsDirectory(); static String getProjectsDirectory(); static String getExecutionPath(Class clazz); static boolean createBlankProject(String path, String projectName); static Project createProjectFromTemplate(String path, String projectName, String template); static boolean createAssetDirectories(String path); static File doChoosePath(); static File doChooseFile(String extension, String directory, String type); static void saveAsset(AbstractAsset asset); }### Answer:
@Test @Ignore public void testDoChoosePath() { System.out.println("doChoosePath"); File expResult = null; File result = FileTools.doChoosePath(); assertEquals(expResult, result); fail("The test case is a prototype."); }
|
### Question:
FileTools { public static File doChooseFile(String extension, String directory, String type) { if (MainWindow.getInstance().getActiveProject() != null) { File projectPath = new File(System.getProperty("project.path") + File.separator + directory); if (projectPath.exists()) { JFileChooser fileChooser = new JFileChooser(new SingleRootFileSystemView(projectPath)); fileChooser.setAcceptAllFileFilterUsed(false); FileNameExtensionFilter filter = new FileNameExtensionFilter(type, extension); fileChooser.setFileFilter(filter); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getSelectedFile(); } } } return null; } static String getJreDirectory(); static String getBuildsDirectory(); static String getProjectsDirectory(); static String getExecutionPath(Class clazz); static boolean createBlankProject(String path, String projectName); static Project createProjectFromTemplate(String path, String projectName, String template); static boolean createAssetDirectories(String path); static File doChoosePath(); static File doChooseFile(String extension, String directory, String type); static void saveAsset(AbstractAsset asset); }### Answer:
@Test @Ignore public void testDoChooseFile() { System.out.println("doChooseFile"); String extension = ""; String directory = ""; String type = ""; File expResult = null; File result = FileTools.doChooseFile(extension, directory, type); assertEquals(expResult, result); fail("The test case is a prototype."); }
|
### Question:
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getBytes(CHARSET); byteCollector.addBytes(randomStrBytes); byteCollector.addBytes(networkBytesOrder); byteCollector.addBytes(textBytes); byteCollector.addBytes(appidBytes); byte[] padBytes = PKCS7Encoder.encode(byteCollector.size()); byteCollector.addBytes(padBytes); byte[] unencrypted = byteCollector.toBytes(); try { Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES"); IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16); cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv); byte[] encrypted = cipher.doFinal(unencrypted); System.out.println(Base64.class.getProtectionDomain().getCodeSource().getLocation()); String base64Encrypted = base64.encodeToString(encrypted); return base64Encrypted; } catch (Exception e) { e.printStackTrace(); throw new AesException(AesException.EncryptAESError); } } WXBizMsgCrypt(String token, String encodingAesKey, String appId); String encryptMsg(String replyMsg, String timeStamp, String nonce); String decryptMsg(String msgSignature, String timeStamp, String nonce, String postData); String verifyUrl(String msgSignature, String timeStamp, String nonce, String echoStr); }### Answer:
@Test public void testAesEncrypt() { try { WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); assertEquals(afterAesEncrypt, pc.encrypt(randomStr, replyMsg)); } catch (AesException e) { e.printStackTrace(); fail("no异常"); } }
@Test public void testAesEncrypt2() { try { WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); assertEquals(afterAesEncrypt2, pc.encrypt(randomStr, replyMsg2)); } catch (AesException e) { e.printStackTrace(); fail("no异常"); } }
|
### Question:
JSONCPARepository implements CPARepository { public boolean isValidPartnerAgreement(final Map<String, Object> fields) { PartnerAgreement agreement = (PartnerAgreement) fields.get(EbmsConstants.CPA); return agreement != null; } void init(); @Override List<PartnerAgreement> getPartnerAgreements(); @Override List<PartnerAgreement> getActivePartnerAgreements(); @Override PartnerAgreement findByCPAId(String cpaId); @Override PartnerAgreement findByServiceAndAction(final String service, final String action); @Override PartnerAgreement findByMessage(Document message, String ebmsVersion); boolean isValidPartnerAgreement(final Map<String, Object> fields); File getCpaJsonFile(); void setCpaJsonFile(File cpaJsonFile); }### Answer:
@Test public void testIsValidPartnerAgreement() throws IOException { JSONCPARepository repository = new JSONCPARepository(); repository.setCpaJsonFile(fileFromClasspath("agreementWithServices.json")); repository.init(); Map<String,Object> fields = new ImmutableMap.Builder<String, Object>() .put(EbmsConstants.CPA, repository.getActivePartnerAgreements().get(0)) .build(); assertThat(repository.isValidPartnerAgreement(fields),is(true)); Map<String,Object> fields2 = new ImmutableMap.Builder<String, Object>() .put(EbmsConstants.MESSAGE_SERVICE, "service2") .put(EbmsConstants.MESSAGE_ACTION,"action1") .build(); assertThat(repository.isValidPartnerAgreement(fields2),is(false)); }
|
### Question:
FileMessageStore implements MessageStore { @Override public Message findByMessageId(final String messageId, String messageDirection) { return new DefaultMessage(messageId); } @Override void store(@Body InputStream input, Exchange exchange); @Override void storeMessage(Exchange exchange); @Override Message findByMessageId(final String messageId, String messageDirection); @Override InputStream findPayloadById(String messageId); @Override List<Message> findByMessageStatus(String messageDirection,String status); @Override void updateMessage(final String messageId, String messageDirection, MessageStatusType status, String statusDescription); String getBaseDir(); void setBaseDir(String baseDir); String getFileNameExpression(); void setFileNameExpression(String fileNameExpression); @Override String toString(); }### Answer:
@Test public void testFileMessageStore() throws IOException { Exchange request = new DefaultExchange(context()); request.getIn().setHeader(EbmsConstants.EBMS_VERSION,EbmsConstants.EBMS_V3); request.getIn().setHeader(EbmsConstants.MESSAGE_ID,"testMessageID"); request.getIn().setBody(new ByteArrayInputStream("test".getBytes())); Exchange response = context().createProducerTemplate().send(MessageStore.DEFAULT_MESSAGE_STORE_ENDPOINT,request); String msgId = response.getIn().getHeader(MessageStore.JENTRATA_MESSAGE_ID, String.class); assertThat(msgId,equalTo("testMessageID")); assertThat(messageStore.findByMessageId(msgId,EbmsConstants.MESSAGE_DIRECTION_INBOUND).getMessageId(),equalTo(msgId)); }
|
### Question:
FileMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { try { return new FileInputStream(getFilename(messageId)); } catch (FileNotFoundException e) { return null; } } @Override void store(@Body InputStream input, Exchange exchange); @Override void storeMessage(Exchange exchange); @Override Message findByMessageId(final String messageId, String messageDirection); @Override InputStream findPayloadById(String messageId); @Override List<Message> findByMessageStatus(String messageDirection,String status); @Override void updateMessage(final String messageId, String messageDirection, MessageStatusType status, String statusDescription); String getBaseDir(); void setBaseDir(String baseDir); String getFileNameExpression(); void setFileNameExpression(String fileNameExpression); @Override String toString(); }### Answer:
@Test public void testFindPayloadById() throws Exception { testFileMessageStore(); InputStream stream = messageStore.findPayloadById("testMessageID"); assertThat(IOUtils.toString(stream),equalTo("test")); }
|
### Question:
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPConstants.SOAP_1_2_PROTOCOL : SOAPConstants.SOAP_1_1_PROTOCOL; headers.put(EbmsConstants.SOAP_VERSION,soapVersion); String ebmsVersion = msg.contains(EbmsConstants.EBXML_V3_NAMESPACE) ? EbmsConstants.EBMS_V3 : EbmsConstants.EBMS_V2; headers.put(EbmsConstants.EBMS_VERSION,ebmsVersion); headers.put(EbmsConstants.MESSAGE_ID, getMessageId(msg)); headers.put(EbmsConstants.REF_TO_MESSAGE_ID, getRefMessageId(msg)); headers.put(EbmsConstants.MESSAGE_TYPE, getMessageType(msg).name()); } } finally { input.reset(); } } void parse(@Body InputStream input, @Headers Map<String, Object> headers); }### Answer:
@Test public void testSoap12SignMessage() throws Exception { MessageDetector messageDetector = new MessageDetector(); Map<String,Object> headers = new HashMap<>(); InputStream stream = new ByteArrayInputStream(EbmsUtils.toStringFromClasspath("signal-message.xml").getBytes()); messageDetector.parse(stream,headers); assertThat((String) headers.get(EbmsConstants.SOAP_VERSION),equalTo(SOAPConstants.SOAP_1_2_PROTOCOL)); assertThat((String) headers.get(EbmsConstants.EBMS_VERSION),equalTo(EbmsConstants.EBMS_V3)); assertThat((String) headers.get(EbmsConstants.MESSAGE_ID),equalTo("[email protected]")); assertThat((String) headers.get(EbmsConstants.REF_TO_MESSAGE_ID),equalTo("[email protected]")); assertThat((String) headers.get(EbmsConstants.MESSAGE_TYPE),equalTo(MessageType.SIGNAL_MESSAGE_WITH_USER_MESSAGE.name())); }
@Test public void testSoap12SignReceipt() throws Exception { MessageDetector messageDetector = new MessageDetector(); Map<String,Object> headers = new HashMap<>(); InputStream stream = new ByteArrayInputStream(EbmsUtils.toStringFromClasspath("signed-receipt.xml").getBytes()); messageDetector.parse(stream,headers); assertThat((String) headers.get(EbmsConstants.SOAP_VERSION),equalTo(SOAPConstants.SOAP_1_2_PROTOCOL)); assertThat((String) headers.get(EbmsConstants.EBMS_VERSION),equalTo(EbmsConstants.EBMS_V3)); assertThat((String) headers.get(EbmsConstants.MESSAGE_ID),equalTo("[email protected]")); assertThat((String) headers.get(EbmsConstants.REF_TO_MESSAGE_ID),equalTo("[email protected]")); assertThat((String) headers.get(EbmsConstants.MESSAGE_TYPE),equalTo(MessageType.SIGNAL_MESSAGE.name())); }
|
### Question:
JDBCMessageStore implements MessageStore { @Override public void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription) { repositoryManager.updateMessage(messageId,messageDirection,status,statusDescription); } void init(); @Override void store(InputStream message, Exchange exchange); void storeMessage(Exchange exchange); @Override void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription); @Override Message findByMessageId(String messageId, String messageDirection); @Override InputStream findPayloadById(String messageId); @Override List<Message> findByMessageStatus(String messageDirection, String status); RepositoryManager getRepositoryManager(); void setRepositoryManager(RepositoryManager repositoryManager); boolean isCreateTables(); void setCreateTables(boolean createTables); UUIDGenerator getUuidGenerator(); void setUuidGenerator(UUIDGenerator uuidGenerator); }### Answer:
@Test public void testUpdateStoreMimeMessage() throws Exception { File body = fileFromClasspath("simple-as4-receipt.xml"); String contentType = "Multipart/Related; boundary=\"----=_Part_7_10584188.1123489648993\"; type=\"application/soap+xml\"; start=\"<[email protected]>\""; String messageId = "testMimeMessage1"; assertStoredMessage(messageId, contentType, body, MessageType.USER_MESSAGE); messageStore.updateMessage(messageId, EbmsConstants.MESSAGE_DIRECTION_INBOUND, MessageStatusType.RECEIVED,"Message Received"); try(Connection conn = dataSource.getConnection()) { try (PreparedStatement st = conn.prepareStatement("select * from message where message_id = ?")) { st.setString(1,messageId); ResultSet resultSet = st.executeQuery(); assertThat(resultSet.next(),is(true)); assertThat(resultSet.getString("status"),equalTo("RECEIVED")); assertThat(resultSet.getString("status_description"),equalTo("Message Received")); } } }
|
### Question:
JDBCMessageStore implements MessageStore { @Override public Message findByMessageId(String messageId, String messageDirection) { Map<String,Object> fields = new HashMap<>(); fields.put("message_id",messageId); fields.put("message_box",messageDirection); List<Message> messages = repositoryManager.selectMessageBy(fields); if(messages.size() > 0) { return messages.get(0); } return null; } void init(); @Override void store(InputStream message, Exchange exchange); void storeMessage(Exchange exchange); @Override void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription); @Override Message findByMessageId(String messageId, String messageDirection); @Override InputStream findPayloadById(String messageId); @Override List<Message> findByMessageStatus(String messageDirection, String status); RepositoryManager getRepositoryManager(); void setRepositoryManager(RepositoryManager repositoryManager); boolean isCreateTables(); void setCreateTables(boolean createTables); UUIDGenerator getUuidGenerator(); void setUuidGenerator(UUIDGenerator uuidGenerator); }### Answer:
@Test public void testFindByMessageId() throws Exception { String contentType = "application/soap+xml"; File body = fileFromClasspath("simple-as4-receipt.xml"); String messageId = "testSoapMessage1"; assertStoredMessage(messageId, contentType, body, MessageType.SIGNAL_MESSAGE_WITH_USER_MESSAGE); messageStore.updateMessage(messageId, EbmsConstants.MESSAGE_DIRECTION_INBOUND, MessageStatusType.RECEIVED,"Message Received"); Message message = messageStore.findByMessageId("testSoapMessage1",EbmsConstants.MESSAGE_DIRECTION_INBOUND); assertThat(message,notNullValue()); assertThat(message.getMessageId(),equalTo("testSoapMessage1")); assertThat(message.getStatus(),equalTo(MessageStatusType.RECEIVED)); assertThat(message.getStatusDescription(),equalTo("Message Received")); }
|
### Question:
JDBCMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { InputStream payload = repositoryManager.selectRepositoryBy("message_id",messageId); return payload; } void init(); @Override void store(InputStream message, Exchange exchange); void storeMessage(Exchange exchange); @Override void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription); @Override Message findByMessageId(String messageId, String messageDirection); @Override InputStream findPayloadById(String messageId); @Override List<Message> findByMessageStatus(String messageDirection, String status); RepositoryManager getRepositoryManager(); void setRepositoryManager(RepositoryManager repositoryManager); boolean isCreateTables(); void setCreateTables(boolean createTables); UUIDGenerator getUuidGenerator(); void setUuidGenerator(UUIDGenerator uuidGenerator); }### Answer:
@Test public void testFindPayloadById() throws Exception { testFindByMessageId(); InputStream stream = messageStore.findPayloadById("testSoapMessage1"); assertThat(stream,notNullValue()); assertThat(IOUtils.toString(stream),equalTo(IOUtils.toString(new FileInputStream(fileFromClasspath("simple-as4-receipt.xml"))))); }
|
### Question:
JDBCMessageStore implements MessageStore { @Override public List<Message> findByMessageStatus(String messageDirection, String status) { Map<String,Object> fields = new HashMap<>(); fields.put("status",status); fields.put("message_box",messageDirection); fields.put("orderByDesc","time_stamp"); fields.put("maxResults",100); List<Message> messages = repositoryManager.selectMessageBy(fields); return messages; } void init(); @Override void store(InputStream message, Exchange exchange); void storeMessage(Exchange exchange); @Override void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription); @Override Message findByMessageId(String messageId, String messageDirection); @Override InputStream findPayloadById(String messageId); @Override List<Message> findByMessageStatus(String messageDirection, String status); RepositoryManager getRepositoryManager(); void setRepositoryManager(RepositoryManager repositoryManager); boolean isCreateTables(); void setCreateTables(boolean createTables); UUIDGenerator getUuidGenerator(); void setUuidGenerator(UUIDGenerator uuidGenerator); }### Answer:
@Test public void testFindMessageByStatus() throws Exception { testFindByMessageId(); List<Message> messages = messageStore.findByMessageStatus(EbmsConstants.MESSAGE_DIRECTION_INBOUND,MessageStatusType.RECEIVED.name()); assertThat(messages,notNullValue()); assertThat(messages,hasSize(1)); Message message = messages.get(0); assertThat(message,notNullValue()); assertThat(message.getMessageId(),equalTo("testSoapMessage1")); assertThat(message.getStatus(),equalTo(MessageStatusType.RECEIVED)); assertThat(message.getStatusDescription(),equalTo("Message Received")); }
|
### Question:
AvailableSegment extends Segment implements Serializable { public ITEM get(int position) { if (items == null) { return null; } if (covered(position)) { int index = position - getFrom(); return index < items.size() ? items.get(index) : null; } return null; } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean covered(int position); void dataProvided(List<ITEM> items); void dataProvided(List<ITEM> items, int maxIndex); List<ITEM> getData(); String toString(); }### Answer:
@Test public void testGet() { AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2); assertEquals(20, a.getFrom()); assertEquals(30, a.getTo()); assertEquals(2, a.getPage()); a.dataProvided(TestItem.range(20, 30)); assertEquals("p.20", a.get(20).toString()); assertEquals("p.29", a.get(29).toString()); assertNull(a.get(19)); assertNull(a.get(30)); }
|
### Question:
AvailableSegment extends Segment implements Serializable { public boolean covered(int position) { return model.getPage(position) == page; } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean covered(int position); void dataProvided(List<ITEM> items); void dataProvided(List<ITEM> items, int maxIndex); List<ITEM> getData(); String toString(); }### Answer:
@Test public void testCovered() { AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2); when(model.getPage(anyInt())).thenReturn(2); assertTrue(a.covered(0)); when(model.getPage(anyInt())).thenReturn(1); assertFalse(a.covered(0)); }
|
### Question:
AvailableSegment extends Segment implements Serializable { public void dataProvided(List<ITEM> items) { if (items == null) { dataProvided(items, 0); } else { dataProvided(items, getFrom() + items.size()); } } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean covered(int position); void dataProvided(List<ITEM> items); void dataProvided(List<ITEM> items, int maxIndex); List<ITEM> getData(); String toString(); }### Answer:
@Test public void testDataProvided() { AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2); assertNull(a.get(20)); assertNull(a.get(29)); assertNull(a.get(19)); assertNull(a.get(30)); assertEquals(0, a.getMaxIndex()); a.dataProvided(TestItem.range(20, 29)); assertEquals("p.20", a.get(20).toString()); assertEquals("p.28", a.get(28).toString()); assertNull(a.get(19)); assertNull(a.get(29)); assertNull(a.get(30)); assertEquals(29, a.getMaxIndex()); a.dataProvided(TestItem.range(20, 30)); assertEquals(30, a.getMaxIndex()); assertEquals("p.29", a.get(29).toString()); a.dataProvided(null); assertNull(a.get(20)); assertNull(a.get(29)); assertNull(a.get(19)); assertNull(a.get(30)); assertEquals(0, a.getMaxIndex()); }
|
### Question:
Segment implements Serializable { public Segment(UncoveringDataModel<ITEM> model, int page) { this.model = model; this.page = page; } Segment(UncoveringDataModel<ITEM> model, int page); int getFrom(); int getTo(); int getPage(); @Override boolean equals(Object o); void setModel(UncoveringDataModel<ITEM> model); @Override int hashCode(); String toString(); }### Answer:
@Test public void testSegment() { UncoveringDataModel<TestItem> model = mock(UncoveringDataModel.class); when(model.getPageSize()).thenReturn(10); Segment s = new Segment(model, 20); assertEquals(200, s.getFrom()); assertEquals(210, s.getTo()); assertEquals(20, s.getPage()); }
|
### Question:
WeatherService { public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude) { return api.getForecastWeather(longitude, latitude) .subscribeOn(scheduler) .take(1); } @Inject WeatherService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler, ImageRequestManager imageRequestManager); Observable<Bitmap> loadIcon(String icon); Observable<TomorrowWeather> getTomorrowWeather(double longitude, double latitude); Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude); Observable<TodayWeather> getCurrentWeather(double longitude, double latitude); }### Answer:
@Test public void shouldLoadForecastWeather() throws ParseException, IOException { final ThreeHoursForecastWeather item = Fakes.fakeResponse(Responses.JSON.THREE_HOUR_FORECAST); doReturn(Observable.just(item)) .when(weatherApi).getForecastWeather(anyDouble(), anyDouble()); TestObserver<ThreeHoursForecastWeather> testObserver = new TestObserver<>(); weatherService.getForecastWeather(1.0, 1.0).subscribe(testObserver); testObserver.assertSubscribed().assertNoErrors().assertComplete().assertValue(item); }
|
### Question:
SearchService { public Observable<SearchModel> searchByCity(String city) { lastCity = city; return api.searchWeather(city).subscribeOn(this.scheduler); } @Inject SearchService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler); Observable<SearchModel> searchByCity(String city); String getLastSearch(); }### Answer:
@Test public void searchApiFunctionIsCalled() { final TestObserver<SearchModel> observer = new TestObserver<>(); searchService.searchByCity(CITY).subscribe(observer); verify(weatherApi).searchWeather(CITY); observer.assertSubscribed() .assertNoErrors() .assertComplete() .assertValue(item); }
|
### Question:
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted(); weatherService.getForecastWeather(longitude, latitude) .map(weatherParser::parse) .observeOn(androidScheduler) .subscribe(this::handleForecastDataResult, this::showError); } } @Inject @Replaceable TomorrowWeatherViewModel(NavigationController navigation,
@RxObservable(PAGE) Observable<Integer> pageChangeObservable,
PermissionService permissionService,
LocationService locationService,
WeatherService weatherService,
TomorrowWeatherResponseFilter weatherParser,
@RxScheduler(MAIN) Scheduler androidScheduler); void loadForecastWeatherDataForTomorrow(); }### Answer:
@Test public void shouldNotLoadForecastsIfNoLocationIsPresent() { when(locationService.lastLocation()).thenReturn(null); vm.onViewAttached(); vm.loadForecastWeatherDataForTomorrow(); verifyZeroInteractions(weatherService); }
@Test public void shouldLoadForecastsIfLocationIsPresent() throws ParseException, IOException { double longitude = 1.0; double latitude = 1.0; final Location location = mockLocation(mock(Location.class), 1.0, 1.0); when(locationService.lastLocation()).thenReturn(location); String expectedResult = Responses.createExpectedFilteredResult(); when(weatherParser.parse(any(ThreeHoursForecastWeather.class))).thenReturn(expectedResult); when(weatherService.getForecastWeather(longitude, latitude)) .thenReturn(Observable.just(fakeResponse(Responses.JSON.THREE_HOUR_FORECAST))); vm.loadForecastWeatherDataForTomorrow(); verify(navigation).toForecastActivity(expectedResult); }
|
### Question:
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted(); weatherService.getForecastWeather(longitude, latitude) .map(weatherParser::parse) .observeOn(androidScheduler) .subscribe(forecastData -> { dispatchRequestFinished(); navigateToForecastActivity(forecastData); }, this::showError); } } @Inject @Replaceable TodayWeatherViewModel(NavigationController navigation,
@RxObservable(PAGE) Observable<Integer> pageChangeObservable,
PermissionService permissionService,
LocationService locationService, WeatherService weatherService,
TodayWeatherResponseFilter weatherParser,
@RxScheduler(MAIN) Scheduler androidScheduler); void loadForecastWeatherDataForToday(); }### Answer:
@Test public void shouldNotLoadForecastsIfNoLocationIsPresent() { when(locationService.lastLocation()).thenReturn(null); vm.onViewAttached(); vm.loadForecastWeatherDataForToday(); verifyZeroInteractions(weatherService); }
@Test public void shouldLoadForecastsIfLocationIsPresent() throws ParseException, IOException { double longitude = 1.0; double latitude = 1.0; final Location location = mockLocation(mock(Location.class), 1.0, 1.0); when(locationService.lastLocation()).thenReturn(location); String expectedResult = Responses.createExpectedFilteredResult(); when(weatherParser.parse(any(ThreeHoursForecastWeather.class))).thenReturn(expectedResult); when(weatherService.getForecastWeather(longitude, latitude)) .thenReturn(Observable.just(fakeResponse(Responses.JSON.THREE_HOUR_FORECAST))); vm.loadForecastWeatherDataForToday(); verify(navigation).toForecastActivity(expectedResult); }
|
### Question:
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }### Answer:
@Test public void testCheckReset_IMMEDIATELY() { SyncTrigger syncTrigger = new SyncTrigger( () -> mockTrigger.triggered(), () -> mockThreshold.shouldTrigger(), IMMEDIATELY); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, times(1)).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, times(1)).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, times(1)).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); }
@Test public void testCheckReset_ONLY_AFTER_REVERSION() { SyncTrigger syncTrigger = new SyncTrigger( () -> mockTrigger.triggered(), () -> mockThreshold.shouldTrigger(), ONLY_AFTER_REVERSION); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, times(1)).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, times(1)).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); }
@Test public void testCheckReset_NEVER() { SyncTrigger syncTrigger = new SyncTrigger( () -> mockTrigger.triggered(), () -> mockThreshold.shouldTrigger(), NEVER); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, times(1)).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); when(mockThreshold.shouldTrigger()).thenReturn(true); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTrigger(); reset(mockTrigger); reset(mockThreshold); }
|
### Question:
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOriginal is already longer than the desiredLength, textOriginal.length():" + textOriginal.length() + " desiredLength:" + desiredLength); } StringBuilder sb = new StringBuilder(); for (int ii = 0; ii < paddingCharactersRequired; ii++) { sb.append(paddingCharacter); } if (pad == LEFT) { sb.append(textOriginal); } else { sb.insert(0, textOriginal); } return sb.toString(); } static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter); }### Answer:
@Test public void testPaddingOnTheRight() { String paddedText = TextPadder.padText(TEXT_ORIG, 10, TextPadder.Pad.RIGHT, '+'); Assert.assertEquals(TEXT_ORIG + "+++++++", paddedText); }
@Test public void testPaddingOnTheLeft() { String paddedText = TextPadder.padText(TEXT_ORIG, 10, TextPadder.Pad.LEFT, '*'); Assert.assertEquals("*******" + TEXT_ORIG, paddedText); }
@Test public void testPaddingWhenAlreadyPadded() { String paddedText = TextPadder.padText(TEXT_ORIG, 3, TextPadder.Pad.LEFT, PADDING_CHARACTER); Assert.assertEquals(TEXT_ORIG, paddedText); }
@Test public void testPaddingIllegalValues() { try { TextPadder.padText(null, 3, TextPadder.Pad.LEFT, PADDING_CHARACTER); Assert.fail("should have thrown an exception by now: original text was null"); } catch (Exception e) { } try { TextPadder.padText(TEXT_ORIG, 3, null, PADDING_CHARACTER); Assert.fail("should have thrown an exception by now: pad direction was null"); } catch (Exception e) { } try { TextPadder.padText(TEXT_ORIG, 2, TextPadder.Pad.LEFT, PADDING_CHARACTER); Assert.fail("should have thrown an exception by now: original text was already longer than the desiredLength"); } catch (Exception e) { } }
|
### Question:
CounterWithProgress extends ObservableImp { @SuppressLint("StaticFieldLeak") public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new Async<Void, Integer, Integer>(workMode) { @Override protected Integer doInBackground(Void... voids) { int totalIncrease = 0; for (int ii=0; ii<20; ii++) { synchronized (this) { try { wait(workMode == WorkMode.SYNCHRONOUS ? 1 : 100); } catch (InterruptedException e) { } } publishProgressTask(++totalIncrease); } return totalIncrease; } @Override protected void onProgressUpdate(Integer... values) { logger.i(TAG, "-tick-"); progress = values[0]; notifyObservers(); } @Override protected void onPostExecute(Integer result) { logger.i(TAG, "done"); count = count + result; isBusy = false; progress = 0; notifyObservers(); } }.executeTask((Void)null); } CounterWithProgress(WorkMode workMode, Logger logger); @SuppressLint("StaticFieldLeak") void increaseBy20(); boolean isBusy(); int getCount(); int getProgress(); static final String TAG; }### Answer:
@Test public void observersNotifiedAtLeastOnce() throws Exception { CounterWithProgress counterWithProgress = new CounterWithProgress(WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); counterWithProgress.addObserver(mockObserver); counterWithProgress.increaseBy20(); verify(mockObserver, atLeastOnce()).somethingChanged(); }
|
### Question:
CounterWithLambdas extends ObservableImp { public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new AsyncBuilder<Void, Integer>(workMode) .doInBackground(input -> CounterWithLambdas.this.doStuffInBackground(input)) .onPostExecute(result -> CounterWithLambdas.this.doThingsWithTheResult(result)) .execute((Void) null); } CounterWithLambdas(WorkMode workMode, Logger logger); void increaseBy20(); boolean isBusy(); int getCount(); static final String TAG; }### Answer:
@Test public void observersNotifiedAtLeastOnce() throws Exception { CounterWithLambdas counterWithLambdas = new CounterWithLambdas(WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); counterWithLambdas.addObserver(mockObserver); counterWithLambdas.increaseBy20(); verify(mockObserver, atLeastOnce()).somethingChanged(); }
|
### Question:
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); @Override UpdateSpec getAndClearLatestUpdateSpec(long maxAgeMs); }### Answer:
@Test public void addNewTrack() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.addNewTrack(); Assert.assertEquals(1, playlistAdvancedModel.getTrackListSize()); Assert.assertEquals(1, playlistAdvancedModel.getTrack(0).getNumberOfPlaysRequested()); }
@Test public void observersNotifiedAtLeastOnceForAddTrack() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); playlistAdvancedModel.addObserver(mockObserver); playlistAdvancedModel.addNewTrack(); verify(mockObserver, atLeastOnce()).somethingChanged(); }
|
### Question:
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeTrack(int index) { logger.i(TAG, "removeTrack() " + index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); @Override UpdateSpec getAndClearLatestUpdateSpec(long maxAgeMs); }### Answer:
@Test public void removeTrack() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.addNewTrack(); playlistAdvancedModel.removeTrack(0); Assert.assertEquals(0, playlistAdvancedModel.getTrackListSize()); }
|
### Question:
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); @Override UpdateSpec getAndClearLatestUpdateSpec(long maxAgeMs); }### Answer:
@Test public void add5NewTracks() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.add5NewTracks(); Assert.assertEquals(5, playlistAdvancedModel.getTrackListSize()); Assert.assertEquals(1, playlistAdvancedModel.getTrack(4).getNumberOfPlaysRequested()); }
|
### Question:
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.removeRange(0, 5); notifyObservers(); } } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); @Override UpdateSpec getAndClearLatestUpdateSpec(long maxAgeMs); }### Answer:
@Test public void remove5Tracks() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.add5NewTracks(); playlistAdvancedModel.remove5Tracks(); Assert.assertEquals(0, playlistAdvancedModel.getTrackListSize()); }
|
### Question:
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); @Override UpdateSpec getAndClearLatestUpdateSpec(long maxAgeMs); }### Answer:
@Test public void removeAllTracks() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.add5NewTracks(); playlistAdvancedModel.addNewTrack(); playlistAdvancedModel.addNewTrack(); playlistAdvancedModel.removeAllTracks(); Assert.assertEquals(0, playlistAdvancedModel.getTrackListSize()); }
|
### Question:
PlaylistSimpleModel extends ObservableImp { public int getTrackListSize(){ return trackList.size(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); }### Answer:
@Test public void initialConditions() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); Assert.assertEquals(false, playlistSimpleModel.hasObservers()); }
|
### Question:
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); }### Answer:
@Test public void addNewTrack() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.addNewTrack(); Assert.assertEquals(1, playlistSimpleModel.getTrackListSize()); Assert.assertEquals(1, playlistSimpleModel.getTrack(0).getNumberOfPlaysRequested()); }
@Test public void observersNotifiedAtLeastOnceForAddTrack() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); playlistSimpleModel.addObserver(mockObserver); playlistSimpleModel.addNewTrack(); verify(mockObserver, atLeastOnce()).somethingChanged(); }
|
### Question:
PlaylistSimpleModel extends ObservableImp { public void removeTrack(int index){ logger.i(TAG, "removeTrack() "+index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); }### Answer:
@Test public void removeTrack() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.addNewTrack(); playlistSimpleModel.removeTrack(0); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); }
|
### Question:
PlaylistSimpleModel extends ObservableImp { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); }### Answer:
@Test public void add5NewTracks() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.add5NewTracks(); Assert.assertEquals(5, playlistSimpleModel.getTrackListSize()); Assert.assertEquals(1, playlistSimpleModel.getTrack(4).getNumberOfPlaysRequested()); }
|
### Question:
PlaylistSimpleModel extends ObservableImp { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.subList(0, 5).clear(); notifyObservers(); } } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); }### Answer:
@Test public void remove5Tracks() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.add5NewTracks(); playlistSimpleModel.remove5Tracks(); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); }
|
### Question:
PlaylistSimpleModel extends ObservableImp { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTrack(int index); int getTrackListSize(); void add5NewTracks(); void remove5Tracks(); }### Answer:
@Test public void removeAllTracks() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.add5NewTracks(); playlistSimpleModel.addNewTrack(); playlistSimpleModel.addNewTrack(); playlistSimpleModel.removeAllTracks(); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); }
|
### Question:
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int getSavingsWalletAmount(); boolean canIncrease(); boolean canDecrease(); final int totalDollarsAvailable; }### Answer:
@Test public void increaseMobileWallet() throws Exception { Wallet wallet = new Wallet(logger); wallet.increaseMobileWallet(); Assert.assertEquals(true, wallet.canIncrease()); Assert.assertEquals(true, wallet.canDecrease()); Assert.assertEquals(wallet.totalDollarsAvailable - 1, wallet.getSavingsWalletAmount()); Assert.assertEquals(1, wallet.getMobileWalletAmount()); }
@Test public void observersNotifiedAtLeastOnceForIncrease() throws Exception { Wallet wallet = new Wallet(logger); Observer mockObserver = mock(Observer.class); wallet.addObserver(mockObserver); wallet.increaseMobileWallet(); verify(mockObserver, atLeastOnce()).somethingChanged(); }
|
### Question:
Wallet extends ObservableImp { public void decreaseMobileWallet(){ if (canDecrease()) { mobileWalletDollars--; logger.i(TAG, "Decreasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int getSavingsWalletAmount(); boolean canIncrease(); boolean canDecrease(); final int totalDollarsAvailable; }### Answer:
@Test public void decreaseMobileWallet() throws Exception { Wallet wallet = new Wallet(logger); wallet.increaseMobileWallet(); Assert.assertEquals(1, wallet.getMobileWalletAmount()); wallet.decreaseMobileWallet(); Assert.assertEquals(true, wallet.canIncrease()); Assert.assertEquals(false, wallet.canDecrease()); Assert.assertEquals(wallet.totalDollarsAvailable, wallet.getSavingsWalletAmount()); Assert.assertEquals(0, wallet.getMobileWalletAmount()); }
|
### Question:
AmazonWebServiceClient { public String getServiceName() { return getServiceNameIntern(); } protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final RequestMetricCollector requestMetricCollector); protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient,
final RequestMetricCollector requestMetricCollector); void setEndpoint(final String endpoint); String getEndpoint(); String getEndpointPrefix(); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setEndpoint(final String endpoint,
final String serviceName,
final String regionId); @SuppressWarnings("checkstyle:hiddenfield") Signer getSignerByURI(final URI uri); @SuppressWarnings("checkstyle:hiddenfield") void setRegion(final Region region); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setConfiguration(final ClientConfiguration clientConfiguration); void shutdown(); @Deprecated void addRequestHandler(final RequestHandler requestHandler); void addRequestHandler(final RequestHandler2 requestHandler2); @Deprecated void removeRequestHandler(final RequestHandler requestHandler); void removeRequestHandler(final RequestHandler2 requestHandler2); void setTimeOffset(final int timeOffset); @SuppressWarnings("checkstyle:hiddenfield") AmazonWebServiceClient withTimeOffset(final int timeOffset); int getTimeOffset(); @Deprecated RequestMetricCollector getRequestMetricsCollector(); String getServiceName(); @SuppressWarnings("checkstyle:hiddenfield") final void setServiceNameIntern(final String serviceName); final String getSignerRegionOverride(); @SuppressWarnings("checkstyle:hiddenfield") final void setSignerRegionOverride(final String signerRegionOverride); static final boolean LOGGING_AWS_REQUEST_METRIC; }### Answer:
@Test public void emptyClient() { final AmazonWebServiceClient client = new AmazonWebServiceClient(new ClientConfiguration()) { }; try { client.getServiceName(); } catch (final IllegalStateException exception) { } }
@Test public void testGetServiceNameWithExplicitInternalConfiguration() { final AmazonSimpleDBClient testClient = new AmazonSimpleDBClient(); assertEquals(testClient.getServiceName(), "sdb"); }
@Test public void testGetServiceNameWithAWSPrefix() { final AWSTestClient testClient = new AWSTestClient(); assertEquals(testClient.getServiceName(), "test"); }
|
### Question:
AmazonWebServiceClient { protected Signer getSigner() { return signer; } protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final RequestMetricCollector requestMetricCollector); protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient,
final RequestMetricCollector requestMetricCollector); void setEndpoint(final String endpoint); String getEndpoint(); String getEndpointPrefix(); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setEndpoint(final String endpoint,
final String serviceName,
final String regionId); @SuppressWarnings("checkstyle:hiddenfield") Signer getSignerByURI(final URI uri); @SuppressWarnings("checkstyle:hiddenfield") void setRegion(final Region region); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setConfiguration(final ClientConfiguration clientConfiguration); void shutdown(); @Deprecated void addRequestHandler(final RequestHandler requestHandler); void addRequestHandler(final RequestHandler2 requestHandler2); @Deprecated void removeRequestHandler(final RequestHandler requestHandler); void removeRequestHandler(final RequestHandler2 requestHandler2); void setTimeOffset(final int timeOffset); @SuppressWarnings("checkstyle:hiddenfield") AmazonWebServiceClient withTimeOffset(final int timeOffset); int getTimeOffset(); @Deprecated RequestMetricCollector getRequestMetricsCollector(); String getServiceName(); @SuppressWarnings("checkstyle:hiddenfield") final void setServiceNameIntern(final String serviceName); final String getSignerRegionOverride(); @SuppressWarnings("checkstyle:hiddenfield") final void setSignerRegionOverride(final String signerRegionOverride); static final boolean LOGGING_AWS_REQUEST_METRIC; }### Answer:
@Test public void testOverrideSigner() { final ClientConfiguration config = new ClientConfiguration(); config.setSignerOverride("QueryStringSignerType"); final AmazonTestClient client = new AmazonTestClient(config); Assert.assertTrue(client.getSigner() instanceof QueryStringSigner); }
|
### Question:
AmazonWebServiceClient { @SuppressWarnings("checkstyle:hiddenfield") public final void setServiceNameIntern(final String serviceName) { this.serviceName = serviceName; } protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final RequestMetricCollector requestMetricCollector); protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient,
final RequestMetricCollector requestMetricCollector); void setEndpoint(final String endpoint); String getEndpoint(); String getEndpointPrefix(); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setEndpoint(final String endpoint,
final String serviceName,
final String regionId); @SuppressWarnings("checkstyle:hiddenfield") Signer getSignerByURI(final URI uri); @SuppressWarnings("checkstyle:hiddenfield") void setRegion(final Region region); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setConfiguration(final ClientConfiguration clientConfiguration); void shutdown(); @Deprecated void addRequestHandler(final RequestHandler requestHandler); void addRequestHandler(final RequestHandler2 requestHandler2); @Deprecated void removeRequestHandler(final RequestHandler requestHandler); void removeRequestHandler(final RequestHandler2 requestHandler2); void setTimeOffset(final int timeOffset); @SuppressWarnings("checkstyle:hiddenfield") AmazonWebServiceClient withTimeOffset(final int timeOffset); int getTimeOffset(); @Deprecated RequestMetricCollector getRequestMetricsCollector(); String getServiceName(); @SuppressWarnings("checkstyle:hiddenfield") final void setServiceNameIntern(final String serviceName); final String getSignerRegionOverride(); @SuppressWarnings("checkstyle:hiddenfield") final void setSignerRegionOverride(final String signerRegionOverride); static final boolean LOGGING_AWS_REQUEST_METRIC; }### Answer:
@Test public void setServiceNameIntern() { final AmazonTestClient client = new AmazonTestClient(); assertEquals(client.getServiceName(), client.getServiceNameIntern()); final String serviceNameOverride = "foo"; assertFalse(serviceNameOverride.equals(client.getServiceName())); client.setServiceNameIntern(serviceNameOverride); assertEquals(serviceNameOverride, client.getServiceName()); }
|
### Question:
AmazonWebServiceClient { public void setEndpoint(final String endpoint) { final URI uri = toURI(endpoint); @SuppressWarnings("checkstyle:hiddenfield") final Signer signer = computeSignerByURI(uri, signerRegionOverride, false); synchronized (this) { this.endpoint = uri; this.signer = signer; } } protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final RequestMetricCollector requestMetricCollector); protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient,
final RequestMetricCollector requestMetricCollector); void setEndpoint(final String endpoint); String getEndpoint(); String getEndpointPrefix(); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setEndpoint(final String endpoint,
final String serviceName,
final String regionId); @SuppressWarnings("checkstyle:hiddenfield") Signer getSignerByURI(final URI uri); @SuppressWarnings("checkstyle:hiddenfield") void setRegion(final Region region); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setConfiguration(final ClientConfiguration clientConfiguration); void shutdown(); @Deprecated void addRequestHandler(final RequestHandler requestHandler); void addRequestHandler(final RequestHandler2 requestHandler2); @Deprecated void removeRequestHandler(final RequestHandler requestHandler); void removeRequestHandler(final RequestHandler2 requestHandler2); void setTimeOffset(final int timeOffset); @SuppressWarnings("checkstyle:hiddenfield") AmazonWebServiceClient withTimeOffset(final int timeOffset); int getTimeOffset(); @Deprecated RequestMetricCollector getRequestMetricsCollector(); String getServiceName(); @SuppressWarnings("checkstyle:hiddenfield") final void setServiceNameIntern(final String serviceName); final String getSignerRegionOverride(); @SuppressWarnings("checkstyle:hiddenfield") final void setSignerRegionOverride(final String signerRegionOverride); static final boolean LOGGING_AWS_REQUEST_METRIC; }### Answer:
@Test public void testSetEndpoint() throws URISyntaxException { final AmazonTestClient client = new AmazonTestClient(); client.setEndpoint("http: assertEquals(client.endpoint, new URI("http: }
|
### Question:
AmazonWebServiceClient { @SuppressWarnings("checkstyle:hiddenfield") public final void setSignerRegionOverride(final String signerRegionOverride) { final Signer signer = computeSignerByURI(endpoint, signerRegionOverride, true); synchronized (this) { this.signer = signer; this.signerRegionOverride = signerRegionOverride; } } protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final RequestMetricCollector requestMetricCollector); protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient,
final RequestMetricCollector requestMetricCollector); void setEndpoint(final String endpoint); String getEndpoint(); String getEndpointPrefix(); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setEndpoint(final String endpoint,
final String serviceName,
final String regionId); @SuppressWarnings("checkstyle:hiddenfield") Signer getSignerByURI(final URI uri); @SuppressWarnings("checkstyle:hiddenfield") void setRegion(final Region region); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setConfiguration(final ClientConfiguration clientConfiguration); void shutdown(); @Deprecated void addRequestHandler(final RequestHandler requestHandler); void addRequestHandler(final RequestHandler2 requestHandler2); @Deprecated void removeRequestHandler(final RequestHandler requestHandler); void removeRequestHandler(final RequestHandler2 requestHandler2); void setTimeOffset(final int timeOffset); @SuppressWarnings("checkstyle:hiddenfield") AmazonWebServiceClient withTimeOffset(final int timeOffset); int getTimeOffset(); @Deprecated RequestMetricCollector getRequestMetricsCollector(); String getServiceName(); @SuppressWarnings("checkstyle:hiddenfield") final void setServiceNameIntern(final String serviceName); final String getSignerRegionOverride(); @SuppressWarnings("checkstyle:hiddenfield") final void setSignerRegionOverride(final String signerRegionOverride); static final boolean LOGGING_AWS_REQUEST_METRIC; }### Answer:
@Test public void testSetSignerRegionOverride() { final AmazonTestClient client = new AmazonTestClient(); client.setSignerRegionOverride("test"); assertEquals(client.getSignerRegionOverride(), "test"); }
|
### Question:
AmazonWebServiceClient { protected ExecutionContext createExecutionContext(final AmazonWebServiceRequest req) { final boolean isMetricsEnabled = isRequestMetricsEnabled(req) || isProfilingEnabled(); return new ExecutionContext(requestHandler2s, isMetricsEnabled, this); } protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final RequestMetricCollector requestMetricCollector); protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient); @Deprecated protected AmazonWebServiceClient(
final ClientConfiguration clientConfiguration,
final HttpClient httpClient,
final RequestMetricCollector requestMetricCollector); void setEndpoint(final String endpoint); String getEndpoint(); String getEndpointPrefix(); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setEndpoint(final String endpoint,
final String serviceName,
final String regionId); @SuppressWarnings("checkstyle:hiddenfield") Signer getSignerByURI(final URI uri); @SuppressWarnings("checkstyle:hiddenfield") void setRegion(final Region region); @Deprecated @SuppressWarnings("checkstyle:hiddenfield") void setConfiguration(final ClientConfiguration clientConfiguration); void shutdown(); @Deprecated void addRequestHandler(final RequestHandler requestHandler); void addRequestHandler(final RequestHandler2 requestHandler2); @Deprecated void removeRequestHandler(final RequestHandler requestHandler); void removeRequestHandler(final RequestHandler2 requestHandler2); void setTimeOffset(final int timeOffset); @SuppressWarnings("checkstyle:hiddenfield") AmazonWebServiceClient withTimeOffset(final int timeOffset); int getTimeOffset(); @Deprecated RequestMetricCollector getRequestMetricsCollector(); String getServiceName(); @SuppressWarnings("checkstyle:hiddenfield") final void setServiceNameIntern(final String serviceName); final String getSignerRegionOverride(); @SuppressWarnings("checkstyle:hiddenfield") final void setSignerRegionOverride(final String signerRegionOverride); static final boolean LOGGING_AWS_REQUEST_METRIC; }### Answer:
@Test public void testCreateExecutionContextWithAmazonWebServiceRequest() { final AmazonWebServiceRequest awsr = new TestRequest(); final AmazonTestClient client = new AmazonTestClient(); final ExecutionContext ec = client.createExecutionContext(awsr); assertEquals(client.requestHandler2s, ec.getRequestHandler2s()); }
@Test public void testCreateExecutionContextWithRequest() { final AmazonWebServiceRequest awsr = new TestRequest(); final Request<String> req = new DefaultRequest<String>(awsr, "test"); final AmazonTestClient client = new AmazonTestClient(); final ExecutionContext ec = client.createExecutionContext(req); assertEquals(client.requestHandler2s, ec.getRequestHandler2s()); }
|
### Question:
AmazonHttpClient { void setUserAgent(Request<?> request) { String userAgent = ClientConfiguration.DEFAULT_USER_AGENT; final AmazonWebServiceRequest awsreq = request.getOriginalRequest(); if (awsreq != null) { final RequestClientOptions opts = awsreq.getRequestClientOptions(); if (opts != null) { final String userAgentMarker = opts.getClientMarker(Marker.USER_AGENT); if (userAgentMarker != null) { userAgent = createUserAgentString(userAgent, userAgentMarker); } } } if (!ClientConfiguration.DEFAULT_USER_AGENT.equals(config.getUserAgent())) { userAgent = createUserAgentString(userAgent, config.getUserAgent()); } request.addHeader(HEADER_USER_AGENT, userAgent); } AmazonHttpClient(ClientConfiguration config); @Deprecated AmazonHttpClient(ClientConfiguration config,
RequestMetricCollector requestMetricCollector); AmazonHttpClient(ClientConfiguration config, HttpClient httpClient); @Deprecated AmazonHttpClient(ClientConfiguration config, HttpClient httpClient,
RequestMetricCollector requestMetricCollector); @Deprecated ResponseMetadata getResponseMetadataForRequest(AmazonWebServiceRequest request); Response<T> execute(Request<?> request,
HttpResponseHandler<AmazonWebServiceResponse<T>> responseHandler,
HttpResponseHandler<AmazonServiceException> errorResponseHandler,
ExecutionContext executionContext); void shutdown(); RequestMetricCollector getRequestMetricCollector(); }### Answer:
@Test public void testSetUserAgentDefault() { ClientConfiguration config = new ClientConfiguration(); client = new AmazonHttpClient(config); final Request<?> request = new DefaultRequest<String>("ServiceName"); client.setUserAgent(request); String userAgent = request.getHeaders().get("User-Agent"); assertEquals("same user agent", ClientConfiguration.DEFAULT_USER_AGENT, userAgent); }
@Test public void testSetUserAgentCustom() { String versionInfoUserAgent = ClientConfiguration.DEFAULT_USER_AGENT; String customUserAgent = "custom_user_agent"; String requestUserAgent = "request_user_agent"; String targetUserAgent = versionInfoUserAgent + " " + requestUserAgent + " " + customUserAgent; AmazonWebServiceRequest originalRequest = new AmazonWebServiceRequest() { }; RequestClientOptions opts = originalRequest.getRequestClientOptions(); opts.appendUserAgent("request_user_agent"); ClientConfiguration config = new ClientConfiguration(); config.setUserAgent("custom_user_agent"); client = new AmazonHttpClient(config); final Request<?> request = new DefaultRequest<String>(originalRequest, "ServiceName"); client.setUserAgent(request); String userAgent = request.getHeaders().get("User-Agent"); assertEquals("same user agent", targetUserAgent, userAgent); }
|
### Question:
HttpRequestFactory { public HttpRequest createHttpRequest(Request<?> request, ClientConfiguration clientConfiguration, ExecutionContext context) { final URI endpoint = request.getEndpoint(); String uri = HttpUtils.appendUri(endpoint.toString(), request.getResourcePath(), true); final String encodedParams = HttpUtils.encodeParameters(request); HttpMethodName method = request.getHttpMethod(); final boolean requestHasNoPayload = request.getContent() != null; final boolean requestIsPost = method == HttpMethodName.POST; final boolean putParamsInUri = !requestIsPost || requestHasNoPayload; if (encodedParams != null && putParamsInUri) { uri += "?" + encodedParams; } final Map<String, String> headers = new HashMap<String, String>(); configureHeaders(headers, request, context, clientConfiguration); InputStream is = request.getContent(); if (method == HttpMethodName.PATCH) { method = HttpMethodName.POST; headers.put("X-HTTP-Method-Override", HttpMethodName.PATCH.toString()); } if (method == HttpMethodName.POST) { if (request.getContent() == null && encodedParams != null) { final byte[] contentBytes = encodedParams.getBytes(StringUtils.UTF8); is = new ByteArrayInputStream(contentBytes); headers.put("Content-Length", String.valueOf(contentBytes.length)); } } if (clientConfiguration.isEnableGzip() && headers.get("Accept-Encoding") == null) { headers.put("Accept-Encoding", "gzip"); } else { headers.put("Accept-Encoding", "identity"); } final HttpRequest httpRequest = new HttpRequest(method.toString(), URI.create(uri), headers, is); httpRequest.setStreaming(request.isStreaming()); return httpRequest; } HttpRequest createHttpRequest(Request<?> request,
ClientConfiguration clientConfiguration, ExecutionContext context); }### Answer:
@Test public void testContextUserAgent() { final String contextUserAgent = "context_user_agent"; context.setContextUserAgent(contextUserAgent); final HttpRequest httpRequest = factory.createHttpRequest(request, clientConfiguration, context); final String userAgent = httpRequest.getHeaders().get(HttpHeader.USER_AGENT); assertTrue("context user agent", userAgent.endsWith(contextUserAgent)); }
@Test public void testHeaders() { final HttpRequest httpRequest = factory.createHttpRequest(request, clientConfiguration, context); final Map<String, String> headers = httpRequest.getHeaders(); assertNotNull(headers.get(HttpHeader.HOST)); assertNotNull(headers.get(HttpHeader.CONTENT_TYPE)); }
@Test public void testEnableCompression() { clientConfiguration.withEnableGzip(true); final HttpRequest httpRequest = factory.createHttpRequest(request, clientConfiguration, context); final Map<String, String> headers = httpRequest.getHeaders(); assertEquals("accept encoding is gzip", "gzip", headers.get("Accept-Encoding")); }
|
### Question:
ClientConnectionRequestFactory { static ClientConnectionRequest wrap(ClientConnectionRequest orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); return (ClientConnectionRequest) Proxy.newProxyInstance( ClientConnectionRequestFactory.class.getClassLoader(), INTERFACES, new Handler(orig)); } }### Answer:
@Test public void wrapOnce() { ClientConnectionRequest wrapped = ClientConnectionRequestFactory.wrap(noop); assertTrue(wrapped instanceof Wrapped); }
@Test(expected = IllegalArgumentException.class) public void wrapTwice() { ClientConnectionRequest wrapped = ClientConnectionRequestFactory.wrap(noop); ClientConnectionRequestFactory.wrap(wrapped); }
|
### Question:
ClientConnectionManagerFactory { public static ClientConnectionManager wrap(ClientConnectionManager orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); final Class<?>[] interfaces = new Class<?>[] { ClientConnectionManager.class, Wrapped.class }; return (ClientConnectionManager) Proxy.newProxyInstance( ClientConnectionManagerFactory.class.getClassLoader(), interfaces, new Handler(orig)); } static ClientConnectionManager wrap(ClientConnectionManager orig); }### Answer:
@Test public void wrapOnce() { ClientConnectionManager wrapped = ClientConnectionManagerFactory.wrap(noop); assertTrue(wrapped instanceof Wrapped); }
@Test(expected = IllegalArgumentException.class) public void wrapTwice() { ClientConnectionManager wrapped = ClientConnectionManagerFactory.wrap(noop); ClientConnectionManagerFactory.wrap(wrapped); }
|
### Question:
JsonResponseHandler implements HttpResponseHandler<AmazonWebServiceResponse<T>> { @Override public AmazonWebServiceResponse<T> handle(HttpResponse response) throws Exception { log.trace("Parsing service response JSON"); final String crc32Checksum = response.getHeaders().get("x-amz-crc32"); CRC32ChecksumCalculatingInputStream crc32ChecksumInputStream = null; InputStream content = response.getRawContent(); if (content == null) { content = new ByteArrayInputStream("{}".getBytes(StringUtils.UTF8)); } log.debug("CRC32Checksum = " + crc32Checksum); log.debug("content encoding = " + response.getHeaders().get("Content-Encoding")); if (crc32Checksum != null) { crc32ChecksumInputStream = new CRC32ChecksumCalculatingInputStream(content); if ("gzip".equals(response.getHeaders().get("Content-Encoding"))) { content = new GZIPInputStream(crc32ChecksumInputStream); } else { content = crc32ChecksumInputStream; } } final AwsJsonReader jsonReader = JsonUtils.getJsonReader(new InputStreamReader(content, StringUtils.UTF8)); try { final AmazonWebServiceResponse<T> awsResponse = new AmazonWebServiceResponse<T>(); final JsonUnmarshallerContext unmarshallerContext = new JsonUnmarshallerContext(jsonReader, response); final T result = responseUnmarshaller.unmarshall(unmarshallerContext); if (crc32Checksum != null) { final long serverSideCRC = Long.parseLong(crc32Checksum); final long clientSideCRC = crc32ChecksumInputStream.getCRC32Checksum(); if (clientSideCRC != serverSideCRC) { throw new CRC32MismatchException( "Client calculated crc32 checksum didn't match that calculated by server side"); } } awsResponse.setResult(result); final Map<String, String> metadata = new HashMap<String, String>(); metadata.put(ResponseMetadata.AWS_REQUEST_ID, response.getHeaders().get("x-amzn-RequestId")); awsResponse.setResponseMetadata(new ResponseMetadata(metadata)); log.trace("Done parsing service response"); return awsResponse; } finally { if (!needsConnectionLeftOpen) { try { jsonReader.close(); } catch (final IOException e) { log.warn("Error closing json parser", e); } } } } JsonResponseHandler(Unmarshaller<T, JsonUnmarshallerContext> responseUnmarshaller); @Override AmazonWebServiceResponse<T> handle(HttpResponse response); @Override boolean needsConnectionLeftOpen(); @SuppressWarnings({"checkstyle:constantname", "checkstyle:visibilitymodifier"})
public boolean needsConnectionLeftOpen; }### Answer:
@Test public void testHandleWithNoCRC32() throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream( "{\"key\" :\"Content\"}".getBytes(StringUtils.UTF8)); HttpResponse response = new HttpResponse.Builder().statusText("testResponse") .statusCode(200).header("testKey", "testValue").content(bais).build(); Unmarshaller<String, JsonUnmarshallerContext> unmarshaller = new Unmarshaller<String, JsonUnmarshallerContext>() { @Override public String unmarshall(JsonUnmarshallerContext in) throws Exception { in.getReader().beginObject(); in.getReader().nextName(); return in.getReader().nextString(); } }; JsonResponseHandler<String> toTest = new JsonResponseHandler<String>(unmarshaller); AmazonWebServiceResponse<String> awsResponse = toTest.handle(response); assertEquals(awsResponse.getResult(), "Content"); }
@Test public void testHandleWithNullContent() throws Exception { HttpResponse response = new HttpResponse.Builder().statusText("testResponse") .statusCode(200).header("testKey", "testValue").content(null).build(); Unmarshaller<String, JsonUnmarshallerContext> unmarshaller = new Unmarshaller<String, JsonUnmarshallerContext>() { @Override public String unmarshall(JsonUnmarshallerContext in) throws Exception { in.getReader().beginObject(); assertFalse(in.getReader().hasNext()); return "NullContent"; } }; JsonResponseHandler<String> toTest = new JsonResponseHandler<String>(unmarshaller); AmazonWebServiceResponse<String> awsResponse = toTest.handle(response); assertEquals(awsResponse.getResult(), "NullContent"); }
|
### Question:
JsonUtils { @SuppressWarnings("unchecked") public static Map<String, String> jsonToMap(Reader in) { AwsJsonReader reader = getJsonReader(in); try { if (reader.peek() == null) { return Collections.EMPTY_MAP; } Map<String, String> map = new HashMap<String, String>(); reader.beginObject(); while (reader.hasNext()) { String key = reader.nextName(); if (reader.isContainer()) { reader.skipValue(); } else { map.put(key, reader.nextString()); } } reader.endObject(); reader.close(); return Collections.unmodifiableMap(map); } catch (IOException e) { throw new AmazonClientException("Unable to parse JSON String.", e); } } static void setJsonEngine(JsonEngine jsonEngine); static AwsJsonReader getJsonReader(Reader in); static AwsJsonWriter getJsonWriter(Writer out); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(Reader in); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(String json); static String mapToString(Map<String, String> map); }### Answer:
@Test public void testJsonToMap() { Map<String, String> map = JsonUtils.jsonToMap(JSON_STRING); assertEquals("string value", "string", map.get("string")); assertEquals("long value", "123", map.get("long")); assertEquals("double value", "123.45", map.get("double")); assertEquals("null value", null, map.get("null")); assertEquals("true value", "true", map.get("true")); assertEquals("false value", "false", map.get("false")); assertEquals("encoding", "Chloë", map.get("encoding")); assertNull("array is ignored", map.get("array")); assertNull("object is ignored", map.get("object")); }
@Test public void testNullJsonToMap() { String nullStr = null; Map<String, String> map = JsonUtils.jsonToMap(nullStr); assertNotNull("map isn't null", map); assertTrue("map is empty", map.isEmpty()); }
@Test public void testEmptyJsonToMap() { String json = ""; Map<String, String> map = JsonUtils.jsonToMap(json); assertTrue("empty string", map.isEmpty()); }
|
### Question:
JsonUtils { public static String mapToString(Map<String, String> map) { if (map == null || map.isEmpty()) { return "{}"; } try { StringWriter out = new StringWriter(); AwsJsonWriter writer = getJsonWriter(out); writer.beginObject(); for (Map.Entry<String, String> entry : map.entrySet()) { writer.name(entry.getKey()).value(entry.getValue()); } writer.endObject(); writer.close(); return out.toString(); } catch (IOException e) { throw new AmazonClientException("Unable to serialize to JSON String.", e); } } static void setJsonEngine(JsonEngine jsonEngine); static AwsJsonReader getJsonReader(Reader in); static AwsJsonWriter getJsonWriter(Writer out); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(Reader in); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(String json); static String mapToString(Map<String, String> map); }### Answer:
@Test public void testEmptyMapToJson() { Map<String, String> source = new HashMap<String, String>(); assertEquals("empty map", "{}", JsonUtils.mapToString(source)); }
|
### Question:
JsonUtils { public static AwsJsonReader getJsonReader(Reader in) { if (factory == null) { throw new IllegalStateException("Json engine is unavailable."); } return factory.getJsonReader(in); } static void setJsonEngine(JsonEngine jsonEngine); static AwsJsonReader getJsonReader(Reader in); static AwsJsonWriter getJsonWriter(Writer out); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(Reader in); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(String json); static String mapToString(Map<String, String> map); }### Answer:
@Test public void testJsonReader() throws IOException { AwsJsonReader reader = JsonUtils.getJsonReader(new StringReader(JSON_STRING)); reader.beginObject(); assertTrue("has properties", reader.hasNext()); while (reader.hasNext()) { String name = reader.nextName(); if (name.equals("string")) { assertTrue("VALUE_STRING", AwsJsonToken.VALUE_STRING == reader.peek()); assertEquals("string value", "string", reader.nextString()); } else if (name.equals("long")) { assertTrue("VALUE_NUMBER", AwsJsonToken.VALUE_NUMBER == reader.peek()); assertEquals("long value", "123", reader.nextString()); } else if (name.equals("double")) { assertTrue("VALUE_NUMBER", AwsJsonToken.VALUE_NUMBER == reader.peek()); assertEquals("double value", "123.45", reader.nextString()); } else if (name.equals("null")) { assertTrue("VALUE_NULL", AwsJsonToken.VALUE_NULL == reader.peek()); assertNull("null value", reader.nextString()); } else if (name.equals("true")) { assertTrue("VALUE_BOOLEAN", AwsJsonToken.VALUE_BOOLEAN == reader.peek()); assertEquals("true value", "true", reader.nextString()); } else if (name.equals("false")) { assertTrue("VALUE_BOOLEAN", AwsJsonToken.VALUE_BOOLEAN == reader.peek()); assertEquals("false value", "false", reader.nextString()); } else if (name.equals("encoding")) { assertTrue("VALUE_STRING", AwsJsonToken.VALUE_STRING == reader.peek()); assertEquals("encoding", "Chloë", reader.nextString()); } else if (name.equals("array")) { assertTrue("BEGIN_ARRAY", AwsJsonToken.BEGIN_ARRAY == reader.peek()); reader.beginArray(); assertTrue("has next", reader.hasNext()); assertEquals("string value", "string", reader.nextString()); assertEquals("long value", "123", reader.nextString()); assertEquals("double value", "123.45", reader.nextString()); assertNull("null value", reader.nextString()); assertEquals("true value", "true", reader.nextString()); assertEquals("false value", "false", reader.nextString()); reader.endArray(); } else if (name.equals("object")) { assertTrue("BEGIN_OBJECT", AwsJsonToken.BEGIN_OBJECT == reader.peek()); reader.beginObject(); assertFalse("empty object", reader.hasNext()); reader.endObject(); } else { fail("should not reach here"); } } reader.endObject(); }
|
### Question:
JsonUtils { public static AwsJsonWriter getJsonWriter(Writer out) { if (factory == null) { throw new IllegalStateException("Json engine is unavailable."); } return factory.getJsonWriter(out); } static void setJsonEngine(JsonEngine jsonEngine); static AwsJsonReader getJsonReader(Reader in); static AwsJsonWriter getJsonWriter(Writer out); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(Reader in); @SuppressWarnings("unchecked") static Map<String, String> jsonToMap(String json); static String mapToString(Map<String, String> map); }### Answer:
@Test public void testJsonWriter() throws IOException { StringWriter out = new StringWriter(); AwsJsonWriter writer = JsonUtils.getJsonWriter(out); writer.beginObject() .name("string").value("string") .name("long").value(123) .name("double").value(123.45) .name("null").value() .name("true").value(true) .name("false").value(false) .name("encoding").value("Chloë") .name("array").beginArray() .value("string").value(123).value(123.45).value().value(true).value(false) .endArray() .name("object").beginObject().endObject() .endObject().close(); String json = out.toString(); assertEquals("same json", JSON_STRING, json); }
|
### Question:
PeriodicRateGenerator implements RateGenerator { @Override public double getRate(long time) { double valueInPeriod = normalizeValue(time); double result = rateFunction(valueInPeriod); LOGGER.trace("rateFunction returned: {} for value: {}", result, valueInPeriod); return result < 0 ? 0d : result; } PeriodicRateGenerator(long periodInSeconds); @Override double getRate(long time); }### Answer:
@Test public void rate_should_return_1_when_period_is_100_and_time_is_201() { ConcretePeriodicRateGenerator periodicRateGenerator = new ConcretePeriodicRateGenerator(100); double rate = periodicRateGenerator.getRate(TimeUnit.SECONDS.toNanos(201)); Assert.assertEquals(1d, rate, DELTA); }
@Test public void rate_should_return_0_when_period_is_50_and_time_is_150() { ConcretePeriodicRateGenerator periodicRateGenerator = new ConcretePeriodicRateGenerator(50); double rate = periodicRateGenerator.getRate(TimeUnit.SECONDS.toNanos(150)); Assert.assertEquals(0d, rate, DELTA); }
@Test public void rate_should_return_60_when_period_is_10_and_time_is_16() { ConcretePeriodicRateGenerator periodicRateGenerator = new ConcretePeriodicRateGenerator(10); double rate = periodicRateGenerator.getRate(TimeUnit.SECONDS.toNanos(16)); Assert.assertEquals(60d, rate, DELTA); }
@Test public void rate_should_return_99_when_period_is_100_and_time_is_399() { ConcretePeriodicRateGenerator periodicRateGenerator = new ConcretePeriodicRateGenerator(100); double rate = periodicRateGenerator.getRate(TimeUnit.SECONDS.toNanos(399)); Assert.assertEquals(99d, rate, DELTA); }
|
### Question:
LoadGenerator { public void run() { try { checkState(); LOGGER.info("Load generator started."); long beginning = System.nanoTime(); long previous = beginning; infiniteWhile: while (true) { if (terminate.get()) { LOGGER.info("Termination signal detected. Terminating load generator..."); break; } long now = System.nanoTime(); long fromBeginning = now - beginning; long elapsed = now - previous; double rate = rateGenerator.getRate(fromBeginning); long normalizedRate = normalizeRate(elapsed, rate); if (normalizedRate > 0) { previous += calculateConsumedTime(normalizedRate, rate); } for (int i = 0; i < normalizedRate; i++) { if (!dataSource.hasNext(fromBeginning)) { LOGGER.info("Reached end of data source. Terminating load generator..."); terminate.set(true); break infiniteWhile; } T data = dataSource.getNext(fromBeginning); worker.accept(data); } } LOGGER.info("Load generator terminated."); } catch (Exception e) { LOGGER.error("Terminating load generator due to error. Error: ", e); } } LoadGenerator(DataSource<T> dataSource, RateGenerator rateGenerator, Consumer<T> worker); void run(); void terminate(); }### Answer:
@Test(timeout = DEFAULT_TEST_TIMEOUT) public void loadGenerator_should_be_terminated_when_dataSource_has_no_next_element() { LoadGenerator<Integer> loadGenerator = new LoadGenerator<>(new DataSource<Integer>() { @Override public boolean hasNext(long time) { return false; } @Override public Integer getNext(long time) { return 123; } }, new ConstantRateGenerator(1000), (x) -> { }); loadGenerator.run(); }
|
### Question:
LinkedEvictingBlockingQueue { public T take() throws InterruptedException { final ReentrantLock lock = this.lock; lock.lock(); try { T x; while ((x = unlinkFromHead()) == null) notEmpty.await(); return x; } finally { lock.unlock(); } } LinkedEvictingBlockingQueue(); LinkedEvictingBlockingQueue(boolean dropFromHead); LinkedEvictingBlockingQueue(boolean dropFromHead, int capacity); T put(T e); T take(); int size(); }### Answer:
@Test(timeout = 2000) public void should_not_take_value_from_queue_when_value_is_not_put() throws InterruptedException { LinkedEvictingBlockingQueue<Integer> queue = new LinkedEvictingBlockingQueue<>(); Thread takeFromQueueThread = newStartedThread(() -> { try { queue.take(); } catch (InterruptedException e) { } }); Thread.sleep(1000); Assert.assertTrue(takeFromQueueThread.isAlive()); takeFromQueueThread.interrupt(); }
|
### Question:
Balance { public Balance exchangeId(String exchangeId) { this.exchangeId = exchangeId; return this; } Balance exchangeId(String exchangeId); @javax.annotation.Nullable @ApiModelProperty(example = "KRAKEN", value = "Exchange identifier used to identify the routing destination.") String getExchangeId(); void setExchangeId(String exchangeId); Balance data(List<BalanceData> data); Balance addDataItem(BalanceData dataItem); @javax.annotation.Nullable @ApiModelProperty(value = "") List<BalanceData> getData(); void setData(List<BalanceData> data); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_DATA; }### Answer:
@Test public void exchangeIdTest() { }
|
### Question:
ValidationError { public ValidationError errors(String errors) { this.errors = errors; return this; } ValidationError type(String type); @javax.annotation.Nullable @ApiModelProperty(example = "https://tools.ietf.org/html/rfc7231#section-6.5.1", value = "") String getType(); void setType(String type); ValidationError title(String title); @javax.annotation.Nullable @ApiModelProperty(example = "One or more validation errors occurred.", value = "") String getTitle(); void setTitle(String title); ValidationError status(BigDecimal status); @javax.annotation.Nullable @ApiModelProperty(example = "400", value = "") BigDecimal getStatus(); void setStatus(BigDecimal status); ValidationError traceId(String traceId); @javax.annotation.Nullable @ApiModelProperty(example = "d200e8b5-4271a5461ce5342f", value = "") String getTraceId(); void setTraceId(String traceId); ValidationError errors(String errors); @javax.annotation.Nullable @ApiModelProperty(value = "") String getErrors(); void setErrors(String errors); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TYPE; static final String SERIALIZED_NAME_TITLE; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_TRACE_ID; static final String SERIALIZED_NAME_ERRORS; }### Answer:
@Test public void errorsTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange) { this.clientOrderIdFormatExchange = clientOrderIdFormatExchange; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void clientOrderIdFormatExchangeTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId) { this.exchangeOrderId = exchangeOrderId; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void exchangeOrderIdTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen) { this.amountOpen = amountOpen; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void amountOpenTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled) { this.amountFilled = amountFilled; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void amountFilledTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf avgPx(BigDecimal avgPx) { this.avgPx = avgPx; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void avgPxTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf status(OrdStatus status) { this.status = status; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void statusTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory) { this.statusHistory = statusHistory; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void statusHistoryTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf errorMessage(String errorMessage) { this.errorMessage = errorMessage; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void errorMessageTest() { }
|
### Question:
OrderExecutionReportAllOf { public OrderExecutionReportAllOf fills(List<Fills> fills) { this.fills = fills; return this; } OrderExecutionReportAllOf clientOrderIdFormatExchange(String clientOrderIdFormatExchange); @ApiModelProperty(example = "f81211e2-27c4-b86a-8143-01088ba9222c", required = true, value = "The unique identifier of the order assigned by the client converted to the exchange order tag format for the purpose of tracking it.") String getClientOrderIdFormatExchange(); void setClientOrderIdFormatExchange(String clientOrderIdFormatExchange); OrderExecutionReportAllOf exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderExecutionReportAllOf amountOpen(BigDecimal amountOpen); @ApiModelProperty(example = "0.22", required = true, value = "Quantity open for further execution. `amount_open` = `amount_order` - `amount_filled`") BigDecimal getAmountOpen(); void setAmountOpen(BigDecimal amountOpen); OrderExecutionReportAllOf amountFilled(BigDecimal amountFilled); @ApiModelProperty(example = "0.0", required = true, value = "Total quantity filled.") BigDecimal getAmountFilled(); void setAmountFilled(BigDecimal amountFilled); OrderExecutionReportAllOf avgPx(BigDecimal avgPx); @javax.annotation.Nullable @ApiModelProperty(example = "0.0783", value = "Calculated average price of all fills on this order.") BigDecimal getAvgPx(); void setAvgPx(BigDecimal avgPx); OrderExecutionReportAllOf status(OrdStatus status); @ApiModelProperty(required = true, value = "") OrdStatus getStatus(); void setStatus(OrdStatus status); OrderExecutionReportAllOf statusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf addStatusHistoryItem(List<String> statusHistoryItem); @javax.annotation.Nullable @ApiModelProperty(value = "Timestamped history of order status changes.") List<List<String>> getStatusHistory(); void setStatusHistory(List<List<String>> statusHistory); OrderExecutionReportAllOf errorMessage(String errorMessage); @javax.annotation.Nullable @ApiModelProperty(example = "{\"result\":\"error\",\"reason\":\"InsufficientFunds\",\"message\":\"Failed to place buy order on symbol 'BTCUSD' for price $7,000.00 and quantity 0.22 BTC due to insufficient funds\"}", value = "Error message.") String getErrorMessage(); void setErrorMessage(String errorMessage); OrderExecutionReportAllOf fills(List<Fills> fills); OrderExecutionReportAllOf addFillsItem(Fills fillsItem); @javax.annotation.Nullable @ApiModelProperty(value = "Relay fill information on working orders.") List<Fills> getFills(); void setFills(List<Fills> fills); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_CLIENT_ORDER_ID_FORMAT_EXCHANGE; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_AMOUNT_OPEN; static final String SERIALIZED_NAME_AMOUNT_FILLED; static final String SERIALIZED_NAME_AVG_PX; static final String SERIALIZED_NAME_STATUS; static final String SERIALIZED_NAME_STATUS_HISTORY; static final String SERIALIZED_NAME_ERROR_MESSAGE; static final String SERIALIZED_NAME_FILLS; }### Answer:
@Test public void fillsTest() { }
|
### Question:
Balance { public Balance data(List<BalanceData> data) { this.data = data; return this; } Balance exchangeId(String exchangeId); @javax.annotation.Nullable @ApiModelProperty(example = "KRAKEN", value = "Exchange identifier used to identify the routing destination.") String getExchangeId(); void setExchangeId(String exchangeId); Balance data(List<BalanceData> data); Balance addDataItem(BalanceData dataItem); @javax.annotation.Nullable @ApiModelProperty(value = "") List<BalanceData> getData(); void setData(List<BalanceData> data); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_DATA; }### Answer:
@Test public void dataTest() { }
|
### Question:
OrderCancelAllRequest { public OrderCancelAllRequest exchangeId(String exchangeId) { this.exchangeId = exchangeId; return this; } OrderCancelAllRequest exchangeId(String exchangeId); @ApiModelProperty(example = "KRAKEN", required = true, value = "Identifier of the exchange from which active orders should be canceled.") String getExchangeId(); void setExchangeId(String exchangeId); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_EXCHANGE_ID; }### Answer:
@Test public void exchangeIdTest() { }
|
### Question:
Fills { public Fills time(LocalDate time) { this.time = time; return this; } Fills time(LocalDate time); @javax.annotation.Nullable @ApiModelProperty(example = "2020-01-01T10:45:20.1677709Z", value = "Execution time.") LocalDate getTime(); void setTime(LocalDate time); Fills price(BigDecimal price); @javax.annotation.Nullable @ApiModelProperty(example = "10799.2", value = "Execution price.") BigDecimal getPrice(); void setPrice(BigDecimal price); Fills amount(BigDecimal amount); @javax.annotation.Nullable @ApiModelProperty(example = "0.002", value = "Executed quantity.") BigDecimal getAmount(); void setAmount(BigDecimal amount); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TIME; static final String SERIALIZED_NAME_PRICE; static final String SERIALIZED_NAME_AMOUNT; }### Answer:
@Test public void timeTest() { }
|
### Question:
Fills { public Fills price(BigDecimal price) { this.price = price; return this; } Fills time(LocalDate time); @javax.annotation.Nullable @ApiModelProperty(example = "2020-01-01T10:45:20.1677709Z", value = "Execution time.") LocalDate getTime(); void setTime(LocalDate time); Fills price(BigDecimal price); @javax.annotation.Nullable @ApiModelProperty(example = "10799.2", value = "Execution price.") BigDecimal getPrice(); void setPrice(BigDecimal price); Fills amount(BigDecimal amount); @javax.annotation.Nullable @ApiModelProperty(example = "0.002", value = "Executed quantity.") BigDecimal getAmount(); void setAmount(BigDecimal amount); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TIME; static final String SERIALIZED_NAME_PRICE; static final String SERIALIZED_NAME_AMOUNT; }### Answer:
@Test public void priceTest() { }
|
### Question:
Fills { public Fills amount(BigDecimal amount) { this.amount = amount; return this; } Fills time(LocalDate time); @javax.annotation.Nullable @ApiModelProperty(example = "2020-01-01T10:45:20.1677709Z", value = "Execution time.") LocalDate getTime(); void setTime(LocalDate time); Fills price(BigDecimal price); @javax.annotation.Nullable @ApiModelProperty(example = "10799.2", value = "Execution price.") BigDecimal getPrice(); void setPrice(BigDecimal price); Fills amount(BigDecimal amount); @javax.annotation.Nullable @ApiModelProperty(example = "0.002", value = "Executed quantity.") BigDecimal getAmount(); void setAmount(BigDecimal amount); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TIME; static final String SERIALIZED_NAME_PRICE; static final String SERIALIZED_NAME_AMOUNT; }### Answer:
@Test public void amountTest() { }
|
### Question:
OrderCancelSingleRequest { public OrderCancelSingleRequest exchangeId(String exchangeId) { this.exchangeId = exchangeId; return this; } OrderCancelSingleRequest exchangeId(String exchangeId); @ApiModelProperty(example = "KRAKEN", required = true, value = "Exchange identifier used to identify the routing destination.") String getExchangeId(); void setExchangeId(String exchangeId); OrderCancelSingleRequest exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system. One of the properties (`exchange_order_id`, `client_order_id`) is required to identify the new order.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderCancelSingleRequest clientOrderId(String clientOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "6ab36bc1-344d-432e-ac6d-0bf44ee64c2b", value = "The unique identifier of the order assigned by the client. One of the properties (`exchange_order_id`, `client_order_id`) is required to identify the new order.") String getClientOrderId(); void setClientOrderId(String clientOrderId); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_CLIENT_ORDER_ID; }### Answer:
@Test public void exchangeIdTest() { }
|
### Question:
OrderCancelSingleRequest { public OrderCancelSingleRequest exchangeOrderId(String exchangeOrderId) { this.exchangeOrderId = exchangeOrderId; return this; } OrderCancelSingleRequest exchangeId(String exchangeId); @ApiModelProperty(example = "KRAKEN", required = true, value = "Exchange identifier used to identify the routing destination.") String getExchangeId(); void setExchangeId(String exchangeId); OrderCancelSingleRequest exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system. One of the properties (`exchange_order_id`, `client_order_id`) is required to identify the new order.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderCancelSingleRequest clientOrderId(String clientOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "6ab36bc1-344d-432e-ac6d-0bf44ee64c2b", value = "The unique identifier of the order assigned by the client. One of the properties (`exchange_order_id`, `client_order_id`) is required to identify the new order.") String getClientOrderId(); void setClientOrderId(String clientOrderId); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_CLIENT_ORDER_ID; }### Answer:
@Test public void exchangeOrderIdTest() { }
|
### Question:
BalanceData { public BalanceData assetIdExchange(String assetIdExchange) { this.assetIdExchange = assetIdExchange; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void assetIdExchangeTest() { }
|
### Question:
BalanceData { public BalanceData assetIdCoinapi(String assetIdCoinapi) { this.assetIdCoinapi = assetIdCoinapi; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void assetIdCoinapiTest() { }
|
### Question:
BalanceData { public BalanceData balance(Float balance) { this.balance = balance; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void balanceTest() { }
|
### Question:
BalanceData { public BalanceData available(Float available) { this.available = available; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void availableTest() { }
|
### Question:
BalanceData { public BalanceData locked(Float locked) { this.locked = locked; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void lockedTest() { }
|
### Question:
BalanceData { public BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy) { this.lastUpdatedBy = lastUpdatedBy; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void lastUpdatedByTest() { }
|
### Question:
OrderCancelSingleRequest { public OrderCancelSingleRequest clientOrderId(String clientOrderId) { this.clientOrderId = clientOrderId; return this; } OrderCancelSingleRequest exchangeId(String exchangeId); @ApiModelProperty(example = "KRAKEN", required = true, value = "Exchange identifier used to identify the routing destination.") String getExchangeId(); void setExchangeId(String exchangeId); OrderCancelSingleRequest exchangeOrderId(String exchangeOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "3456456754", value = "Unique identifier of the order assigned by the exchange or executing system. One of the properties (`exchange_order_id`, `client_order_id`) is required to identify the new order.") String getExchangeOrderId(); void setExchangeOrderId(String exchangeOrderId); OrderCancelSingleRequest clientOrderId(String clientOrderId); @javax.annotation.Nullable @ApiModelProperty(example = "6ab36bc1-344d-432e-ac6d-0bf44ee64c2b", value = "The unique identifier of the order assigned by the client. One of the properties (`exchange_order_id`, `client_order_id`) is required to identify the new order.") String getClientOrderId(); void setClientOrderId(String clientOrderId); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_EXCHANGE_ORDER_ID; static final String SERIALIZED_NAME_CLIENT_ORDER_ID; }### Answer:
@Test public void clientOrderIdTest() { }
|
### Question:
BalanceData { public BalanceData rateUsd(Float rateUsd) { this.rateUsd = rateUsd; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void rateUsdTest() { }
|
### Question:
BalanceData { public BalanceData traded(Float traded) { this.traded = traded; return this; } BalanceData assetIdExchange(String assetIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBT", value = "Exchange currency code.") String getAssetIdExchange(); void setAssetIdExchange(String assetIdExchange); BalanceData assetIdCoinapi(String assetIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BTC", value = "CoinAPI currency code.") String getAssetIdCoinapi(); void setAssetIdCoinapi(String assetIdCoinapi); BalanceData balance(Float balance); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current total currency balance on the exchange.") Float getBalance(); void setBalance(Float balance); BalanceData available(Float available); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Value of the current available currency balance on the exchange that can be used as collateral.") Float getAvailable(); void setAvailable(Float available); BalanceData locked(Float locked); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Value of the current locked currency balance by the exchange.") Float getLocked(); void setLocked(Float locked); BalanceData lastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); @javax.annotation.Nullable @ApiModelProperty(example = "EXCHANGE", value = "Source of the last modification. ") LastUpdatedByEnum getLastUpdatedBy(); void setLastUpdatedBy(LastUpdatedByEnum lastUpdatedBy); BalanceData rateUsd(Float rateUsd); @javax.annotation.Nullable @ApiModelProperty(example = "1355.12", value = "Current exchange rate to the USD for the single unit of the currency. ") Float getRateUsd(); void setRateUsd(Float rateUsd); BalanceData traded(Float traded); @javax.annotation.Nullable @ApiModelProperty(example = "0.007", value = "Value of the current total traded.") Float getTraded(); void setTraded(Float traded); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_ASSET_ID_EXCHANGE; static final String SERIALIZED_NAME_ASSET_ID_COINAPI; static final String SERIALIZED_NAME_BALANCE; static final String SERIALIZED_NAME_AVAILABLE; static final String SERIALIZED_NAME_LOCKED; static final String SERIALIZED_NAME_LAST_UPDATED_BY; static final String SERIALIZED_NAME_RATE_USD; static final String SERIALIZED_NAME_TRADED; }### Answer:
@Test public void tradedTest() { }
|
### Question:
Message { public Message message(String message) { this.message = message; return this; } Message type(String type); @javax.annotation.Nullable @ApiModelProperty(example = "message", value = "Type of message.") String getType(); void setType(String type); Message severity(Severity severity); @javax.annotation.Nullable @ApiModelProperty(value = "") Severity getSeverity(); void setSeverity(Severity severity); Message exchangeId(String exchangeId); @javax.annotation.Nullable @ApiModelProperty(example = "KRAKEN", value = "If the message related to exchange, then the identifier of the exchange will be provided.") String getExchangeId(); void setExchangeId(String exchangeId); Message message(String message); @javax.annotation.Nullable @ApiModelProperty(example = "Ok", value = "Message text.") String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TYPE; static final String SERIALIZED_NAME_SEVERITY; static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_MESSAGE; }### Answer:
@Test public void testMessage() { }
@Test public void messageTest() { }
|
### Question:
Message { public Message type(String type) { this.type = type; return this; } Message type(String type); @javax.annotation.Nullable @ApiModelProperty(example = "message", value = "Type of message.") String getType(); void setType(String type); Message severity(Severity severity); @javax.annotation.Nullable @ApiModelProperty(value = "") Severity getSeverity(); void setSeverity(Severity severity); Message exchangeId(String exchangeId); @javax.annotation.Nullable @ApiModelProperty(example = "KRAKEN", value = "If the message related to exchange, then the identifier of the exchange will be provided.") String getExchangeId(); void setExchangeId(String exchangeId); Message message(String message); @javax.annotation.Nullable @ApiModelProperty(example = "Ok", value = "Message text.") String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TYPE; static final String SERIALIZED_NAME_SEVERITY; static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_MESSAGE; }### Answer:
@Test public void typeTest() { }
|
### Question:
Message { public Message severity(Severity severity) { this.severity = severity; return this; } Message type(String type); @javax.annotation.Nullable @ApiModelProperty(example = "message", value = "Type of message.") String getType(); void setType(String type); Message severity(Severity severity); @javax.annotation.Nullable @ApiModelProperty(value = "") Severity getSeverity(); void setSeverity(Severity severity); Message exchangeId(String exchangeId); @javax.annotation.Nullable @ApiModelProperty(example = "KRAKEN", value = "If the message related to exchange, then the identifier of the exchange will be provided.") String getExchangeId(); void setExchangeId(String exchangeId); Message message(String message); @javax.annotation.Nullable @ApiModelProperty(example = "Ok", value = "Message text.") String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TYPE; static final String SERIALIZED_NAME_SEVERITY; static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_MESSAGE; }### Answer:
@Test public void severityTest() { }
|
### Question:
Message { public Message exchangeId(String exchangeId) { this.exchangeId = exchangeId; return this; } Message type(String type); @javax.annotation.Nullable @ApiModelProperty(example = "message", value = "Type of message.") String getType(); void setType(String type); Message severity(Severity severity); @javax.annotation.Nullable @ApiModelProperty(value = "") Severity getSeverity(); void setSeverity(Severity severity); Message exchangeId(String exchangeId); @javax.annotation.Nullable @ApiModelProperty(example = "KRAKEN", value = "If the message related to exchange, then the identifier of the exchange will be provided.") String getExchangeId(); void setExchangeId(String exchangeId); Message message(String message); @javax.annotation.Nullable @ApiModelProperty(example = "Ok", value = "Message text.") String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_TYPE; static final String SERIALIZED_NAME_SEVERITY; static final String SERIALIZED_NAME_EXCHANGE_ID; static final String SERIALIZED_NAME_MESSAGE; }### Answer:
@Test public void exchangeIdTest() { }
|
### Question:
PositionData { public PositionData symbolIdExchange(String symbolIdExchange) { this.symbolIdExchange = symbolIdExchange; return this; } PositionData symbolIdExchange(String symbolIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBTUSD", value = "Exchange symbol.") String getSymbolIdExchange(); void setSymbolIdExchange(String symbolIdExchange); PositionData symbolIdCoinapi(String symbolIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BITMEX_PERP_BTC_USD", value = "CoinAPI symbol.") String getSymbolIdCoinapi(); void setSymbolIdCoinapi(String symbolIdCoinapi); PositionData avgEntryPrice(BigDecimal avgEntryPrice); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Calculated average price of all fills on this position.") BigDecimal getAvgEntryPrice(); void setAvgEntryPrice(BigDecimal avgEntryPrice); PositionData quantity(BigDecimal quantity); @javax.annotation.Nullable @ApiModelProperty(example = "7", value = "The current position quantity.") BigDecimal getQuantity(); void setQuantity(BigDecimal quantity); PositionData side(OrdSide side); @javax.annotation.Nullable @ApiModelProperty(value = "") OrdSide getSide(); void setSide(OrdSide side); PositionData unrealizedPnl(BigDecimal unrealizedPnl); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Unrealised profit or loss (PNL) of this position.") BigDecimal getUnrealizedPnl(); void setUnrealizedPnl(BigDecimal unrealizedPnl); PositionData leverage(BigDecimal leverage); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Leverage for this position reported by the exchange.") BigDecimal getLeverage(); void setLeverage(BigDecimal leverage); PositionData crossMargin(Boolean crossMargin); @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "Is cross margin mode enable for this position?") Boolean getCrossMargin(); void setCrossMargin(Boolean crossMargin); PositionData liquidationPrice(BigDecimal liquidationPrice); @javax.annotation.Nullable @ApiModelProperty(example = "0.072323", value = "Liquidation price. If mark price will reach this value, the position will be liquidated.") BigDecimal getLiquidationPrice(); void setLiquidationPrice(BigDecimal liquidationPrice); PositionData rawData(Object rawData); @javax.annotation.Nullable @ApiModelProperty(example = "Other information provided by the exchange on this position.", value = "") Object getRawData(); void setRawData(Object rawData); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_SYMBOL_ID_EXCHANGE; static final String SERIALIZED_NAME_SYMBOL_ID_COINAPI; static final String SERIALIZED_NAME_AVG_ENTRY_PRICE; static final String SERIALIZED_NAME_QUANTITY; static final String SERIALIZED_NAME_SIDE; static final String SERIALIZED_NAME_UNREALIZED_PNL; static final String SERIALIZED_NAME_LEVERAGE; static final String SERIALIZED_NAME_CROSS_MARGIN; static final String SERIALIZED_NAME_LIQUIDATION_PRICE; static final String SERIALIZED_NAME_RAW_DATA; }### Answer:
@Test public void symbolIdExchangeTest() { }
|
### Question:
PositionData { public PositionData symbolIdCoinapi(String symbolIdCoinapi) { this.symbolIdCoinapi = symbolIdCoinapi; return this; } PositionData symbolIdExchange(String symbolIdExchange); @javax.annotation.Nullable @ApiModelProperty(example = "XBTUSD", value = "Exchange symbol.") String getSymbolIdExchange(); void setSymbolIdExchange(String symbolIdExchange); PositionData symbolIdCoinapi(String symbolIdCoinapi); @javax.annotation.Nullable @ApiModelProperty(example = "BITMEX_PERP_BTC_USD", value = "CoinAPI symbol.") String getSymbolIdCoinapi(); void setSymbolIdCoinapi(String symbolIdCoinapi); PositionData avgEntryPrice(BigDecimal avgEntryPrice); @javax.annotation.Nullable @ApiModelProperty(example = "0.00134444", value = "Calculated average price of all fills on this position.") BigDecimal getAvgEntryPrice(); void setAvgEntryPrice(BigDecimal avgEntryPrice); PositionData quantity(BigDecimal quantity); @javax.annotation.Nullable @ApiModelProperty(example = "7", value = "The current position quantity.") BigDecimal getQuantity(); void setQuantity(BigDecimal quantity); PositionData side(OrdSide side); @javax.annotation.Nullable @ApiModelProperty(value = "") OrdSide getSide(); void setSide(OrdSide side); PositionData unrealizedPnl(BigDecimal unrealizedPnl); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Unrealised profit or loss (PNL) of this position.") BigDecimal getUnrealizedPnl(); void setUnrealizedPnl(BigDecimal unrealizedPnl); PositionData leverage(BigDecimal leverage); @javax.annotation.Nullable @ApiModelProperty(example = "0.0", value = "Leverage for this position reported by the exchange.") BigDecimal getLeverage(); void setLeverage(BigDecimal leverage); PositionData crossMargin(Boolean crossMargin); @javax.annotation.Nullable @ApiModelProperty(example = "true", value = "Is cross margin mode enable for this position?") Boolean getCrossMargin(); void setCrossMargin(Boolean crossMargin); PositionData liquidationPrice(BigDecimal liquidationPrice); @javax.annotation.Nullable @ApiModelProperty(example = "0.072323", value = "Liquidation price. If mark price will reach this value, the position will be liquidated.") BigDecimal getLiquidationPrice(); void setLiquidationPrice(BigDecimal liquidationPrice); PositionData rawData(Object rawData); @javax.annotation.Nullable @ApiModelProperty(example = "Other information provided by the exchange on this position.", value = "") Object getRawData(); void setRawData(Object rawData); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String SERIALIZED_NAME_SYMBOL_ID_EXCHANGE; static final String SERIALIZED_NAME_SYMBOL_ID_COINAPI; static final String SERIALIZED_NAME_AVG_ENTRY_PRICE; static final String SERIALIZED_NAME_QUANTITY; static final String SERIALIZED_NAME_SIDE; static final String SERIALIZED_NAME_UNREALIZED_PNL; static final String SERIALIZED_NAME_LEVERAGE; static final String SERIALIZED_NAME_CROSS_MARGIN; static final String SERIALIZED_NAME_LIQUIDATION_PRICE; static final String SERIALIZED_NAME_RAW_DATA; }### Answer:
@Test public void symbolIdCoinapiTest() { }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.