FacebookAPIMonitor { void methodCalled(String facebookUrl, long elapsedTime, boolean success) { try { URL url = new URL(facebookUrl); String method = url.getPath(); STATISTICS.methodCalled(method, elapsedTime, success); } catch (MalformedURLException ignore) {} } private  FacebookAPIMonitor(); static FacebookAPIMonitor getInstance(); APIStatisticsMBean getStatistics();  }
@Test public void methodCalled_get() throws Exception { final String path = "/me/posts?access_token=access_token"; apiMonitor.methodCalled(BASE_URL + path, 1000l, true); checkMethodStats("/me/posts"); }
@Test public void methodCalled_reading() throws Exception { final String path = "/me/posts?limit=10&access_token=access_token"; apiMonitor.methodCalled(BASE_URL + path, 1000l, true); checkMethodStats("/me/posts"); }
@Test public void methodCalled_fql() throws Exception { final String path = "/fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()&access_token=access_token"; apiMonitor.methodCalled(BASE_URL + path, 1000l, true); checkMethodStats("/fql"); }
@Test public void methodCalled_search() throws Exception { final String path = "/search?q=watermelon&access_token=access_token&type=post"; apiMonitor.methodCalled(BASE_URL + path, 1000l, true); checkMethodStats("/search"); }