ServiceProvider.setCurrent
Code IndexAdd Codota to your IDE (free)

Best code snippets using javax.measure.spi.ServiceProvider.setCurrent(Showing top 2 results out of 315)

origin: unitsofmeasurement/unit-api

@Test(expected = NullPointerException.class)
public void testSetDefault_Null() {
 ServiceProvider.setCurrent(null);
}
origin: unitsofmeasurement/unit-api

/**
 * Tests {@link ServiceProvider#current()} and {@link ServiceProvider#setCurrent(ServiceProvider)}. The getter and setter are tested in a single
 * method for avoiding issues with the order in which JUnit executes tests.
 */
@Test
public void testGetAndSetDefault() {
 assertEquals(0, ServiceProvider.available().size());
 try {
  ServiceProvider.current();
  fail("Expected no ServiceProvider before we set one.");
 } catch (IllegalStateException e) {
  // This is the expected exception.
 }
 TestServiceProvider testProv = new TestServiceProvider();
 assertNull("Expected no ServiceProvider before we set one.", ServiceProvider.setCurrent(testProv));
 assertSame("Setting the same ServiceProvider twice should be a no-op.", testProv, ServiceProvider.setCurrent(testProv));
 assertSame(testProv, ServiceProvider.current());
 assertArrayEquals(new ServiceProvider[] { testProv }, ServiceProvider.available().toArray());
}
javax.measure.spiServiceProvidersetCurrent

Javadoc

Replaces the current ServiceProvider.

Popular methods of ServiceProvider

  • getPriority
    This method allows to define a priority for a registered ServiceProvider instance. When multiple pro
  • current
    Returns the current ServiceProvider. If necessary the ServiceProvider will be lazily loaded. If ther
  • available
    Returns the list of available service providers.
  • getProviders
    Gets all ServiceProvider. This method loads the provider when first needed.
  • getSystemOfUnitsService
    Returns the service to obtain a SystemOfUnits, or null if none.

Popular classes and methods

  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • setContentView (Activity)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URL (java.net)
    Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)