Browse Source

Added: Change Date of Birthday

feature-pr/user
Maxim Volkov 3 years ago
parent
commit
b1cda58c66
  1. 12
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Birthdate.java
  2. 22
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/BirthdateTest.java

12
projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Birthdate.java

@ -10,6 +10,18 @@ public class Birthdate {
month = m; month = m;
year = y; year = y;
} }
public int getDay() {
return day;
}
public int getMonth() {
return month;
}
public int getYear() {
return year;
}
/** /**
* @return Date Format TT.DD.YYYY * @return Date Format TT.DD.YYYY

22
projjpn/src/test/java/de/hs_fulda/ciip/projjpn/BirthdateTest.java

@ -4,9 +4,6 @@ import junit.framework.TestCase;
public class BirthdateTest extends TestCase { public class BirthdateTest extends TestCase {
/**
* Test method for {@link de.hs_fulda.ciip.projjpn.Birthdate#toString()}.
*/
public void testToString() { public void testToString() {
// Given // Given
@ -18,4 +15,23 @@ public class BirthdateTest extends TestCase {
// Then // Then
assertEquals(expectedDate, b.toString()); assertEquals(expectedDate, b.toString());
} }
public void test_changeBirthdate() {
// Given
Birthdate b = new Birthdate(1, 1, 2000);
// Change Birthdate
b.changeBirthdate(2, 3, 2001);
// When
int expectedDay = 2;
int expectedMonth = 3;
int expectedYear = 2001;
// Then
assertEquals(2, b.getDay());
assertEquals(3, b.getMonth());
assertEquals(2001, b.getYear());
}
} }
Loading…
Cancel
Save