<commit_before>package org.sagebionetworks.repo.model.message;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sagebionetworks.repo.model.ObjectType;
import org.sagebionetworks.repo.model.UserGroup;
import org.sagebionetworks.repo.model.UserGroupDAO;
import org.sagebionetworks.repo.model.dbo.dao.DBOChangeDAO;
import org.sagebionetworks.repo.web.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:jdomodels-test-context.xml" })
public class BroadcastMessageDaoImplTest {
	
	@Autowired
	BroadcastMessageDao broadcastMessageDao;
	@Autowired
	DBOChangeDAO changeDao;
	@Autowired
	private UserGroupDAO userGroupDAO;
	
	UserGroup user;
	ChangeMessage changeMessage;
	
	@Before
	public void before(){
		
		user = new UserGroup();
		user.setIsIndividual(true);
		user.setId(userGroupDAO.create(user).toString());
		
		changeDao.deleteAllChanges();
		
		changeMessage = new ChangeMessage();
		changeMessage.setChangeType(ChangeType.CREATE);
		changeMessage.setObjectEtag("etag");
		changeMessage.setObjectId("123");
		changeMessage.setObjectType(ObjectType.THREAD);
		changeMessage = changeDao.replaceChange(changeMessage);
	}
	
	@After
	public void after(){
		changeDao.deleteAllChanges();
		if(user != null){
			userGroupDAO.delete(user.getId());
		}
	}
	
	@Test
	public void testWasBroadcastDoesNotExist(){
		long doesNotExist = -1;
		// call under test
		boolean wasBroadcast = broadcastMessageDao.wasBroadcast(doesNotExist);
		assertFalse(wasBroadcast);
	}
	
	@Test
	public void setBroadcastHappy(){
		// should not be broadcast yet.
		assertFalse(broadcastMessageDao.wasBroadcast(changeMessage.getChangeNumber()));
		// call under test.
		broadcastMessageDao.setBroadcast(changeMessage.getChangeNumber());
		// should be broadcast
		assertTrue(broadcastMessageDao.wasBroadcast(changeMessage.getChangeNumber()));
	}
	
	@Test (expected=NotFoundException.class)
	public void setBroadcastChangeDoesNotExist(){
		Long changeDoesNotExist = -1L;
		// call under test.
		broadcastMessageDao.setBroadcast(changeDoesNotExist);
	}

}<commit_msg>remove test<commit_after>package org.sagebionetworks.repo.model.message;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sagebionetworks.repo.model.ObjectType;
import org.sagebionetworks.repo.model.UserGroup;
import org.sagebionetworks.repo.model.UserGroupDAO;
import org.sagebionetworks.repo.model.dbo.dao.DBOChangeDAO;
import org.sagebionetworks.repo.web.NotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:jdomodels-test-context.xml" })
public class BroadcastMessageDaoImplTest {
	
	@Autowired
	BroadcastMessageDao broadcastMessageDao;
	@Autowired
	DBOChangeDAO changeDao;
	@Autowired
	private UserGroupDAO userGroupDAO;
	
	UserGroup user;
	ChangeMessage changeMessage;
	
	@Before
	public void before(){
		
		user = new UserGroup();
		user.setIsIndividual(true);
		user.setId(userGroupDAO.create(user).toString());
		
		changeDao.deleteAllChanges();
		
		changeMessage = new ChangeMessage();
		changeMessage.setChangeType(ChangeType.CREATE);
		changeMessage.setObjectEtag("etag");
		changeMessage.setObjectId("123");
		changeMessage.setObjectType(ObjectType.THREAD);
		changeMessage = changeDao.replaceChange(changeMessage);
	}
	
	@After
	public void after(){
		changeDao.deleteAllChanges();
		if(user != null){
			userGroupDAO.delete(user.getId());
		}
	}
	
	@Test
	public void testWasBroadcastDoesNotExist(){
		long doesNotExist = -1;
		// call under test
		boolean wasBroadcast = broadcastMessageDao.wasBroadcast(doesNotExist);
		assertFalse(wasBroadcast);
	}
	
	@Test
	public void setBroadcastHappy(){
		// should not be broadcast yet.
		assertFalse(broadcastMessageDao.wasBroadcast(changeMessage.getChangeNumber()));
		// call under test.
		broadcastMessageDao.setBroadcast(changeMessage.getChangeNumber());
		// should be broadcast
		assertTrue(broadcastMessageDao.wasBroadcast(changeMessage.getChangeNumber()));
	}

}
{'fraction_non_alphanumeric': 0.10450951057918359, 'fraction_numerical': 0.003205813207950417, 'mean_word_length': 6.027027027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3026369', 'n_tokens_mistral': 1540, 'n_tokens_neox': 1476, 'n_words': 235}