List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(String message, int expected, int actual)
From source file:com.workday.autoparse.json.demo.JsonTestUtils.java
static void assertJSONObjectsEqual(String message, JSONObject expected, Object actual) { if (expected == null) { Assert.assertNull(message + " is null", actual); return;//from ww w. j a v a2 s . c om } Assert.assertNotNull(message + " not null", actual); Assert.assertTrue(message + " expected JSONObject but found " + actual.getClass().getCanonicalName(), actual instanceof JSONObject); JSONObject actualJsonObject = (JSONObject) actual; Assert.assertEquals(message + ": size", expected.length(), actualJsonObject.length()); @SuppressWarnings("unchecked") Iterator<String> keys = expected.keys(); while (keys.hasNext()) { String key = keys.next(); Assert.assertEquals(message + ": " + key, expected.opt(key), actualJsonObject.opt(key)); } }
From source file:net.chrisrichardson.ormunit.hibernate.LocalSessionFactoryBeanUtil.java
public static LocalSessionFactoryBean getLocalSessionFactoryBean(ApplicationContext applicationContext) { Map beans = BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, LocalSessionFactoryBean.class); Assert.assertEquals("LocalSessionFactoryBean", 1, beans.size()); LocalSessionFactoryBean localSessionFactoryBean = (LocalSessionFactoryBean) beans.values().iterator() .next();// www . ja v a2 s. c om return localSessionFactoryBean; }
From source file:Project2Test.java
@Test public void objectEquality() { Assert.assertEquals("Object equality test failed", service.getAnimalName(), "cat"); }
From source file:com.tracy.designprinciples.encapsulation.EncapsulationTest.java
@Test public void encapTest() { service.setName("Jim"); Assert.assertEquals("The student's name does not match", service.getName(), "Jim"); }
From source file:DIPTest.DIPViolationTest.java
@Test public void DipViolation() { Assert.assertEquals("Registration :", "Muneem" + "Waggie" + "9101295335084" + "0738899666" + "Grade 5", register.toString());//w ww .j a va 2s. c o m }
From source file:de.hybris.platform.tx.TransactionConfigTest.java
@Test public void testLogTransactionBeginTrails() { final boolean flagBefore = Config.getBoolean(Transaction.LOG_BEGIN_CONFIG_KEY, false); try {/* w ww.jav a 2 s . c o m*/ Config.setParameter(Transaction.LOG_BEGIN_CONFIG_KEY, "true"); final Transaction current = Transaction.current(); current.clearAddTxStackTrace(); Assert.assertEquals("initial stack trail size should be 0", 0, current.getBeginTransactionStack().size()); current.begin(); Assert.assertEquals("stack trail size after begin should be 1", 1, current.getBeginTransactionStack().size()); current.rollback(); Assert.assertEquals("stack trail size after rollback should be 0", 0, current.getBeginTransactionStack().size()); current.begin(); Assert.assertEquals("stack trail size after begin should be 1", 1, current.getBeginTransactionStack().size()); current.commit(); Assert.assertEquals("stack trail size after commit should be 0", 0, current.getBeginTransactionStack().size()); current.begin(); Assert.assertEquals("stack trail size after begin should be 1", 1, current.getBeginTransactionStack().size()); current.begin(); Assert.assertEquals("stack trail size after nested begin should be 2", 2, current.getBeginTransactionStack().size()); current.commit(); Assert.assertEquals("stack trail size after nested commit should be 1", 1, current.getBeginTransactionStack().size()); current.begin(); Assert.assertEquals("stack trail size after nested begin should be 2", 2, current.getBeginTransactionStack().size()); current.rollback(); Assert.assertEquals("stack trail size after nested rollback should be 1", 1, current.getBeginTransactionStack().size()); current.rollback(); Assert.assertEquals("stack trail size after commit should be 0", 0, current.getBeginTransactionStack().size()); } finally { Config.setParameter(Transaction.LOG_BEGIN_CONFIG_KEY, BooleanUtils.toStringTrueFalse(flagBefore)); } }
From source file:com.karriem.tp.tddassignment.TDDTestNGTest.java
@Test public void add() { Assert.assertEquals("The two numbers are not equal", 8, service.add(4, 4)); }
From source file:org.thingsplode.testutils.PopertyTest.java
@Test() public void testProps() { System.out.println("Test Property ---------> [" + valueObject + "]"); Assert.assertEquals("It should be a", "a", valueObject); }
From source file:edu.northwestern.bioinformatics.studycalendar.dao.LegacyUserProvisioningRecordDaoTest.java
public void testUsersWithoutRolesSelected() throws Exception { List<LegacyUserProvisioningRecord> actual = dao.getAll(); LegacyUserProvisioningRecord last = actual.get(actual.size() - 1); Assert.assertEquals("Wrong name", "Captain", last.getUserName()); assertTrue("Site should be blank", isBlank(last.getSiteName())); assertTrue("Study should be blank", isBlank(last.getStudyName())); }
From source file:com.karriem.tp.tddassignment.TDDTestNGTest.java
@Test public void floatNum() { Assert.assertEquals("Two floats are not equal", 12.9, service.floatNum(8.4, 4.5)); }