### Question:
BehaviorManager { public void updateBehavior(CareBehaviorTypeWrapper behavior, SubsystemContext<CareSubsystemModel> context) { setBehavior(behavior, context); broadcastBehaviorEvent(behavior, context, CareSubsystemCapability.BehaviorActionEvent.BEHAVIORACTION_MODIFIED); } BehaviorManager(); void bind(SubsystemContext<CareSubsystemModel> context); CareBehaviorTypeWrapper getBehaviorFromContext(String id, SubsystemContext<CareSubsystemModel> context); List<CareBehaviorTypeWrapper> listCareBehaviors(SubsystemContext<CareSubsystemModel> context); List<CareBehaviorTemplate> listCareBehaviorTemplates(SubsystemContext<CareSubsystemModel> context); void loadOptions(List<BehaviorOption> options, CareBehaviorTemplate template); void updateBehavior(CareBehaviorTypeWrapper behavior, SubsystemContext<CareSubsystemModel> context); boolean removeBehavior(String id, SubsystemContext<CareSubsystemModel> context); String addBehavior(CareBehaviorTypeWrapper behavior, SubsystemContext<CareSubsystemModel> context); boolean behaviorNameExists(String name, SubsystemContext<CareSubsystemModel> context); boolean behaviorNameExists(CareBehaviorTypeWrapper behaviorWrapper, SubsystemContext<CareSubsystemModel> context); CareBehaviorTypeWrapper loadBehaviorByName(String name, SubsystemContext<CareSubsystemModel> context);  }### Answer:
@Test public void testUpdateBehavior() { String behaviorId = manager.addBehavior(new CareBehaviorTypeWrapper(existingBehavior.toMap()), context); existingBehavior.setId(behaviorId); existingBehavior.setTimeWindows(ImmutableList.of(BehaviorFixtures.createTimeWindow().toMap())); CareBehaviorTypeWrapper lookup = manager.getBehaviorFromContext(behaviorId, context); CareBehaviorInactivity inactivity = new CareBehaviorInactivity(lookup.getAttributes()); inactivity.setDurationSecs(60); manager.updateBehavior(new CareBehaviorTypeWrapper(inactivity.toMap()), context); assertTrue(context.model().getBehaviors().contains(behaviorId)); CareBehaviorTypeWrapper careBehavior = manager.getBehaviorFromContext(behaviorId, context); assertEquals(60l,careBehavior.getAttributes().get(CareBehaviorInactivity.ATTR_DURATIONSECS)); List<Map<String, Object>> tws = careBehavior.getTimeWindows(); assertEquals(new TimeWindow(existingBehavior.getTimeWindows().get(0)).toMap(), new TimeWindow(tws.get(0)).toMap()); MessageBody event = BehaviorActionEvent.builder() .withBehaviorId(behaviorId) .withBehaviorAction(BehaviorActionEvent.BEHAVIORACTION_MODIFIED) .withBehaviorName(existingBehavior.getName()).build(); assertEquals(event.getAttributes(), broadcasts.getValues().get(1).getAttributes()); }