Procházet zdrojové kódy

delete out-dated tests

Miaomz před 6 roky
rodič
revize
7d1bd369f5

+ 1 - 0
src/main/java/com/moekr/moocoder/logic/service/ProjectService.java

@@ -14,6 +14,7 @@ public interface ProjectService {
      * @param projectFile project file which can be .zip or .jar, whose original file name should be the same as <param>project</>
      * @return if the project has been added successfully
      */
+    @Deprecated
     boolean addProject(String project, MultipartFile projectFile);
 
     /**

+ 3 - 1
src/test/java/com/moekr/moocoder/logic/api/PMDControllerTest.java

@@ -3,7 +3,7 @@ package com.moekr.moocoder.logic.api;
 import com.moekr.moocoder.logic.vo.PMDRelatedVO;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * @author miaomuzhi
@@ -21,6 +21,8 @@ class PMDControllerTest {
 
     @Test
     void readXMLReport() {
+        makeReport();
+
         PMDController controller = new PMDController(new PMDWrapper());
         String dstFolder = getClass().getResource("/wala/pmd-controller").getFile();
         PMDRelatedVO relatedVO = controller.readXMLReport(dstFolder, "walawork");

+ 3 - 13
src/test/java/com/moekr/moocoder/logic/api/WalaControllerTest.java

@@ -3,7 +3,7 @@ package com.moekr.moocoder.logic.api;
 import com.moekr.moocoder.util.enums.Source;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertFalse;
+import java.io.File;
 
 /**
  * @author miaomuzhi
@@ -14,20 +14,10 @@ class WalaControllerTest {
     @Test
     void makeDataTest() throws Exception {
         WalaController wc = new WalaController();
-        String srcDir = getClass().getResource("/wala/walawork").getFile();
-        String dstDir = getClass().getResource("/wala/jar/walawork.txt").getFile();
+        String srcDir = getClass().getResource("/wala/jar/bukkit.jar").getFile();
+        String dstDir = getClass().getResource("/wala/jar").getFile() + File.separator + "bukkit";
         wc.makeData(srcDir, dstDir, Source.CLASS_FILE);
 
-        srcDir = getClass().getResource("/wala/jar/bukkit.jar").getFile();
-        dstDir = getClass().getResource("/wala/jar/walawork.txt").getFile();
-        wc.makeData(srcDir, dstDir, Source.CLASS_FILE);
     }
 
-    @Test
-    void needsAnalysisTest() throws Exception {
-        WalaController wc = new WalaController();
-        String srcDir = getClass().getResource("/wala/walawork").getFile();
-        String dstDir = getClass().getResource("/wala/jar/walawork.txt").getFile();
-        assertFalse(wc.needsAnalysis(srcDir, dstDir));
-    }
 }

+ 3 - 4
src/test/java/com/moekr/moocoder/logic/service/impl/OOPMetricAnalyzerTest.java

@@ -11,7 +11,6 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import static java.lang.Float.NaN;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
@@ -39,12 +38,12 @@ class OOPMetricAnalyzerTest {
                 OOPMetricVO metric = (OOPMetricVO)method.invoke(analyzer, lines, "Lcom/fasterxml/jackson/datatype/guava/deser/util/RangeFactory", 0.1);
                 System.out.println(metric);
                 assertEquals(0.1, metric.getAbstractness());
-                assertEquals(NaN, metric.getInstability());
-                assertEquals(NaN, metric.getMainSeqNormalDist());
+                assertEquals(0.0, metric.getInstability());
+                assertEquals(0.9, metric.getMainSeqNormalDist());
 
                 metric = (OOPMetricVO)method.invoke(analyzer, lines, "RangeFactory", 0);
                 assertEquals(0, metric.getAbstractness());
-                assertEquals(NaN, metric.getInstability());
+                assertEquals(0, metric.getInstability());
             }
         } catch (IOException e){
             e.printStackTrace();

+ 0 - 23
src/test/java/com/moekr/moocoder/logic/service/impl/ProjectServiceImplTest.java

@@ -7,12 +7,6 @@ import com.moekr.moocoder.web.dto.CodeDTO;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.mock.web.MockMultipartFile;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
 
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -42,23 +36,6 @@ class ProjectServiceImplTest {
         }
     }
 
-
-    @Test
-    void addProject() throws IOException {
-        ProjectService projectService = new ProjectServiceImpl(null, null, null);
-        File f = new File(getClass().getResource("/wala/jar/walawork.zip").getFile());
-        try (FileInputStream inputStream = new FileInputStream(f)) {
-            MultipartFile zipFile = new MockMultipartFile("walawork", "walawork.zip", "binary", inputStream);
-            assertTrue(projectService.addProject("walawork", zipFile));
-        }
-
-        f = new File(getClass().getResource("/wala/jar/ui.zip").getFile());
-        try (FileInputStream inputStream = new FileInputStream(f)) {
-            MultipartFile zipFile = new MockMultipartFile("ui", "ui.zip", "binary", inputStream);
-            assertTrue(projectService.addProject("ui", zipFile));
-        }
-    }
-
     @Test
     void containsProject() {
         ProjectService projectService = new ProjectServiceImpl(null, null, null);