Add second set of assertions

This commit is contained in:
Grzegorz Piwowarek 2016-06-21 20:14:22 +02:00
parent a871f2558f
commit 4aa5f7f30c
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package com.baeldung.assertj.domain;
public class Person {
private String name;
private Integer age;
public Person(String name, Integer age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public Integer getAge() {
return age;
}
}

View File

@ -1,6 +1,8 @@
package com.baeldung.assertj;
import com.baeldung.assertj.domain.Dog;
import com.baeldung.assertj.domain.Person;
import org.junit.Ignore;
import org.junit.Test;
import java.util.Arrays;
@ -62,4 +64,14 @@ public class AssertJDemoTest {
public void whenComparingWithOffset_thenEquals() throws Exception {
assertThat(5.1).isEqualTo(5, withPrecision(1d));
}
@Ignore // IN ORDER TO TEST, REMOVE THIS LINE
@Test
public void whenRunningAssertion_thenDescribed() throws Exception {
Person person = new Person("Alex", 34);
assertThat(person.getAge())
.as("%s's age should be equal to 100")
.isEqualTo(100);
}
}