Java Code Examples for junit.framework.Assert.assertNotSame()

The following are Jave code examples for showing how to use assertNotSame() of the junit.framework.Assert class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: otter-G   File: DbLoadMergerTest.java   View Source Code Vote up 6 votes
/**
 * 测试在主键发生变化后的merge操作,Update/Update
 */
@Test
public void testMergeWithUpdateKeyOfUU() {
    Map<RowKey, EventData> mergeMap = new MapMaker().makeMap();
    DbLoadMerger.merge(makeUpdateEventData(KEY_VALUE, KEY_VALUE_NEW1), mergeMap);
    DbLoadMerger.merge(makeUpdateEventData(KEY_VALUE_NEW1, KEY_VALUE_NEW2), mergeMap);

    for (Entry<RowKey, EventData> entry : mergeMap.entrySet()) {
        RowKey key = entry.getKey();
        EventColumn keyColumn = key.getKeys().get(0);
        Assert.assertEquals(KEY_VALUE_NEW2, keyColumn.getColumnValue());
        Assert.assertEquals(KEY_NAME, keyColumn.getColumnName());

        EventData eventData = entry.getValue();
        Assert.assertEquals(SCHEMA_NAME, eventData.getSchemaName());
        Assert.assertEquals(TABLE_NAME, eventData.getTableName());
        Assert.assertEquals(TABLE_ID, eventData.getTableId());
        Assert.assertEquals(EventType.UPDATE, eventData.getEventType());

        List<EventColumn> oldKeys = eventData.getOldKeys();
        List<EventColumn> keys = eventData.getKeys();
        Assert.assertNotSame(oldKeys, keys);
    }
}
 
Example 2
Project: otter-G   File: DbLoadMergerTest.java   View Source Code Vote up 6 votes
/**
 * 测试在主键发生变化后的merge操作,Update/Update/Insert
 */
@Test
public void testMergeWithUpdateKeyOfUI() {
    Map<RowKey, EventData> mergeMap = new MapMaker().makeMap();
    DbLoadMerger.merge(makeUpdateEventData(KEY_VALUE_NEW1, KEY_VALUE_NEW2), mergeMap);
    DbLoadMerger.merge(makeUpdateEventData(KEY_VALUE_NEW2, KEY_VALUE), mergeMap);
    DbLoadMerger.merge(makeInsertEventData(), mergeMap);

    for (Entry<RowKey, EventData> entry : mergeMap.entrySet()) {
        RowKey key = entry.getKey();
        EventColumn keyColumn = key.getKeys().get(0);
        Assert.assertEquals(KEY_VALUE, keyColumn.getColumnValue());
        Assert.assertEquals(KEY_NAME, keyColumn.getColumnName());

        EventData eventData = entry.getValue();
        Assert.assertEquals(SCHEMA_NAME, eventData.getSchemaName());
        Assert.assertEquals(TABLE_NAME, eventData.getTableName());
        Assert.assertEquals(TABLE_ID, eventData.getTableId());
        Assert.assertEquals(EventType.INSERT, eventData.getEventType());

        List<EventColumn> oldKeys = eventData.getOldKeys();
        List<EventColumn> keys = eventData.getKeys();

        Assert.assertNotSame(oldKeys, keys);
    }
}
 
Example 3
Project: otter-G   File: DbLoadMergerTest.java   View Source Code Vote up 6 votes
/**
 * 测试在主键发生变化后的merge操作,Insert/Insert
 */
@Test
public void testMergeWithUpdateKeyOfII() {
    Map<RowKey, EventData> mergeMap = new MapMaker().makeMap();
    DbLoadMerger.merge(makeInsertEventData(), mergeMap);
    DbLoadMerger.merge(makeInsertEventData(), mergeMap);

    for (Entry<RowKey, EventData> entry : mergeMap.entrySet()) {
        RowKey key = entry.getKey();
        EventColumn keyColumn = key.getKeys().get(0);
        Assert.assertEquals(KEY_VALUE, keyColumn.getColumnValue());
        Assert.assertEquals(KEY_NAME, keyColumn.getColumnName());

        EventData eventData = entry.getValue();
        Assert.assertEquals(SCHEMA_NAME, eventData.getSchemaName());
        Assert.assertEquals(TABLE_NAME, eventData.getTableName());
        Assert.assertEquals(TABLE_ID, eventData.getTableId());
        Assert.assertEquals(EventType.INSERT, eventData.getEventType());

        List<EventColumn> oldKeys = eventData.getOldKeys();
        List<EventColumn> keys = eventData.getKeys();

        Assert.assertNotSame(oldKeys, keys);
    }
}
 
