<commit_before>package com.artemis.managers;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.artemis.Entity;
import com.artemis.World;

public class GroupManagerTest {
	private static final String GROUPIE = "groupie";
	private static final String GROUPIE2 = "groupie2";
	
	private World world;
	private GroupManager gm;

	@Before
	public void setUp() throws Exception {
		world = new World();
		gm = world.setManager(new GroupManager());
		world.initialize();
	}
	
	@Test
	public void added_entities_should_only_occur_once() {
		Entity entity = world.createEntity();
		entity.addToWorld();
		gm.add(entity, GROUPIE);
		gm.add(entity, GROUPIE);

		assertEquals(1, gm.getEntities(GROUPIE).size());
	}
	
	@Test
	public void deleted_entities_should_be_removed() {
		Entity entity = world.createEntity();
		entity.addToWorld();
		gm.add(entity, GROUPIE);

		assertEquals(1, gm.getEntities(GROUPIE).size());

		entity.deleteFromWorld();
		world.process();
		assertEquals(0, gm.getEntities(GROUPIE).size());
	}
	
	@Test
	public void deleted_entities_should_be_removed_from_all_groups() {
		Entity entity = world.createEntity();
		entity.addToWorld();
		gm.add(entity, GROUPIE);
		gm.add(entity, GROUPIE2);
		
		assertEquals(1, gm.getEntities(GROUPIE).size());
		assertEquals(1, gm.getEntities(GROUPIE2).size());
		
		entity.deleteFromWorld();
		world.process();
		
		assertEquals(0, gm.getEntities(GROUPIE).size());
		assertEquals(0, gm.getEntities(GROUPIE2).size());
	}
}<commit_msg>More on #39.<commit_after>package com.artemis.managers;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.artemis.Entity;
import com.artemis.World;

public class GroupManagerTest {
	private static final String GROUPIE = "groupie";
	private static final String GROUPIE2 = "groupie2";
	
	private World world;
	private GroupManager gm;

	@Before
	public void setUp() throws Exception {
		world = new World();
		gm = world.setManager(new GroupManager());
		world.initialize();
	}
	
	@Test
	public void added_entities_should_only_occur_once() {
		Entity entity = world.createEntity();
		entity.addToWorld();
		gm.add(entity, GROUPIE);
		gm.add(entity, GROUPIE);

		assertEquals(1, gm.getEntities(GROUPIE).size());
	}
	
	@Test
	public void deleted_entities_should_be_removed() {
		Entity entity = world.createEntity();
		entity.addToWorld();
		gm.add(entity, GROUPIE);

		assertEquals(1, gm.getEntities(GROUPIE).size());

		entity.deleteFromWorld();
		world.process();
		assertEquals(0, gm.getEntities(GROUPIE).size());
		assertFalse(gm.isInAnyGroup(entity));
	}
	
	@Test
	public void deleted_entities_should_be_removed_from_all_groups() {
		Entity entity = world.createEntity();
		entity.addToWorld();
		gm.add(entity, GROUPIE);
		gm.add(entity, GROUPIE2);
		
		assertEquals(1, gm.getEntities(GROUPIE).size());
		assertEquals(1, gm.getEntities(GROUPIE2).size());
		
		entity.deleteFromWorld();
		world.process();
		
		assertEquals(0, gm.getEntities(GROUPIE).size());
		assertEquals(0, gm.getEntities(GROUPIE2).size());
		assertFalse(gm.isInAnyGroup(entity));
	}
}
{'fraction_non_alphanumeric': 0.13742409715564077, 'fraction_numerical': 0.008309364014062001, 'mean_word_length': 5.11328125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3108668', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1092, 'n_words': 202}