APISonar


org.junit.Assert.assertSame

> org > junit > Assert > assertSame
org APIs junit APIs Assert APIs assertSame APIs

Example 1
protected void assertSame(Object expected, Object actual) {
    checkThread();
    try {
      Assert.assertSame(expected, actual);
    } catch (AssertionError e) {
      handleThrowable(e);
    }
  }
Example 2
public void threadAssertSame(Object x, Object y) {
        try {
            Assert.assertSame(x, y);
        } catch (AssertionFailedError t) {
            threadRecordFailure(t);
            throw t;
        }
    }
Example 3
protected <T> T serialClone(T o) {
        try {
            ObjectInputStream ois = new ObjectInputStream
                    (new ByteArrayInputStream(serialBytes(o)));
            T clone = (T) ois.readObject();
            Assert.assertSame(o.getClass(), clone.getClass());
            return clone;
        } catch (Throwable t) {
            threadUnexpectedException(t);
            return null;
        }
    }
Example 4
public void inputParameters() {
    Object inputParameters = new Object();
    context.setInputParameters(inputParameters);

    Assert.assertSame(inputParameters, context.getInputParameters());
  }
Example 5
public void testNewInstance() {

        try {
            Attribute testAttribute = new Attribute(attrName, attrValue);
            Assert.assertNotNull(testAttribute.getName());
            Assert.assertSame(testAttribute.getName(), attrName);
            Assert.assertNotNull(testAttribute.getValue());
            Assert.assertSame(testAttribute.getValue(), attrValue);

        } catch (Exception e) {
            Assert.fail("Unexpected Exception " + e.getMessage());
        }
    }
Example 6
public void getReturnsOriginalObjectForIdenticalObject()
    {
        Integer firstPooledObject = 1;
        this.staticPool.put(firstPooledObject);
        Assert.assertSame(firstPooledObject, this.staticPool.get(firstPooledObject));
    }
Example 7
public void testGetBodyBuffer() {
    Assert.assertNull(impl.getBodyBuffer());

    Buffer bodyBuffer = Buffer.buffer();
    impl.setBodyBuffer(bodyBuffer);

    Assert.assertSame(bodyBuffer, impl.getBodyBuffer());
  }
Example 8
public void postProcessAfterInitialization() {
    Object bean = new Object();
    Assert.assertSame(bean, consumers.postProcessAfterInitialization(bean, "test"));
  }
Example 9
public void testConsumerErrorPassedToProducer2() throws Exception {
    RuntimeException consumerError = new RuntimeException();
    consumer.error(consumerError);
    Assert.assertSame(consumerError, getError(put(1)));
  }
Example 10
private void expectException(Class<? extends Exception> exception, Callable<DataInfo> command)
    {
        try
        {
            command.call();
            Assert.fail();
        }
        catch (Exception x)
        {
            Assert.assertSame(exception, x.getClass());
        }
    }
Example 11
public void testResolveClassPrimitiveArray() throws Exception {
        DeserializationObjectInputStream ois = createResolveClassStream();
        Assert.assertSame(boolean[].class, ois.resolveClass("[Z"));
        Assert.assertSame(boolean[][][].class, ois.resolveClass("[[[Z"));
        Assert.assertSame(byte[].class, ois.resolveClass("[B"));
        Assert.assertSame(short[].class, ois.resolveClass("[S"));
        Assert.assertSame(char[].class, ois.resolveClass("[C"));
        Assert.assertSame(int[].class, ois.resolveClass("[I"));
        Assert.assertSame(float[].class, ois.resolveClass("[F"));
        Assert.assertSame(long[].class, ois.resolveClass("[J"));
        Assert.assertSame(double[].class, ois.resolveClass("[D"));
    }
Example 12
public void testURINodeAsResource()
	{
		final Node n = GraphTestBase.node("a");
		final Resource r = model.wrapAsResource(n);
		Assert.assertSame(n, r.asNode());
	}
Example 13
private static void assertSame(Iterator<Integer> i1, Iterator<Integer> i2)
    {
        while (i1.hasNext() && i2.hasNext())
            Assert.assertSame(i1.next(), i2.next());
        Assert.assertEquals(i1.hasNext(), i2.hasNext());
    }
Example 14
public static void testBooleanSnippet() {
        Object[] values = {true, false, new Exception()};
        GraalDirectives.deoptimize();
        Assert.assertSame(values[0], Boolean.valueOf(true));
        Assert.assertSame(values[1], Boolean.valueOf(false));
    }
Example 15
public void testHostFromUrl_ErrorTest() {
        String nullUrl = NetworkUtils.getHostFromURL(null);
        Assert.assertSame(nullUrl, null);

        String emptyUrl = NetworkUtils.getHostFromURL("");
        Assert.assertSame(emptyUrl, null);
    }
Example 16
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 17
public void testGenerateCertificateRequest() throws Exception {
        KeyPair testKeyPair = crypto.keyGen();
        Assert.assertSame(String.class, crypto.generateCertificationRequest("common name", testKeyPair).getClass());
    }
Example 18
public void testGetClassLoader1() throws Exception {
        final Thread thread = Thread.currentThread();
        final ClassLoader contextClassLoader = thread.getContextClassLoader();

        ClassLoader classLoader = ClassLoaderUtils.getDefaultClassLoader();

        Assert.assertSame(contextClassLoader, classLoader);
    }
Example 19
public void testModuleRecreation2() {
    final Language[] l = new Language[1];
    getModelAccess().runWriteAction(new Runnable() {
      @Override
      public void run() {
        l[0] = createLanguage();
        addClassTo(l[0]);
        l[0].reload();
        Assert.assertTrue(classIsLoadableFromModule(l[0]));
        removeModule(l[0]);
      }
    });
    Assert.assertSame(l[0].getClassLoader(), defaultCL());
  }
Example 20
public void testGet() {
    ByteTypeSupport ts = new ByteTypeSupport();
    Byte o = 1;
    Assert.assertSame(o, ts.get(o));
  }
Example 21
public void testGet() {
    StringTypeSupport ts = new StringTypeSupport();
    String o = "s";
    Assert.assertSame(o, ts.get(o));
  }
Example 22
public static void assertSame(final java.lang.Object object, final java.lang.Object object1) {
      try {
         Assert.assertSame(object, object1);
      } catch (AssertionError e) {
         ProxyAssertSupport.log.warn("AssertionFailure::" + e.toString(), e);
         throw e;
      }
   }
Example 23
public void getSortedAcceptableMimeTypesNull() {
    List<String> types = MimeTypesUtils.getSortedAcceptableMimeTypes(null);
    Assert.assertSame(Collections.emptyList(), types);
  }
Example 24
public void getGroupId() {
        String groupId = "group";
        when(this.entry.getGroupId()).thenReturn(groupId);
        String result = this.bean.getGroupId();
        Assert.assertSame(groupId, result);
    }
Example 25
public void getOrCreateEnumWithClassName_get() {
    Class<?> cls = Status.class;

    Assert.assertSame(cls,
        JavassistUtils.getOrCreateEnumWithClassName(Thread.currentThread().getContextClassLoader(),
            Status.class.getName(),
            null));
  }