commit b00ca0830312c7b03687f0e7c829310782294a6d
Author: Hrabikv <hrabikv@students.zcu.cz>
Date:   Wed May 17 09:09:57 2023 +0200

    #10644 vytvoření groovy sriptů a namockování pro configurace

diff --git a/src/test/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/BaseTest.java b/src/test/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/BaseTest.java
index 0d3846a..e72b6c1 100644
--- a/src/test/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/BaseTest.java
+++ b/src/test/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/BaseTest.java
@@ -3,7 +3,9 @@ package cz.zcu.fav.kiv.antipatterndetectionapp.v2.controller;
 import cz.zcu.fav.kiv.antipatterndetectionapp.repository.AntiPatternRepository;
 import cz.zcu.fav.kiv.antipatterndetectionapp.service.AntiPatternService;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.Configuration;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.Metadata;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.model.User;
+import cz.zcu.fav.kiv.antipatterndetectionapp.v2.repository.AboutPageRepository;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.repository.ConfigRepository;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.repository.UserRepository;
 import cz.zcu.fav.kiv.antipatterndetectionapp.v2.service.DetectionService;
@@ -43,6 +45,9 @@ public abstract class BaseTest {
     @MockBean
     private ConfigRepository configurationRepository;
 
+    @MockBean
+    private AboutPageRepository aboutPageRepository;
+
     @BeforeEach
     public void init() {
         User user = new User("foo", "foo@foo.foo", "76D3BC41C9F588F7FCD0D5BF4718F8F84B1C41B20882703100B9EB9413807C01");
@@ -100,6 +105,15 @@ public abstract class BaseTest {
         configuration.add(con);
         when(configurationRepository.getAllUserConfigurations(config_user.getId())).thenReturn(configuration);
 
+        /* About */
+        List<Metadata> metadata = new ArrayList<>();
+        Metadata met = new Metadata();
+        met.setAppDataValue("[ { \"version\": \"1.0.0\", \"authors\": [ { \"name\": \"Ondřej Váně\", \"email\": \"vaneo@students.zcu.cz\"}], \"description\": \"This application is used to detect presence of anti-patterns in project management tools data. Seven selected anti-patterns are implemented in this application.\"}, { \"version\": \"1.1.0\", \"authors\": [ { \"name\": \"Ondřej Váně\", \"email\": \"vaneo@students.zcu.cz\"}], \"description\": \"This application is used to detect presence of anti-patterns in project management tools data. Seven selected anti-patterns are implemented in this application.\"}, { \"version\": \"1.2.0\", \"authors\": [ { \"name\": \"Petr Štěpánek\", \"email\": \"petrs1@students.zcu.cz\"}], \"description\": \"This application is used to detect presence of anti-patterns in project management tools data. Ten selected anti-patterns are implemented in this application.\"}, { \"version\": \"2.0.0\", \"authors\": [ { \"name\": \"Petr Štěpánek\", \"email\": \"petrs1@students.zcu.cz\"}, { \"name\": \"Petr Urban\", \"email\": \"urbanp@students.zcu.cz\"}, { \"name\": \"Jiří Trefil\", \"email\": \"trefil@students.zcu.cz\"}, { \"name\": \"Václav Hrabík\", \"email\": \"hrabikv@students.zcu.cz\"}], \"description\": \"TODO\"}]");
+        met.setId(1L);
+        met.setAppDataKey("basics");
+        metadata.add(met);
+        when(aboutPageRepository.findAll()).thenReturn(metadata);
+
         RestAssuredMockMvc.webAppContextSetup(webApplicationContext);
     }
 
diff --git a/src/test/resources/contracts/about_200.groovy b/src/test/resources/contracts/about_200.groovy
new file mode 100644
index 0000000..e11f5fc
--- /dev/null
+++ b/src/test/resources/contracts/about_200.groovy
@@ -0,0 +1,51 @@
+package contracts
+
+import org.springframework.cloud.contract.spec.Contract
+
+class Author {
+    String name = ""
+    String email = ""
+}
+
+class Version {
+    String version = ""
+    Author[] array = []
+    String description = ""
+}
+
+Contract.make {
+    description "Get information about app."
+    request {
+        method GET()
+        url("/v2/app/metadata/about")
+        headers {
+            header("Authorization": "Bearer token")
+            contentType applicationJson()
+        }
+    }
+    response {
+        body(
+               [["version" : '2.0.0',
+                 "authors": [["name": "Petr Štěpánek", "email": 'petrs1@students.zcu.cz'],
+                             ["name": "Petr Urban", "email": 'urbanp@students.zcu.cz'],
+                             ["name": "Jiří Trefil", "email": 'trefil@students.zcu.cz'],
+                             ["name": "Václav Hrabík", "email": 'hrabikv@students.zcu.cz']
+                            ],
+                 "description": 'TODO'],
+                ["version": '1.2.0',
+                 "authors": [["name": 'Petr Štěpánek', "email": 'petrs1@students.zcu.cz']],
+                 "description": 'This application is used to detect presence of anti-patterns in project management tools data. Ten selected anti-patterns are implemented in this application.'
+                ],
+                ["version": '1.1.0',
+                 "authors": ["name": 'Ondřej Váně', "email": 'vaneo@students.zcu.cz'],
+                 "description": 'This application is used to detect presence of anti-patterns in project management tools data. Seven selected anti-patterns are implemented in this application.'
+                ],
+                ["version": '1.0.0',
+                 "authors": ["name": 'Ondřej Váně', "email": 'vaneo@students.zcu.cz'],
+                 "description": 'This application is used to detect presence of anti-patterns in project management tools data. Seven selected anti-patterns are implemented in this application.'
+                ]
+                ]
+        )
+        status 200
+    }
+}
\ No newline at end of file
