Java Code Examples for junit.framework.Assert#assertSame()
The following examples show how to use
junit.framework.Assert#assertSame() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmitterTest.java From blueflood with Apache License 2.0 | 6 votes |
@Test public void offOnlyClearsForGivenEvent() { // given emitter.on(testEventName, listener); emitter.on(testEventName2, listener); // precondition Assert.assertEquals(0, store.size()); // when emitter.off(testEventName); emitter.emit(testEventName, event1); emitter.emit(testEventName2, event2); // then Assert.assertEquals(1, store.size()); Assert.assertSame(event2, store.get(0)); }
Example 2
Source File: TestNonRemoteSerialization.java From reladomo with Apache License 2.0 | 6 votes |
public void testDatedTransactionalSerialization() throws ParseException { Timestamp businessDate = new Timestamp(timestampFormat.parse("2002-11-29 00:00:00").getTime()); int balanceId = 1; TinyBalance tb = findTinyBalanceForBusinessDate(balanceId, businessDate); TinyBalance tb2 = (TinyBalance) serializeAndDeserialize(tb); Assert.assertSame(tb, tb2); tb = new TinyBalance(businessDate, InfinityTimestamp.getParaInfinity()); tb.setAcmapCode("A"); tb.setBalanceId(2000); tb.setQuantity(12.5); tb2 = (TinyBalance) serializeAndDeserialize(tb); Assert.assertNotSame(tb, tb2); Assert.assertEquals(tb.getBalanceId(), tb2.getBalanceId()); Assert.assertEquals(tb.getAcmapCode(), tb2.getAcmapCode()); Assert.assertEquals(tb.getQuantity(), tb2.getQuantity(), 0); Assert.assertEquals(tb.getBusinessDate(), tb2.getBusinessDate()); Assert.assertEquals(tb.getProcessingDate(), tb2.getProcessingDate()); }
Example 3
Source File: InternalProviderDataTest.java From androidtv-sample-inputs with Apache License 2.0 | 6 votes |
@Test public void testPopulatedAdsInsertion() throws InternalProviderData.ParseException { InternalProviderData internalProviderData = new InternalProviderData(); ArrayList<Advertisement> advertisementArrayList = new ArrayList<>(); for (int i = 0; i < 5; i++) { // Insert 5 advertisements advertisementArrayList.add( new Advertisement.Builder() .setRequestUrl("http://example.com/commercial.mp4") .setStartTimeUtcMillis(i * 5000) .setStopTimeUtcMillis((i + 1) * 5000) .setType(Advertisement.TYPE_VAST) .build()); } internalProviderData.setAds(advertisementArrayList); Assert.assertSame("Ad list should have 5 items", 5, internalProviderData.getAds().size()); Assert.assertTrue( "Ad start time should be 5000ms", (5000L - internalProviderData.getAds().get(1).getStartTimeUtcMillis()) <= 0); Assert.assertSame( "Ad type should be VAST", Advertisement.TYPE_VAST, internalProviderData.getAds().get(2).getType()); }
Example 4
Source File: RollupEventEmitterTest.java From blueflood with Apache License 2.0 | 6 votes |
@Test public void emitTriggersListenerInSameOrder1() { // given emitter.on(testEventName, listener); emitter.on(testEventName2, listener); // precondition Assert.assertEquals(0, store.size()); // when emitter.emit(testEventName, event1); emitter.emit(testEventName2, event2); // then Assert.assertEquals(2, store.size()); Assert.assertSame(event1, store.get(0)); Assert.assertSame(event2, store.get(1)); }
Example 5
Source File: EmitterTest.java From blueflood with Apache License 2.0 | 6 votes |
@Test public void emitOnlyTriggersForGivenEvent2() { // given emitter.on(testEventName, listener); emitter.on(testEventName2, listener); // precondition Assert.assertEquals(0, store.size()); // when emitter.emit(testEventName2, event2); // then Assert.assertEquals(1, store.size()); Assert.assertSame(event2, store.get(0)); }
Example 6
Source File: DocumentManagerImplTest.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
@Test public void testMoveToFolder() throws Exception { User user = userDao.findByUsername("admin"); Document doc = docDao.findById(1); Assert.assertNotNull(doc); Folder folder = doc.getFolder(); Assert.assertEquals(6, folder.getId()); DocumentHistory transaction = new DocumentHistory(); transaction.setFolderId(6L); transaction.setUser(user); transaction.setDocId(doc.getId()); transaction.setUserId(1L); transaction.setNotified(0); transaction.setComment("pippo_reason"); Folder newFolder = folderDao.findById(6); docDao.initialize(doc); documentManager.moveToFolder(doc, newFolder, transaction); Assert.assertSame(1L, doc.getId()); Assert.assertEquals(newFolder, doc.getFolder()); }
Example 7
Source File: AbstractDateCalculatorCombinationTest.java From objectlabkit with Apache License 2.0 | 5 votes |
public void testNullCombination() { registerHolidays("US", createUSHolidayCalendar()); final DateCalculator<E> cal1 = newDateCalculator("US", HolidayHandlerType.FORWARD); final E localDate = newDate("2006-08-08"); cal1.setStartDate(localDate); final DateCalculator<E> combo = cal1.combine(null); Assert.assertSame("same", combo, cal1); Assert.assertEquals("Combo name", "US", combo.getName()); Assert.assertEquals("Combo type", HolidayHandlerType.FORWARD, combo.getHolidayHandlerType()); Assert.assertEquals("start", localDate, combo.getStartDate()); Assert.assertEquals("currentDate", localDate, combo.getCurrentBusinessDate()); Assert.assertEquals("Holidays", 3, combo.getHolidayCalendar().getHolidays().size()); }
Example 8
Source File: HugeArrayTest.java From consulo with Apache License 2.0 | 5 votes |
public void testToArray() { myArray.put(1, "a"); myArray.put(15, "b"); Object[] array = myArray.toArray(); Assert.assertEquals(16, array.length); String[] expectedArray = new String[16]; Assert.assertSame(expectedArray, myArray.toArray(expectedArray)); }
Example 9
Source File: FailbackClusterInvokerTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test() public void testInvokeNoExceptoin() { resetInvokerToNoException(); FailbackClusterInvoker<FailbackClusterInvokerTest> invoker = new FailbackClusterInvoker<FailbackClusterInvokerTest>( dic); Result ret = invoker.invoke(invocation); Assert.assertSame(result, ret); }
Example 10
Source File: FailfastClusterInvokerTest.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@Test() public void testInvokeNoExceptoin() { resetInvoker1ToNoException(); FailfastClusterInvoker<FailfastClusterInvokerTest> invoker = new FailfastClusterInvoker<FailfastClusterInvokerTest>(dic); Result ret = invoker.invoke(invocation); Assert.assertSame(result, ret); }
Example 11
Source File: FailfastClusterInvokerTest.java From dubbo3 with Apache License 2.0 | 5 votes |
@Test() public void testInvokeNoExceptoin() { resetInvoker1ToNoException(); FailfastClusterInvoker<FailfastClusterInvokerTest> invoker = new FailfastClusterInvoker<FailfastClusterInvokerTest>(dic); Result ret = invoker.invoke(invocation); Assert.assertSame(result, ret); }
Example 12
Source File: ProjectViewTestUtil.java From consulo with Apache License 2.0 | 5 votes |
public static void checkGetParentConsistency(AbstractTreeStructure structure, Object from) { Object[] childElements = structure.getChildElements(from); for (Object childElement : childElements) { Assert.assertSame(from, structure.getParentElement(childElement)); checkGetParentConsistency(structure, childElement); } }
Example 13
Source File: TestMySQLPackageSplitter.java From Mycat-NIO with Apache License 2.0 | 5 votes |
/** * 创建4个报文,第二个报文的type被截断,后面的报文type不被截断,测试是否能读到type * * @throws IOException */ @Test public void testTypeParser() throws IOException { List<Byte> typeList = Arrays.asList(MySQLPacket.AUTH_PACKET, MySQLPacket.COM_INIT_DB, MySQLPacket.COM_QUERY, MySQLPacket.COM_QUIT); ByteBufferArray bufArray = splitPackage(createMultiPackage(Arrays.asList(16, 30, 40, 20), typeList), 26); Assert.assertEquals(4, bufArray.getCurPacageIndex()); for (int i = 0; i < 4; i++) { Assert.assertSame(typeList.get(i), bufArray.getPacageType(i)); } }
Example 14
Source File: LogSearchConfigFactoryTest.java From ambari-logsearch with Apache License 2.0 | 5 votes |
@Test public void testDefaultConfigServer() throws Exception { LogSearchConfigServer config = LogSearchConfigFactory.createLogSearchConfigServer( Collections.<String, String> emptyMap(), LogSearchConfigServerClass1.class); Assert.assertSame(config.getClass(), LogSearchConfigServerClass1.class); }
Example 15
Source File: InternalProviderDataTest.java From androidtv-sample-inputs with Apache License 2.0 | 4 votes |
@Test public void testEmptyAdsInsertion() throws InternalProviderData.ParseException { InternalProviderData internalProviderData = new InternalProviderData(); internalProviderData.setAds(new ArrayList<Advertisement>()); Assert.assertSame("Ad list should be empty", 0, internalProviderData.getAds().size()); }
Example 16
Source File: Nopol2017_0053_t.java From coming with MIT License | 4 votes |
public static JSType assertResolvesToSame(JSType type) { Assert.assertSame(type, assertValidResolve(type)); return type; }
Example 17
Source File: Nopol2017_009_t.java From coming with MIT License | 4 votes |
public static JSType assertResolvesToSame(JSType type) { Assert.assertSame(type, assertValidResolve(type)); return type; }
Example 18
Source File: WebOSWebAppSessionTest.java From Connect-SDK-Android-Core with Apache License 2.0 | 4 votes |
@Test public void testGetPlaylistControl() { Assert.assertSame(session, session.getPlaylistControl()); }
Example 19
Source File: Callbacks.java From tinybus with Apache License 2.0 | 4 votes |
public void assertNullEvent() { Assert.assertEquals(1, mEvents.size()); Assert.assertSame(null, mEvents.get(0)); }
Example 20
Source File: IgnoreErrorsAssert.java From JTAF-XCore with Apache License 2.0 | 3 votes |
/** * Asserts that two objects refer to the same object. If they are not, a * Throwable is stored in the accumulator with the given message. * * @param message * message to be thrown if not the same * @param expected * expected object * @param actual * actual object that is being checked */ @SuppressWarnings("deprecation") public void assertSame(String message, Object expected, Object actual) { try { Assert.assertSame(message, expected, actual); } catch (Throwable e) { ea.addError(e); } }