private void assertAreEqual(Object expected, Object actual) {
   if (new Short(Short.MAX_VALUE).equals(expected) && db4oHandlerVersion() == 0) {
     // Bug in the oldest format: It treats Short.MAX_VALUE as null.
     expected = null;
   }
   Assert.areEqual(expected, actual);
 }
 private void assertAreEqual(short expected, short actual) {
   if (expected == Short.MAX_VALUE && db4oHandlerVersion() == 0) {
     // Bug in the oldest format: It treats Short.MAX_VALUE as null.
     expected = 0;
   }
   Assert.areEqual(expected, actual);
 }
  protected void assertValues(ExtObjectContainer objectContainer, Object[] values) {
    for (int i = 0; i < data.length; i++) {
      Item item = (Item) values[i];
      assertAreEqual(data[i], item._typedPrimitive);
      assertAreEqual(new Short(data[i]), item._typedWrapper);
      assertAreEqual(new Short(data[i]), item._untyped);
    }

    Item nullItem = (Item) values[values.length - 1];
    assertAreEqual((short) 0, nullItem._typedPrimitive);
    assertPrimitiveWrapperIsNullJavaOnly(nullItem._typedWrapper);
    Assert.isNull(nullItem._untyped);
  }
예제 #4
0
  public void _testKillingClients() throws InterruptedException {

    final int CLIENT_COUNT = 3;

    final StringBuffer results = new StringBuffer();

    ThreadServices.spawnAndJoin(
        "ClientProcessesTestCase.testKillingClients",
        CLIENT_COUNT,
        new CodeBlock() {
          public void run() throws Throwable {
            results.append(
                JavaServices.startAndKillJavaProcess(
                    clientRunnerCommand(), CLIENT_STARTED_OK, 10000));
          }
        });

    Assert.areEqual(1, connectedClients());
    System.out.println(results);
  }
예제 #5
0
 private void assertInstanceOK(ABar bar) {
   Assert.areEqual("foo", bar.foo);
   Assert.areEqual("bar", bar.bar);
 }
예제 #6
0
 private void asserItemCount(final int expectedCount) {
   Query query = db().query();
   query.constrain(Item.class);
   int itemCount = query.execute().size();
   Assert.areEqual(expectedCount, itemCount);
 }