Andrew Grant 3 місяців тому
батько
коміт
dd96f460c9

+ 43 - 0
src/test/java/scot/carricksoftware/grantswriter/GenerateRandomPlaceValues.java

@@ -0,0 +1,43 @@
+/*
+ * Copyright (c)  04 Feb 2025, Andrew Grant of Carrick Software .
+ * All rights reserved.
+ */
+
+package scot.carricksoftware.grantswriter;
+
+import org.springframework.stereotype.Component;
+import scot.carricksoftware.grantswriter.domains.places.Country;
+import scot.carricksoftware.grantswriter.domains.places.Place;
+import scot.carricksoftware.grantswriter.domains.places.Region;
+
+import static scot.carricksoftware.grantswriter.GenerateCertificateRandomValues.GetRandomString;
+
+
+@SuppressWarnings("unused")
+@Component
+public class GenerateRandomPlaceValues {
+
+    @SuppressWarnings("unused")
+    public static Place GetRandomPlace() {
+        Place place = new Place();
+        place.setName(GetRandomString());
+        return place;
+    }
+
+    public static Country GetRandomCountry() {
+        Country country = new Country();
+        country.setName(GetRandomString());
+        return country;
+    }
+
+
+    public static Region GetRandomRegion() {
+        Region region = new Region();
+        region.setName(GetRandomString());
+        return region;
+    }
+
+
+
+
+}

+ 56 - 0
src/test/java/scot/carricksoftware/grantswriter/domains/places/region/RegionTest.java

@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) Andrew Grant of Carrick Software 11/03/2025, 14:34.
+ *
+ */
+
+package scot.carricksoftware.grantswriter.domains.places.region;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import scot.carricksoftware.grantswriter.domains.places.Country;
+import scot.carricksoftware.grantswriter.domains.places.Region;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static scot.carricksoftware.grantswriter.GenerateCertificateRandomValues.GetRandomString;
+import static scot.carricksoftware.grantswriter.GenerateRandomPlaceValues.GetRandomCountry;
+
+
+public class RegionTest {
+
+    Region region;
+
+    @BeforeEach
+    public void setUp() {
+        region = new Region();
+    }
+
+    @Test
+    public void getNameTest() {
+        assertNull(region.getName());
+    }
+
+    @Test
+    public void setNameTest() {
+        String name = GetRandomString();
+        region.setName(name);
+        assertEquals(name, region.getName());
+    }
+
+    @Test
+    public void getCountryTest() {
+        assertNull(region.getCountry());
+    }
+
+    @Test
+    public void setCountryTest() {
+        Country country = GetRandomCountry();
+        region.setCountry(country);
+        assertEquals(country, region.getCountry());
+    }
+
+
+
+
+
+}