@Test
  public void testBasic() {

    // ref count = 1 after creation
    SharedReference<Thing> tRef = new SharedReference<Thing>(new Thing("abc"), THING_RELEASER);
    Assert.assertTrue(SharedReference.isValid(tRef));
    Assert.assertEquals(1, tRef.getRefCountTestOnly());
    Thing t = tRef.get();
    Assert.assertEquals("abc", t.get());

    // adding a reference increases the ref count
    tRef.addReference();
    Assert.assertTrue(SharedReference.isValid(tRef));
    Assert.assertEquals(2, tRef.getRefCountTestOnly());
    Assert.assertEquals(t, tRef.get());
    Assert.assertEquals("abc", t.get());

    // deleting a reference drops the reference count
    tRef.deleteReference();
    Assert.assertTrue(SharedReference.isValid(tRef));
    Assert.assertEquals(1, tRef.getRefCountTestOnly());
    Assert.assertEquals(t, tRef.get());
    Assert.assertEquals("abc", t.get());

    // when the last reference is gone, the underlying object is disposed
    tRef.deleteReference();
    Assert.assertFalse(SharedReference.isValid(tRef));
    Assert.assertEquals(0, tRef.getRefCountTestOnly());

    // adding a reference now should fail
    try {
      tRef.addReference();
      Assert.fail();
    } catch (SharedReference.NullReferenceException e) {
      // do nothing
    }

    // so should deleting a reference
    try {
      tRef.deleteReference();
      Assert.fail();
    } catch (SharedReference.NullReferenceException e) {
      // do nothing
    }

    // null shared references are not 'valid'
    Assert.assertFalse(SharedReference.isValid(null));

    // test out exceptions during a close
    SharedReference<Thing> t2Ref = new SharedReference<Thing>(new Thing2("abc"), THING_RELEASER);
    // this should not throw
    t2Ref.deleteReference();
  }
Tests out the basic operations (isn't everything a basic operation?)
fbcore/src/test/java/com/facebook/common/references/SharedReferenceTest.java