Example 4
Project: eBread   File: ShowDocumentFragmentTest.java   View Source Code Vote up 5 votes
@Test
public void startSyncTest() {
    Class<?> reflected = showDoc.getClass();
    try {
        Field bufferSyncDataField = reflected.getDeclaredField("bufferSyncData");
        bufferSyncDataField.setAccessible(true);
        bufferSyncDataField.set(showDoc,null);
        showDoc.startSync();

        Field currentSyncDataField = reflected.getDeclaredField("currentSyncData");
        currentSyncDataField.setAccessible(true);
        currentSyncDataField.set(showDoc,currentSyncData);
        currentSyncData.add(10);


        LinkedList<ArrayList<Integer>> bufferSyncData = new LinkedList<>();
        LinkedList<ArrayList<Integer>> bufferSyncDataCorrect = new LinkedList<>();
        bufferSyncData.add(currentSyncData);
        bufferSyncDataCorrect.add(currentSyncData);
        bufferSyncDataField.set(showDoc,bufferSyncData);
        showDoc.startSync();

        Assert.assertNotSame(bufferSyncDataCorrect.toString(),bufferSyncDataField.get(showDoc).toString());

    } catch(Exception e) {
        assertFalse(true);
    }
}
 
Example 5
Project: Alerter   File: AlertTest.java   View Source Code Vote up 5 votes
@Test
public void testTitleString() {
    //Strings
    alert.setTitle(HELLO);
    Assert.assertTrue(alert.getTitle().getVisibility() == View.VISIBLE);

    Assert.assertNotNull(alert.getTitle().getText());
    Assert.assertEquals(HELLO, alert.getTitle().getText());
    Assert.assertNotSame(HI, alert.getTitle().getText());
}
 
Example 6
Project: Alerter   File: AlertTest.java   View Source Code Vote up 5 votes
@Test
public void testTitleStringRes() {
    //String Resources
    alert.setTitle(R.string.lib_name);
    Assert.assertTrue(alert.getTitle().getVisibility() == View.VISIBLE);

    Assert.assertNotNull(alert.getTitle().getText());
    Assert.assertEquals(ALERTER, alert.getTitle().getText());
    Assert.assertNotSame(HI, alert.getTitle().getText());
}
 
Example 7
Project: Alerter   File: AlertTest.java   View Source Code Vote up 5 votes
@Test
public void testTextString() {
    //Strings
    alert.setText(HELLO);
    Assert.assertTrue(alert.getText().getVisibility() == View.VISIBLE);

    Assert.assertNotNull(alert.getText().getText());
    Assert.assertEquals(HELLO, alert.getText().getText());
    Assert.assertNotSame(HI, alert.getText().getText());
}
 
Example 8
Project: spring-configuration-support   File: ConfigurationValueServiceDEVTest.java   View Source Code Vote up 5 votes
@Test
public void testConfigUpdate() {
	this.service.setValueFor("tst.key.a", "tst.key.a.newValue");
	Assert.assertNotSame(testKeyA, "tst.key.a.newValue");
	ConfigurationValue value = this.service.getValue("tst.key.a");
	Assert.assertSame(value.getValue(), "tst.key.a.newValue");
}
 
Example 9
Project: SciChart.Android.Examples   File: ExampleLoaderTests.java   View Source Code Vote up 5 votes
public void testParseAllExamplesWithoutException() {
    final ExampleLoader exampleLoader = new ExampleLoader(getInstrumentation().getTargetContext());
    final List<String> xmlPaths = exampleLoader.discoverAllXmlFiles();
    Assert.assertNotSame(xmlPaths.size(), 0);
    for (String xmlPath : xmlPaths) {
        final ExampleKey key = exampleLoader.parseKey(xmlPath);
        Assert.assertNotNull(key);
        final ExampleDefinition definition = exampleLoader.parseDefinition(xmlPath);
        Assert.assertNotNull(definition);
    }
}
 
