### Question:
Context implements IContext<TEntity> { @Override public Group<TEntity> getGroup(IMatcher matcher) { Group<TEntity> group = _groups.get(matcher); if (group == null) { group = new Group(matcher, entityType); for (TEntity entity : getEntities()) { group.handleEntitySilently(entity); } _groups.put(matcher, group); for (int index : matcher.getIndices()) { if (_groupsForIndex[index] == null) { _groupsForIndex[index] = EntitasCollections.<Group<TEntity>>createList(Group.class); } _groupsForIndex[index].add(group); } notifyGroupCreated(group); return group; } return group; } Context(int totalComponents, int startCreationIndex, ContextInfo contexInfo,
                   EntityBaseFactory<TEntity> factoryMethod, Function<TEntity, IAERC> aercFactory); @Override TEntity createEntity(); @Override void destroyAllEntities(); @Override boolean hasEntity(TEntity entity); @Override TEntity[] getEntities(); @Override int getTotalComponents(); @Override Group<TEntity> getGroup(IMatcher matcher); @Override void addEntityIndex(IEntityIndex entityIndex); @Override IEntityIndex getEntityIndex(String name); @Override void resetCreationIndex(); @Override void clearComponentPool(int index); @Override void clearComponentPools(); @Override void reset(); void updateGroupsComponentAddedOrRemoved(TEntity entity, int index, IComponent component, List<Group<TEntity>>[] groupsForIndex); @Override Stack<IComponent>[] getComponentPools(); @Override ContextInfo getContextInfo(); @Override int getCount(); @Override int getReusableEntitiesCount(); @Override int getRetainedEntitiesCount(); IEntity[] getEntities(IMatcher matcher); @Override Collector createCollector(IMatcher matcher); @Override Collector createCollector(IMatcher matcher, GroupEvent groupEvent); Collector<TEntity> createCollector(Context context, TriggerOnEvent<TEntity>[] triggers); void clearEventsListener(); void OnEntityCreated(ContextEntityChanged listener); void OnEntityWillBeDestroyed(ContextEntityChanged listener); void OnEntityDestroyed(ContextEntityChanged listener); void OnGroupCreated(ContextGroupChanged listener); void notifyEntityCreated(IEntity entity); void notifyEntityWillBeDestroyed(IEntity entity); void notifyEntityDestroyed(IEntity entity); void notifyGroupCreated(IGroup group); @Override String toString(); public int _totalComponents; public Class<TEntity> entityType; public Set<ContextEntityChanged> OnEntityCreated; public Set<ContextEntityChanged> OnEntityWillBeDestroyed; public Set<ContextEntityChanged> OnEntityDestroyed; public Set<ContextGroupChanged> OnGroupCreated; }### Answer:
@Test public void getGroupTest() { entity.addComponent(TestComponentIds.Position, new Position()); Group group = context.getGroup(TestMatcher.Position()); assertEquals(1, group.getCount()); group = context.getGroup(TestMatcher.Position()); assertEquals(1, group.getCount()); }