Search in sources :

Example 16 with CartoonCharacter

use of org.assertj.core.test.CartoonCharacter in project assertj-core by joel-costigliola.

the class Assumptions_assumeThat_with_extracting_Test method setup.

@Before
public void setup() {
    yoda = new Jedi("Yoda", "green");
    luke = new Jedi("Luke", "green");
    jedis = newHashSet(yoda, luke);
    bart = new CartoonCharacter("Bart Simpson");
    lisa = new CartoonCharacter("Lisa Simpson");
    maggie = new CartoonCharacter("Maggie Simpson");
    homer = new CartoonCharacter("Homer Simpson");
    homer.addChildren(bart, lisa, maggie);
    pebbles = new CartoonCharacter("Pebbles Flintstone");
    fred = new CartoonCharacter("Fred Flintstone");
    fred.addChildren(pebbles);
}
Also used : Jedi(org.assertj.core.test.Jedi) CartoonCharacter(org.assertj.core.test.CartoonCharacter) Before(org.junit.Before)

Example 17 with CartoonCharacter

use of org.assertj.core.test.CartoonCharacter in project assertj-core by joel-costigliola.

the class BaseAssumptionsRunnerTest method setupData.

private static void setupData() {
    bart = new CartoonCharacter("Bart Simpson");
    lisa = new CartoonCharacter("Lisa Simpson");
    maggie = new CartoonCharacter("Maggie Simpson");
    homer = new CartoonCharacter("Homer Simpson");
    homer.getChildren().add(bart);
    homer.getChildren().add(lisa);
    homer.getChildren().add(maggie);
    CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
    fred = new CartoonCharacter("Fred Flintstone");
    fred.getChildren().add(pebbles);
    throwingNameExtractor = TolkienCharacter::getName;
    throwingAgeExtractor = TolkienCharacter::getAge;
    nameExtractor = TolkienCharacter::getName;
    ageExtractor = TolkienCharacter::getAge;
    nameExtractorFunction = TolkienCharacter::getName;
    ageExtractorFunction = TolkienCharacter::getAge;
    frodo = TolkienCharacter.of("Frodo", 33, Race.HOBBIT);
    sam = TolkienCharacter.of("Sam", 35, Race.HOBBIT);
    childrenExtractor = CartoonCharacter::getChildren;
}
Also used : CartoonCharacter(org.assertj.core.test.CartoonCharacter) TolkienCharacter(org.assertj.core.data.TolkienCharacter)

Example 18 with CartoonCharacter

use of org.assertj.core.test.CartoonCharacter in project assertj-core by joel-costigliola.

the class SoftAssertionsPerfTest method setup.

@Before
public void setup() {
    softly = new SoftAssertions();
    bart = new CartoonCharacter("Bart Simpson");
    lisa = new CartoonCharacter("Lisa Simpson");
    maggie = new CartoonCharacter("Maggie Simpson");
    homer = new CartoonCharacter("Homer Simpson");
    homer.getChildren().add(bart);
    homer.getChildren().add(lisa);
    homer.getChildren().add(maggie);
    CartoonCharacter pebbles = new CartoonCharacter("Pebbles Flintstone");
    fred = new CartoonCharacter("Fred Flintstone");
    fred.getChildren().add(pebbles);
    List<String> names = asList("Dave", "Jeff");
    LinkedHashSet<String> jobs = newLinkedHashSet("Plumber", "Builder");
    Iterable<String> cities = asList("Dover", "Boston", "Paris");
    int[] ranks = { 1, 2, 3 };
    iterableMap = new LinkedHashMap<>();
    iterableMap.put("name", names);
    iterableMap.put("job", jobs);
    iterableMap.put("city", cities);
    iterableMap.put("rank", ranks);
}
Also used : CartoonCharacter(org.assertj.core.test.CartoonCharacter) SoftAssertions(org.assertj.core.api.SoftAssertions) Before(org.junit.Before)

Example 19 with CartoonCharacter

use of org.assertj.core.test.CartoonCharacter in project assertj-core by joel-costigliola.

the class IterableAssert_flatExtracting_Test method should_allow_assertions_on_joined_lists_when_extracting_children_with_anonymous_class_throwing_extractor.

@Test
public void should_allow_assertions_on_joined_lists_when_extracting_children_with_anonymous_class_throwing_extractor() {
    List<CartoonCharacter> cartoonCharacters = newArrayList(homer, fred);
    assertThat(cartoonCharacters).flatExtracting(new ThrowingExtractor<CartoonCharacter, List<CartoonCharacter>, Exception>() {

        @Override
        public List<CartoonCharacter> extractThrows(CartoonCharacter cartoonCharacter) throws Exception {
            if (cartoonCharacter.getChildren().isEmpty())
                throw new Exception("no children");
            return cartoonCharacter.getChildren();
        }
    }).containsOnly(bart, lisa, maggie, pebbles);
}
Also used : CartoonCharacter(org.assertj.core.test.CartoonCharacter) ExpectedException(org.assertj.core.test.ExpectedException) Test(org.junit.Test)

Example 20 with CartoonCharacter

use of org.assertj.core.test.CartoonCharacter in project assertj-core by joel-costigliola.

the class IterableAssert_flatExtracting_Test method setUp.

@Before
public void setUp() {
    bart = new CartoonCharacter("Bart Simpson");
    lisa = new CartoonCharacter("Lisa Simpson");
    maggie = new CartoonCharacter("Maggie Simpson");
    homer = new CartoonCharacter("Homer Simpson");
    homer.addChildren(bart, lisa, maggie);
    pebbles = new CartoonCharacter("Pebbles Flintstone");
    fred = new CartoonCharacter("Fred Flintstone");
    fred.addChildren(pebbles);
}
Also used : CartoonCharacter(org.assertj.core.test.CartoonCharacter) Before(org.junit.Before)

Aggregations

CartoonCharacter (org.assertj.core.test.CartoonCharacter)20 Before (org.junit.Before)10 Test (org.junit.Test)9 ExpectedException (org.assertj.core.test.ExpectedException)6 ObjectsBaseTest (org.assertj.core.internal.ObjectsBaseTest)3 Person (org.assertj.core.test.Person)3 AtomicReferenceArray (java.util.concurrent.atomic.AtomicReferenceArray)2 ThrowingExtractor (org.assertj.core.api.iterable.ThrowingExtractor)2 Name (org.assertj.core.test.Name)2 SoftAssertions (org.assertj.core.api.SoftAssertions)1 TolkienCharacter (org.assertj.core.data.TolkienCharacter)1 Jedi (org.assertj.core.test.Jedi)1