Skip to content

Commit 4aa5f7f

Browse files
author
Grzegorz Piwowarek
committed
Add second set of assertions
1 parent a871f25 commit 4aa5f7f

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.baeldung.assertj.domain;
2+
3+
public class Person {
4+
private String name;
5+
private Integer age;
6+
7+
public Person(String name, Integer age) {
8+
this.name = name;
9+
this.age = age;
10+
}
11+
12+
public String getName() {
13+
return name;
14+
}
15+
16+
public Integer getAge() {
17+
return age;
18+
}
19+
}

‎assertj-introduction/src/test/java/com/baeldung/assertj/AssertJDemoTest.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.baeldung.assertj;
22

33
import com.baeldung.assertj.domain.Dog;
4+
import com.baeldung.assertj.domain.Person;
5+
import org.junit.Ignore;
46
import org.junit.Test;
57

68
import java.util.Arrays;
@@ -62,4 +64,14 @@ public void whenAssigningNSEExToException_thenIsAssignable() throws Exception {
6264
public void whenComparingWithOffset_thenEquals() throws Exception {
6365
assertThat(5.1).isEqualTo(5, withPrecision(1d));
6466
}
67+
68+
@Ignore // IN ORDER TO TEST, REMOVE THIS LINE
69+
@Test
70+
public void whenRunningAssertion_thenDescribed() throws Exception {
71+
Person person = new Person("Alex", 34);
72+
73+
assertThat(person.getAge())
74+
.as("%s's age should be equal to 100")
75+
.isEqualTo(100);
76+
}
6577
}

0 commit comments

Comments
 (0)