Add second set of assertions
This commit is contained in:
parent
a871f2558f
commit
4aa5f7f30c
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue