Add new tag Agil Buzz Google Wave databas DDD design design presentation design principle dto ejb3 extjs frameworks google google-collections hibernate Java javascript JSR 305 links Mind ORM pattern process scrum selenium Tdd team test transform web application
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.
“software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification” — Meyer, Bertrand (1988). Object-Oriented Software Construction.
“software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”
Username:
Password:
Remember me
Vad tycker du om Buzz?
View Results
//Given
Currency sek = Currency.getInstance("sek");
Long id = new Long(1L);
Campaign campaign = aCampaign(id).andCurrency(sek).
withBudget(aLimit(100L).withEvent(aEvent().asClick())
.withPrice(50D).build()
public Person(final Long id, final String name, final Integer age) {
Preconditions.checkArgument(id != null);
}
public void setNames(List<String> names){
Preconditions.checkContentsNotNull(names,"A null name was in the Collection!");
this.names = names;
package functions;
import com.google.common.base.Function;
import domain.Person;
public final class TransformFunctionPersonToId implements Function
{
@Override
public Long apply(final Person personToTransform) {
return personToTransform != null ? personToTransform.getId() : null;
@Test
public void testShouldTransformListOfPersonToListOfLong(){
Person one = new Person(1L,"pär",12);
Person two = new Person(2L,"eno",22);
Person tree = new Person(3L,"leo",32);
Person four = new Person(4L,"pia",42);
List
persons = new ArrayList
();
persons.add(one);
persons.add(two);
persons.add(tree);
persons.add(four);
//When
List<Long> personIdList =
Lists.transform(persons, new TransformFunctionPersonToId());
//Then
Long test = 1L;
for(Long id : personIdList){
System.out.println("ID: "+id);
Assert.assertEquals(id.longValue(),(test++));