Search in sources :

Example 6 with LoaderListener

use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.

the class LoadDataInformationBuilderTest method shouldReturnsErrorWhenPropertiesWasNotInformed.

@Test(expectedExceptions = IllegalStateException.class)
public void shouldReturnsErrorWhenPropertiesWasNotInformed() throws URISyntaxException {
    String resourceId = "resourceId";
    UpdatePolicy updatePolicy = UpdatePolicy.LAZY;
    LoaderListener loaderListener = new LoaderListener() {

        @Override
        public void newDataLoaded(String resourceId, InputStream is) {
        }
    };
    URI[] resourceLocations = new URI[] { new URI("localhost") };
    new LoadDataInformationBuilder().withResourceId(resourceId).withUpdatePolicy(updatePolicy).withLoaderListener(loaderListener).withResourceLocations(resourceLocations).build();
}
Also used : LoaderListener(org.javamoney.moneta.spi.LoaderService.LoaderListener) UpdatePolicy(org.javamoney.moneta.spi.LoaderService.UpdatePolicy) InputStream(java.io.InputStream) URI(java.net.URI) Test(org.testng.annotations.Test)

Example 7 with LoaderListener

use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.

the class LoadDataInformationBuilderTest method shouldReturnsErrorWhenUpdatePolicyWasNotInformed.

@Test(expectedExceptions = IllegalStateException.class)
public void shouldReturnsErrorWhenUpdatePolicyWasNotInformed() throws URISyntaxException {
    String resourceId = "resourceId";
    Map<String, String> properties = new HashMap<>();
    LoaderListener loaderListener = new LoaderListener() {

        @Override
        public void newDataLoaded(String resourceId, InputStream is) {
        }
    };
    URI[] resourceLocations = new URI[] { new URI("localhost") };
    new LoadDataInformationBuilder().withResourceId(resourceId).withProperties(properties).withLoaderListener(loaderListener).withResourceLocations(resourceLocations).build();
}
Also used : LoaderListener(org.javamoney.moneta.spi.LoaderService.LoaderListener) HashMap(java.util.HashMap) InputStream(java.io.InputStream) URI(java.net.URI) Test(org.testng.annotations.Test)

Aggregations

InputStream (java.io.InputStream)7 LoaderListener (org.javamoney.moneta.spi.LoaderService.LoaderListener)7 URI (java.net.URI)6 HashMap (java.util.HashMap)6 UpdatePolicy (org.javamoney.moneta.spi.LoaderService.UpdatePolicy)6 Test (org.testng.annotations.Test)6 LoadDataInformationBuilder (org.javamoney.moneta.spi.LoadDataInformationBuilder)1 BeforeMethod (org.testng.annotations.BeforeMethod)1