### Question:
EventLogging implements TWidget { public void log(TEvent event) { if (!canWrite()) { return; } try { method.invoke(logger, formatter.format(event)); } catch (Exception e) { e.printStackTrace(); } }  void setName(String name); @Required void setFormat(String format); @Required void setLevel(String level); void log(TEvent event); boolean canWrite();  }### Answer:
@Test public void test() throws Exception { EventLogging logging = new EventLogging(); Map<String, TProperty> props = TProperty.getProperties(logging); Assert.assertFalse(props.get("name").isRequired()); Assert.assertTrue(props.get("format").isRequired()); Assert.assertTrue(props.get("level").isRequired()); props.get("name").set("hello"); props.get("format").set("hello %{name}"); props.get("level").set("warn"); TEvent e = new TEvent("test"); e.setField("name", "world"); logging.log(e); }