Package com.github.jmkgreen.morphia.testutil

Examples of com.github.jmkgreen.morphia.testutil.AssertedFailure


        assertEquals(borg.getAddress().getPostCode(), hotelLoaded.getAddress().getPostCode());
    }
 
  @Test
  public void testAuthentication() throws Exception {
    new AssertedFailure(AuthenticationException.class) {
     
      @Override
      protected void thisMustFail() throws Throwable {
        morphia.createDatastore(mongo, TestDatastore.this.db.getName(),
            "SomeWeirdUserName" + System.nanoTime(),
View Full Code Here


  @Test
  public void testFieldNameOf() throws Exception {
    String name = "foo";
    Assert.assertTrue("foo".equals(FieldName.of("foo")));
    Assert.assertTrue("bar".equals(FieldName.of("bar")));
    new AssertedFailure(FieldName.FieldNameNotFoundException.class) {

      @Override
      protected void thisMustFail() throws Throwable {
        FieldName.of("buh");
      }
View Full Code Here

    }

   
    @Test
    public void testReferenceWithoutIdValue() throws Exception {
    new AssertedFailure(MappingException.class) {
      public void thisMustFail() throws Throwable {
            RecursiveParent parent = new RecursiveParent();
            RecursiveChild child = new RecursiveChild();
            child.setId(null);
            parent.setChild(child);
View Full Code Here

  }

  @Test
  public void testInvalidVersionUse() throws Exception {
    new AssertedFailure(ConstraintViolationException.class) {
      public void thisMustFail() throws Throwable {
        morphia.map(InvalidVersionUse.class);
      }
    };
View Full Code Here

    ALongPrimitive a2 = ds.get(a);
    ds.save(a2);


    new AssertedFailure(ConcurrentModificationException.class) {
      public void thisMustFail() throws Throwable {
        ds.save(a1);
      }
    };
  }
View Full Code Here

    final ALong a1 = a;

    ALong a2 = ds.get(a);
    ds.save(a2);

    new AssertedFailure(ConcurrentModificationException.class) {
      public void thisMustFail() throws Throwable {
        ds.save(a1);
      }
    };
  }
View Full Code Here

        a1.text = " foosdfds ";
        ALong a2 = ds.get(a);
        ds.save(a2);

        new AssertedFailure(ConcurrentModificationException.class) {
            public void thisMustFail() throws Throwable {
                ds.merge(a1);
            }
        };
    }
View Full Code Here

    String foo = "bar";
  }
 
  @Test
  public final void testMissingId() {
    new AssertedFailure() {
     
      @Override
      protected void thisMustFail() throws Throwable {
        morphia.map(E.class);
      }
View Full Code Here

 
  @Test
  public final void testMissingIdNoImplicitMapCall() {
    final Key<E> save = ds.save(new E());
   
    new AssertedFailure() {
      @Override
      protected void thisMustFail() throws Throwable {
        E byKey = ds.getByKey(E.class, save);
      }
    };
View Full Code Here

    e.equal(null);
    e.notEqual(null);
    e.hasThisOne(null);
   
    // have to fail:
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.greaterThan(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.greaterThanOrEq(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.hasAllOf(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.hasAnyOf(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.hasNoneOf(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.hasThisElement(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.lessThan(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.lessThanOrEq(null);
      }
    };
   
    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.startsWith(null);
      }
    };

    new AssertedFailure() {
      public void thisMustFail() throws Throwable {
        e.startsWithIgnoreCase(null);
      }
    };
  }
View Full Code Here

TOP

Related Classes of com.github.jmkgreen.morphia.testutil.AssertedFailure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.