APISonar


org.junit.Assert.assertNotSame

> org > junit > Assert > assertNotSame
org APIs junit APIs Assert APIs assertNotSame APIs

Example 1
protected void assertNotSame(String message, Object unexpected, Object actual) {
    checkThread();
    try {
      Assert.assertNotSame(message, unexpected, actual);
    } catch (AssertionError e) {
      handleThrowable(e);
    }
  }
Example 2
public void lastItemId_tableLastItemRemoved_resultChanges()
            throws SQLException {
        Object last = container.lastItemId();

        assertTrue(container.removeItem(last));
        Assert.assertNotSame(last, container.lastItemId());
    }
Example 3
public void testKeys() {
    Object obj1 = pool.get("a");
    Object obj2 = pool.get(new String("a"));

    Assert.assertSame(obj1, obj2);

    Object obj3 = pool.get("b");

    Assert.assertNotSame(obj1, obj3);
  }
Example 4
public void onFlushDirty_shouldBeCalledWhenSavingAnAuditable() throws Exception {
		User u = Context.getUserService().getUser(1);
		
		u.setUsername("asdf");
		
		Date beforeDate = u.getDateChanged();
		
		Context.getUserService().saveUser(u, null);
		
		Date afterDate = u.getDateChanged();
		
		Assert.assertNotSame(beforeDate, afterDate);
	}
Example 5
public static void assertNotSame(final java.lang.Object object, final java.lang.Object object1) {
      try {
         Assert.assertNotSame(object, object1);
      } catch (AssertionError e) {
         ProxyAssertSupport.log.warn("AssertionFailure::" + e.toString(), e);
         throw e;
      }
   }
Example 6
private void checkCopy(Object original, Object copy, boolean notSame) {
    if (notSame)
      Assert.assertNotSame(original, copy);
    Assert.assertEquals(original, copy);
  }
Example 7
public void testNoCrossTenantResults() throws Exception {
        List<SearchResult> results = elasticIO.search(TENANT_A, "*");
        assertEquals(NUM_DOCS, results.size());
        for (SearchResult result : results) {
            Assert.assertNotNull(result.getTenantId());
            Assert.assertNotSame(TENANT_B, result.getTenantId());
        }
    }
Example 8
public void testGetMachineName2() {
        String machineName = NetworkUtils.getMachineName();
        Assert.assertNotSame(machineName, NetworkUtils.ERROR_HOST_NAME);
    }
Example 9
public void testGetHostName() {
        String hostName = NetworkUtils.getHostName();
        Assert.assertNotSame(hostName, NetworkUtils.ERROR_HOST_NAME);
    }
Example 10
public void testMiniKdcStart() {
    MiniKdc kdc = getKdc();
    Assert.assertNotSame(0, kdc.getPort());
  }
Example 11
public void testMyInitPojo() throws Exception {

        MyInitPojo pojo = podam.manufacturePojo(MyInitPojo.class);
        Assert.assertNotNull(pojo);
        Assert.assertNotSame(pojo.getString1(), pojo.getBackupString1());
        Assert.assertNotSame(pojo.getString2(), pojo.getBackupString2());


    }
Example 12
public String intercept(ActionInvocation invocation) throws Exception {
        executed = true;
        Assert.assertNotSame(DEFAULT_FOO_VALUE, foo);
        Assert.assertEquals(expectedFoo, foo);

        return invocation.invoke();
    }
Example 13
public void equals_shouldNotBeTheSameReference() {
		Concept c = new Concept(123);
		ConceptNumeric cn = new ConceptNumeric(c);
		
		Assert.assertNotSame(c.getAnswers(), cn.getAnswers());
		Assert.assertNotSame(c.getConceptSets(), cn.getConceptSets());
		Assert.assertNotSame(cn.getConceptSets(), c.getConceptSets());
		Assert.assertNotSame(c.getNames(), cn.getNames());
		Assert.assertNotSame(c.getConceptMappings(), cn.getConceptMappings());
		Assert.assertNotSame(c.getDescriptions(), cn.getDescriptions());
	}
Example 14
public void getSortedProbes_whenProbeAdded() {
        List<ProbeInstance> instances1 = metricsRegistry.getSortedProbeInstances();

        registerLongMetric("foo", 10);

        List<ProbeInstance> instances2 = metricsRegistry.getSortedProbeInstances();

        Assert.assertNotSame(instances1, instances2);
    }
Example 15
public void shouldNotPoolReadOnlyBuffer() {
      final int size = 32;
      final ByteBuffer borrow = pool.borrow(size, zeroed);
      final ByteBuffer readOnlyBuffer = borrow.asReadOnlyBuffer();
      pool.release(readOnlyBuffer);
      Assert.assertNotSame(readOnlyBuffer, pool.borrow(size, zeroed));
   }
