@Test public void setUnknownPropertyWithPossibleMatches() { Simple target = new Simple("John", 2); AbstractPropertyAccessor accessor = createAccessor(target); try { accessor.setPropertyValue("foo", "value"); fail("Should have failed to set an unknown property."); } catch (NotWritablePropertyException e) { assertEquals(Simple.class, e.getBeanClass()); assertEquals("foo", e.getPropertyName()); } }
@Test public void setUnknownProperty() { Simple target = new Simple("John", 2); AbstractPropertyAccessor accessor = createAccessor(target); try { accessor.setPropertyValue("name1", "value"); fail("Should have failed to set an unknown property."); } catch (NotWritablePropertyException e) { assertEquals(Simple.class, e.getBeanClass()); assertEquals("name1", e.getPropertyName()); assertEquals("Invalid number of possible matches", 1, e.getPossibleMatches().length); assertEquals("name", e.getPossibleMatches()[0]); } }
log.warn("Error while setting property for yaml parsing.", e); context.getParsingErrors().add(new ParsingError(ParsingErrorLevel.WARNING, ErrorCode.ALIEN_MAPPING_ERROR, "Invalid definition for type", valueNode.getStartMark(), e.getPropertyName(), valueNode.getEndMark(), toscaType)); log.warn("Error while setting key to property for yaml parsing.", e); context.getParsingErrors().add(new ParsingError(ParsingErrorLevel.WARNING, ErrorCode.ALIEN_MAPPING_ERROR, "Invalid definition for type", valueNode.getStartMark(), e.getPropertyName(), valueNode.getEndMark(), toscaType));