From e0f80b9ae742b4cc2d29e37dcc40e3fd67560092 Mon Sep 17 00:00:00 2001 From: Maxim Volkov Date: Thu, 17 Feb 2022 02:33:08 +0100 Subject: [PATCH] Added: Birthdate class, basic Birthdate Test --- .../de/hs_fulda/ciip/projjpn/Birthdate.java | 45 +++++++++++++++++++ .../hs_fulda/ciip/projjpn/BirthdateTest.java | 21 +++++++++ 2 files changed, 66 insertions(+) create mode 100644 projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Birthdate.java create mode 100644 projjpn/src/test/java/de/hs_fulda/ciip/projjpn/BirthdateTest.java diff --git a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Birthdate.java b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Birthdate.java new file mode 100644 index 0000000..ad05fb7 --- /dev/null +++ b/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; + } + +} diff --git a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/BirthdateTest.java b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/BirthdateTest.java new file mode 100644 index 0000000..6461784 --- /dev/null +++ b/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()); + } +}