Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into stringtointmapper_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbagu committed Jun 9, 2017
2 parents 3a3f103 + 006eb8c commit c532376
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
Expand Up @@ -14,15 +14,7 @@ class IdentifiableExtension {
static Object propertyMissing(Identifiable self, String name) {
// first check if an extension exist then a property
Identifiable.Extension extension = self.getExtensionByName(name)
if (extension != null) {
extension
} else {
Object value = self.properties[name]
if (value == null) {
throw new RuntimeException("Property '" + name + "' of '" + self.id + "' not found")
}
value
}
extension != null ? extension : self.properties[name]
}

static void propertyMissing(Identifiable self, String name, Object value) {
Expand Down
Expand Up @@ -45,23 +45,15 @@ class IdentifiableExtensionTest {
@Test
void testProperty() {
assertFalse(s.hasProperty())
try {
s.greeting
fail()
} catch (Exception ignored) {
}
assertNull(s.greeting)
s.greeting = "hello"
assertEquals("hello", s.getProperties().getProperty("greeting"))
assertEquals("hello", s.greeting)
}

@Test
void testExtension() {
try {
s.foo
fail()
} catch (Exception ignored) {
}
assertNull(s.foo)
s.addExtension(Substation.class, new Foo())
assertNotNull(s.foo)
s.foo.value = 3f
Expand Down

0 comments on commit c532376

Please sign in to comment.