diff --git a/cache-tests/pom.xml b/cache-tests/pom.xml index c5dfae3..227d7ec 100644 --- a/cache-tests/pom.xml +++ b/cache-tests/pom.xml @@ -38,7 +38,7 @@ javax.cache test-domain - ${project.parent.version} + 1.1.0-SNAPSHOT diff --git a/cache-tests/src/test/java/javax/cache/configuration/ConfigurationTest.java b/cache-tests/src/test/java/javax/cache/configuration/ConfigurationTest.java index ed1f9f9..7fc0be9 100644 --- a/cache-tests/src/test/java/javax/cache/configuration/ConfigurationTest.java +++ b/cache-tests/src/test/java/javax/cache/configuration/ConfigurationTest.java @@ -81,6 +81,54 @@ public void testValidateFromBasicConfigurationRetrievedFromCache() { } + /** + * Tests use of default constructor and generics. + * + * @throws IllegalAccessException + * @throws InstantiationException + */ + @Test + public void testDefaultConstructor() throws IllegalAccessException, InstantiationException { + try { + MutableConfiguration configuration = new MutableConfiguration(); + + assertEquals(Object.class, configuration.getKeyType()); + assertEquals(Object.class, configuration.getValueType()); + + Class keyType = configuration.getKeyType(); + String s = keyType.newInstance(); + } catch (ClassCastException e) { + //expected + } + } + + /** + * Tests use of default constructor and generics, this time setting the desired type + * + * @throws IllegalAccessException + * @throws InstantiationException + */ + @Test + public void testDefaultConstructorWithSetTypes() throws IllegalAccessException, InstantiationException { + MutableConfiguration configuration = new MutableConfiguration().setTypes(String.class, String.class); + Class keyType = configuration.getKeyType(); + String s = keyType.newInstance(); + //no exception. This sets the types. + } + + /** + * Tests use of default constructor and generics, this time setting the desired type using the constructor + * + * @throws IllegalAccessException + * @throws InstantiationException + */ + @Test + public void testDefaultConstructorWithTypeConstructor() throws IllegalAccessException, InstantiationException { + MutableConfiguration configuration = new MutableConfiguration(String.class, String.class); + Class keyType = configuration.getKeyType(); + String s = keyType.newInstance(); + //no exception. This sets the types. + } /** * Ensure a cache's config isn't changed by its configuration object after construction. diff --git a/pom.xml b/pom.xml index 8d10367..933bbf4 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ - 1.0.0 + 1.1.0-SNAPSHOT UTF-8 UTF-8