Browse Source

Added: Birthdate class, basic Birthdate Test

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

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

@ -0,0 +1,45 @@
package de.hs_fulda.ciip.projjpn;
public class Birthdate {
private int day;
private int month;
private int year;
public Birthdate(int d, int m, int y) {
day = d;
month = m;
year = y;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
/**
* @return Date Format TT.DD.YYYY
*/
public String toString() {
return day + "." + month + "." + year;
}
}

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

@ -0,0 +1,21 @@
package de.hs_fulda.ciip.projjpn;
import junit.framework.TestCase;
public class BirthdateTest extends TestCase {
/**
* Test method for {@link de.hs_fulda.ciip.projjpn.Birthdate#toString()}.
*/
public final void testToString() {
// Given
Birthdate b = new Birthdate(1, 1, 2000);
// When
String expectedDate = "1.1.2000";
// Then
assertEquals(expectedDate, b.toString());
}
}
Loading…
Cancel
Save