This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Reliable | |
public void demoFixtureArguments(FixtureExample one, FixtureExample two, FixtureExample three) { | |
System.out.println("demonstrateFixtureArguments(" + one + ", " + two + ", " + three + ")"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Reliable | |
@RuleHandler(ExampleRule.class) | |
public @interface ExampleAnnotation { | |
} | |
@Traceable | |
@RuleHandler(ReliableRule.class) | |
public @interface Reliable { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(JUnitRunner.class) | |
public class DummyTest { | |
@Test | |
@Transactional | |
public void testTest() { | |
assertTrue(false); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DummyTest { | |
@Rule | |
public IgnoreLeadingFailure ilf = new IgnoreLeadingFailure(); | |
@Test | |
public void testTest() { | |
assertTrue(false); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
demonstrateFixtureArguments(0, 0, 0) | |
demonstrateFixtureArguments(1, 0, 0) | |
demonstrateFixtureArguments(0, 1, 0) | |
demonstrateFixtureArguments(1, 1, 0) | |
demonstrateFixtureArguments(0, 0, 1) | |
demonstrateFixtureArguments(1, 0, 1) | |
demonstrateFixtureArguments(0, 1, 1) | |
demonstrateFixtureArguments(1, 1, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(JUnitRunner.class) | |
public class JUnitRunnerDemoTest { | |
@Test | |
public void demoFixtureArguments(FixtureExample one, FixtureExample two, FixtureExample three) { | |
System.out.println("demonstrateFixtureArguments(" + one + ", " + two + ", " + three + ")"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InMemoryStorage storage = new InMemoryStorage(); | |
// add a few Item.class objects to storage | |
Criteria middleprice = field("price").is(largerThan(100)).and(lessThan(200)); | |
Criteria expired = field("expires").is(after(currentDate)); | |
Collection<Item> result = storage.select(middleprice.and(not(expired))).from(Item.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function currencyConverter = new Function<Double, Item>() { | |
@Override | |
public Double apply(Item item) { | |
return item.getPrice() * ANOTHER_CURRENCY; | |
} | |
} | |
Collection<Double> prices = Collections2.transform(order, currencyConverter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Predicate<Item> heavyItemPolicy = new Predicate<Item>() { | |
@Override | |
public boolean apply(Item item) { | |
if(item.getWeight() > 1000){ | |
return true; | |
} | |
return false; | |
} | |
}; | |
Collection<Item> heavyItems = Collections2.filter(order, heavyItemPolicy); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Voyage { | |
private Country targetcountry; | |
private int capacity; | |
private List<Cargo> items = Constraints.constrainedList(new ArrayList<Cargo>(), new Constraint<Cargo>() { | |
@Override | |
public Cargo checkElement(Cargo cargo) { | |
Preconditions.checkNotNull(cargo); | |
Preconditions.checkArgument(targetcountry.allows(cargo)); | |
Preconditions.checkArgument(cargo.getUnits() > 0); | |
return cargo; |