Example 10
Project: flume-release-1.7.0   File: TestAbstractConfigurationProvider.java   View Source Code Vote up 5 votes
@Test
public void testDispoableChannel() throws Exception {
  String agentName = "agent1";
  Map<String, String> properties = getPropertiesForChannel(agentName,
                                                           DisposableChannel.class.getName());
  MemoryConfigurationProvider provider =
      new MemoryConfigurationProvider(agentName, properties);
  MaterializedConfiguration config1 = provider.getConfiguration();
  Channel channel1 = config1.getChannels().values().iterator().next();
  Assert.assertTrue(channel1 instanceof DisposableChannel);
  MaterializedConfiguration config2 = provider.getConfiguration();
  Channel channel2 = config2.getChannels().values().iterator().next();
  Assert.assertTrue(channel2 instanceof DisposableChannel);
  Assert.assertNotSame(channel1, channel2);
}
 
Example 11
Project: flume-release-1.7.0   File: TestAbstractConfigurationProvider.java   View Source Code Vote up 5 votes
@Test
public void testReusableChannelNotReusedLater() throws Exception {
  String agentName = "agent1";
  Map<String, String> propertiesReusable = getPropertiesForChannel(agentName,
                                                                   RecyclableChannel.class
                                                                       .getName());
  Map<String, String> propertiesDispoable = getPropertiesForChannel(agentName,
                                                                    DisposableChannel.class
                                                                        .getName());
  MemoryConfigurationProvider provider =
      new MemoryConfigurationProvider(agentName, propertiesReusable);
  MaterializedConfiguration config1 = provider.getConfiguration();
  Channel channel1 = config1.getChannels().values().iterator().next();
  Assert.assertTrue(channel1 instanceof RecyclableChannel);

  provider.setProperties(propertiesDispoable);
  MaterializedConfiguration config2 = provider.getConfiguration();
  Channel channel2 = config2.getChannels().values().iterator().next();
  Assert.assertTrue(channel2 instanceof DisposableChannel);

  provider.setProperties(propertiesReusable);
  MaterializedConfiguration config3 = provider.getConfiguration();
  Channel channel3 = config3.getChannels().values().iterator().next();
  Assert.assertTrue(channel3 instanceof RecyclableChannel);

  Assert.assertNotSame(channel1, channel3);
}
 
Example 12
Project: EatDubbo   File: AbstractRegistryFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testRegistryFactoryGroupCache() throws Exception {
    Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(registry1, registry2);
}
 
Example 13
Project: EatDubbo   File: AbstractMonitorFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testMonitorFactoryGroupCache() throws Exception {
    Monitor monitor1 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Monitor monitor2 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(monitor1, monitor2);
}
 
Example 14
Project: dubbo2   File: AbstractMonitorFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testMonitorFactoryGroupCache() throws Exception {
    Monitor monitor1 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Monitor monitor2 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(monitor1, monitor2);
}
 
Example 15
Project: dubbo2   File: AbstractRegistryFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testRegistryFactoryGroupCache() throws Exception {
    Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(registry1, registry2);
}
 
Example 16
Project: dubbocloud   File: AbstractMonitorFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testMonitorFactoryGroupCache() throws Exception {
    Monitor monitor1 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Monitor monitor2 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(monitor1, monitor2);
}
 
Example 17
Project: github-test   File: AbstractRegistryFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testRegistryFactoryGroupCache() throws Exception {
    Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(registry1, registry2);
}
 
Example 18
Project: dubbox-hystrix   File: AbstractRegistryFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testRegistryFactoryGroupCache() throws Exception {
    Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(registry1, registry2);
}
 
Example 19
Project: dubbox-hystrix   File: AbstractMonitorFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testMonitorFactoryGroupCache() throws Exception {
    Monitor monitor1 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Monitor monitor2 = monitorFactory.getMonitor(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(monitor1, monitor2);
}
 
Example 20
Project: dubbocloud   File: AbstractRegistryFactoryTest.java   View Source Code Vote up 4 votes
@Test
public void testRegistryFactoryGroupCache() throws Exception {
    Registry registry1 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=aaa"));
    Registry registry2 = registryFactory.getRegistry(URL.valueOf("dubbo://" + NetUtils.getLocalHost() + ":2233?group=bbb"));
    Assert.assertNotSame(registry1, registry2);
}