change files location

This commit is contained in:
STS 2020-07-03 23:56:52 +02:00
parent be5c52bd3b
commit 8f22ea5d36
6 changed files with 4 additions and 120 deletions

View File

@ -1,34 +0,0 @@
HELP.md
mvnw
mvnw.cmd
.mvn
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/

View File

@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.bealdung.poi</groupId>
<artifactId>excelformula</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>excelformula</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<poi-ooxml.version>4.1.2</poi-ooxml.version>
<junit.version>4.13</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi-ooxml.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,13 +0,0 @@
package com.bealdung.poi.excelformula;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ExcelformulaApplication {
public static void main(String[] args) {
SpringApplication.run(ExcelformulaApplication.class, args);
}
}

View File

@ -1,16 +1,14 @@
package com.bealdung.poi.excelformula;
package com.baeldung.poi.excel.setFormula;
import org.apache.poi.ss.usermodel.CellValue;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
@Component
public class ExcelFormula {
XSSFWorkbook excel;
public XSSFSheet inserData(List<Integer> dataList) {

View File

@ -1,26 +1,18 @@
package com.bealdung.poi.excelformula;
package com.baeldung.poi.excel.setFormula;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.junit.Assert;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringRunner.class)
@SpringBootTest
class ExcelformulaApplicationTests {
@Autowired
private ExcelFormula excelFormula;
class ExcelFormulaUnitTest {
@Test
void givenExcelData_whenSetAndEvaluateFormula() throws IOException {
ExcelFormula excelFormula = new ExcelFormula();
List<Integer> data = Arrays.asList(2, 5, 10, 15, 7, 9);
XSSFSheet sheet = excelFormula.inserData(data);
int result = 0;
@ -34,5 +26,4 @@ class ExcelformulaApplicationTests {
int resultValue = (int) excelFormula.setFormula(sumFormula);
Assert.assertEquals("The results are the same!", resultValue , result);
}
}