Java Code Examples for org.testng.AssertJUnit#assertNotSame()

The following examples show how to use org.testng.AssertJUnit#assertNotSame() . 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: TestZNRecord.java    From helix with Apache License 2.0 6 votes vote down vote up
@Test
public void testEquals() {
  ZNRecord record1 = new ZNRecord("id");
  record1.setSimpleField("k1", "v1");
  record1.setMapField("m1", new HashMap<String, String>());
  record1.getMapField("m1").put("k1", "v1");
  record1.setListField("l1", new ArrayList<String>());
  record1.getListField("l1").add("v1");
  ZNRecord record2 = new ZNRecord("id");
  record2.setSimpleField("k1", "v1");
  record2.setMapField("m1", new HashMap<String, String>());
  record2.getMapField("m1").put("k1", "v1");
  record2.setListField("l1", new ArrayList<String>());
  record2.getListField("l1").add("v1");

  AssertJUnit.assertEquals(record1, record2);
  record2.setSimpleField("k2", "v1");
  AssertJUnit.assertNotSame(record1, record2);
}
 
Example 2
Source File: TestRawZkClient.java    From helix with Apache License 2.0 6 votes vote down vote up
@Test()
void testGetStat() {
  String path = "/tmp/getStatTest";
  _zkClient.deleteRecursively(path);

  Stat stat, newStat;
  stat = _zkClient.getStat(path);
  AssertJUnit.assertNull(stat);
  _zkClient.createPersistent(path, true);

  stat = _zkClient.getStat(path);
  AssertJUnit.assertNotNull(stat);

  newStat = _zkClient.getStat(path);
  AssertJUnit.assertEquals(stat, newStat);

  _zkClient.writeData(path, "Test");
  newStat = _zkClient.getStat(path);
  AssertJUnit.assertNotSame(stat, newStat);
}
 
Example 3
Source File: OfflineDataProcessingExecutorTest.java    From Insights with Apache License 2.0 5 votes vote down vote up
/**
    * Negative test case for updateLastExecutionTime() method
    */
   @Test
public void testUpdateLastExecutionTimeNegative() {
   	DataEnrichmentModel dataEnrichmentModel = new DataEnrichmentModel();
   	dataEnrichmentModel.setLastExecutionTime("2018/07/16 12:53 PM");
   	DataEnrichmentModel resultModel = executor.updateLastExecutionTime(dataEnrichmentModel);
   	String randomTime = "2018/07/16 05:50 PM";
   	AssertJUnit.assertNotSame(randomTime, resultModel.getLastExecutionTime());    	
   }
 
Example 4
Source File: OfflineDataProcessingExecutorTest.java    From Insights with Apache License 2.0 4 votes vote down vote up
/**
    * Negative test case for executeOfflineProcessing()
    * Checks no. of json files inside  data-enrichment folder
    */
   @Test
public void testExecuteOfflineProcessingNegative() {
   	AssertJUnit.assertNotSame(6, executor.executeOfflineProcessing());		
}
 
Example 5
Source File: AggregationFilterTestCase.java    From siddhi with Apache License 2.0 4 votes vote down vote up
@Test(dependsOnMethods = {"aggregationFilterTestCase5"})
public void aggregationFilterTestCase6() throws InterruptedException {
    LOG.info("AggregationFilterTestCase5");
    SiddhiManager siddhiManager = new SiddhiManager();
    String stockStream =
            "define stream stockStream (symbol string, price float, lastClosingPrice float, volume long , " +
                    "quantity int, timestamp long);";
    String query =
            "@purge(enable='false')" +
            "define aggregation stockAggregation " +
            "from stockStream " +
            "select symbol, avg(price) as avgPrice, sum(price) as totalPrice, " +
            "(price * quantity) as lastTradeValue  " +
            "group by symbol " +
            "aggregate every sec...min ;";

    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(stockStream + query);

    InputHandler stockStreamInputHandler = siddhiAppRuntime.getInputHandler("stockStream");
    siddhiAppRuntime.start();

    stockStreamInputHandler.send(new Object[]{"WSO2", 50f, 60f, 90L, 6, 1496289950000L});
    stockStreamInputHandler.send(new Object[]{"WSO2", 70f, null, 40L, 10, 1496289950000L});
    Thread.sleep(2000);

    stockStreamInputHandler.send(new Object[]{"WSO2", 60f, 44f, 200L, 56, 1496289952000L});
    stockStreamInputHandler.send(new Object[]{"WSO2", 100f, null, 200L, 16, 1496289952000L});
    Thread.sleep(2000);

    stockStreamInputHandler.send(new Object[]{"IBM", 100f, null, 200L, 26, 1496289954000L});
    stockStreamInputHandler.send(new Object[]{"IBM", 100f, null, 200L, 96, 1496289954000L});
    Thread.sleep(5000);

    LocalDate currentDate = LocalDate.now();
    String year = String.valueOf(currentDate.getYear());
    String month = String.valueOf(currentDate.getMonth().getValue());
    if (month.length() == 1) {
        month = "0".concat(month);
    }

    Event[] events = siddhiAppRuntime.query("from stockAggregation " +
            "on symbol == \"WSO2\" " +
            "within \"" + year + "-" + month + "-** **:**:** +05:30\" " +
            "per \"seconds\" " +
            "select avgPrice " +
            "group by symbol; ");

    EventPrinter.print(events);
    AssertJUnit.assertNotNull(events);
    AssertJUnit.assertEquals(1, events.length);

    AssertJUnit.assertNotSame("Wrong average expected!", events[0].getData()[0], 70.0);
    Thread.sleep(100);
    siddhiAppRuntime.shutdown();
}