UDPLoggingService extends ServiceImpl implements CrashReportingService, LoggingService { @Override public void enable(String url) { this.url = url; if(url.contains(":") && url.split(":").length == 2) { host = url.split(":")[0]; try { port = Integer.parseInt(url.split(":")[1]); } catch (NumberFormatException nfe) { utils.logIssue("Could not get port number from url [" + url + "]", nfe); } } } UDPLoggingService(Context context); @Override void enable(String url); @Override boolean isEnabled(); void logEvent(StoredException storedException, Callback<Object> callback); void logEvent(String log);  }
@Test public void testEnable() { UDPLoggingService udpLoggingService = new UDPLoggingService(null) { @Override public ServiceType getServiceType() { return null; } }; udpLoggingService.utils = UnitTestUtils.mockUtils(); assertFalse(udpLoggingService.isEnabled()); udpLoggingService.enable("unittest:8080"); assertTrue(udpLoggingService.isEnabled()); }