Example 16
public void shouldBorrowNewBufferIfExceedPooledCapacity() {
      final int size = 32;
      final ByteBuffer buffer = pool.borrow(size, zeroed);
      pool.release(buffer);
      final int newSize = buffer.capacity() + 1;
      final ByteBuffer differentBuffer = pool.borrow(newSize, zeroed);
      Assert.assertNotSame(buffer, differentBuffer);
   }
Example 17
public void testSignature() throws Exception {
    Signer signer = new Signer("secret".getBytes());
    String s1 = signer.sign("ok");
    String s2 = signer.sign("ok");
    String s3 = signer.sign("wrong");
    Assert.assertEquals(s1, s2);
    Assert.assertNotSame(s1, s3);
  }
Example 18
public void testTokenProbMinScore() throws Exception {
    Sequence[] preds = chunker.topKSequences(toks1, tags1, -5.55);

    Assert.assertEquals(4, preds.length);
    Assert.assertEquals(expect1.length, preds[0].getProbs().length);
    Assert.assertEquals(Arrays.asList(expect1), preds[0].getOutcomes());
    Assert.assertNotSame(Arrays.asList(expect1), preds[1].getOutcomes());
  }
Example 19
public void createMetrics() {
    Map<Object, Object> instances = new IdentityHashMap<>();
    instances.put(metrics_listen1_server1, null);
    instances.put(metrics_listen1_server2, null);
    instances.put(metrics_listen2_server1, null);
    instances.put(metrics_listen2_server2, null);
    Assert.assertEquals(4, instances.size());

    Assert.assertSame(metrics_listen1_server1.getEndpointMetric(), metrics_listen1_server2.getEndpointMetric());
    Assert.assertNotSame(metrics_listen1_server1.getEndpointMetric(), metrics_listen2_server1.getEndpointMetric());
    Assert.assertSame(metrics_listen2_server1.getEndpointMetric(), metrics_listen2_server2.getEndpointMetric());
  }
Example 20
private void assertNextElements_Expected_ExceptionEmulation(Enumeration<String> elements, DelegateEnumeration<String> delegateEnumeration) {
        Exception original = getException(elements);
        Assert.assertNotSame(original, null);

        Exception delegate = getException(delegateEnumeration);
        Assert.assertNotSame(delegate, null);

        Assert.assertEquals(original.getClass(), delegate.getClass());
        Assert.assertEquals(original.getMessage(), delegate.getMessage());
        Assert.assertEquals(original.getCause(), delegate.getCause());
    }
Example 21
public void testThisIsNotAnArrayList()
    {
        ThisIsNotAnArrayList<Integer> undertest = new ThisIsNotAnArrayList<>(FastList.newListWith(1, 2, 3));
        Assert.assertNotSame(undertest.getClass(), ArrayList.class);
    }
Example 22
public void getProviderByIdentifier_shouldGetAProviderMatchingTheSpecifiedIdentifierIgnoringCase() {
		String identifier = "8a760";
		Provider provider = service.getProviderByIdentifier(identifier);
		Assert.assertEquals("a2c3868a-6b90-11e0-93c3-18a905e044dc", provider.getUuid());
		//ensures that the case sensitive test stays valid just in case 
		//the test dataset is edited and the case is changed
		Assert.assertNotSame(identifier, provider.getIdentifier());
	}
Example 23
public void testEquals() throws Exception {
        Connection con1 = datasource.getConnection();
        Connection real1 = ((PooledConnection)con1).getConnection();
        Assert.assertEquals(con1, con1);
        con1.close();
        Assert.assertEquals(con1, con1);
        Connection con2 = datasource.getConnection();
        Connection real2 = ((PooledConnection)con2).getConnection();
        Assert.assertEquals(real1,real2);
        Assert.assertEquals(con2, con2);
        Assert.assertNotSame(con1, con2);
        con2.close();
        Assert.assertEquals(con2, con2);
    }
Example 24
void assertNoReferencesKept(T aDisposable) {
    Assert.assertNotSame(getObject(), aDisposable);
    if (myChildren != null) {
      for (ObjectNode<T> node: myChildren) {
        node.assertNoReferencesKept(aDisposable);
      }
    }
  }
Example 25
public void serializeDeserializeSuccess()
    {
        String input = "Test";
        String output = SerializeTestHelper.serializeDeserialize(input);
        Assert.assertEquals(input, output);
        Assert.assertNotSame(input, output);
    }