Ejemplo n.º 1
0
  @Test
  public void listGreetings_eventualConsistency_returnsPartialGreetings() {
    // Arrange
    guestbookUnderTest.appendGreeting("Hello, Datastore!");
    guestbookUnderTest.appendGreeting("Hello, Eventual Consistency!");
    guestbookUnderTest.appendGreeting("Hello, World!");
    guestbookUnderTest.appendGreeting("Güten Tag!");

    // Act
    List<Greeting> got = guestbookUnderTest.listGreetings();

    // The first time we query we should half of the results due to the fact that we simulate
    // eventual consistency by applying every other write.
    assertThat(got).hasSize(2);
  }
Ejemplo n.º 2
0
  @Test
  public void listGreetings_groomedDatastore_returnsAllGreetings() {
    // Arrange
    guestbookUnderTest.appendGreeting("Hello, Datastore!");
    guestbookUnderTest.appendGreeting("Hello, Eventual Consistency!");
    guestbookUnderTest.appendGreeting("Hello, World!");

    // Act
    guestbookUnderTest.listGreetings();
    // Second global query sees both Entities because we "groom" (attempt to
    // apply unapplied jobs) after every query.
    List<Greeting> got = guestbookUnderTest.listGreetings();

    assertThat(got).hasSize(3);
  }
Ejemplo n.º 3
0
  @Test
  public void appendGreeting_normalData_setsContentProperty() {
    Greeting got = guestbookUnderTest.appendGreeting("Hello, Datastore!");

    assertThat(got.getContent()).named("content property").isEqualTo("Hello, Datastore!");
  }