fix conflict

This commit is contained in:
-
2019-04-07 23:25:06 -06:00
57 changed files with 2004 additions and 604 deletions
@@ -4,18 +4,9 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(final String[] args)
{
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
}
@@ -1,6 +1,6 @@
package edu.msudenver.tsp.website.controller;
import edu.msudenver.tsp.website.controller.forms.Theorem;
import edu.msudenver.tsp.website.forms.TheoremForm;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
@@ -9,7 +9,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Slf4j
@@ -18,16 +17,16 @@ import org.springframework.web.servlet.ModelAndView;
@RequestMapping("/theorem")
public class TheoremEntryController {
@GetMapping({"/",""})
public ModelAndView enterTheoremPage()
{
public ModelAndView enterTheoremPage() {
LOG.info("Received request to display the theorem entry page: returning model with name 'Theorem'");
return new ModelAndView("Theorem");
}
@PostMapping({"/",""})
public String saveTheorem(@Validated Theorem theorem, Model model) {
model.addAttribute("theromName1", theorem.getTheoremName1());
model.addAttribute("theromName2", theorem.getTheoremName2());
public String saveTheorem(@Validated final TheoremForm theoremForm, final Model model) {
model.addAttribute("theoremName", theoremForm.getTheoremName());
model.addAttribute("theorem", theoremForm.getTheorem());
LOG.info("Saving theorem {}...", theoremForm);
return "success";
}
@@ -1,17 +0,0 @@
package edu.msudenver.tsp.website.controller.forms;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
@Getter
@Setter
public class Theorem {
private String theoremName1 ;
private String theoremName2 ;
// @NotBlank(message = "Theorem name must not be blank") private String theoremName;
}
@@ -0,0 +1,11 @@
package edu.msudenver.tsp.website.forms;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TheoremForm {
private String theoremName;
private String theorem;
}
+19 -2
View File
@@ -1,7 +1,8 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Theorem Page</title>
@@ -13,4 +14,20 @@ Enter Theorem Name : <input type="text" name="theoremName1">
<input type="submit" value="save">
</form>
</body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Theorem Entry</title>
</head>
<body>
<form method="post" action="">
<label>Theorem Name:
<input type="text" name="theoremName"/>
</label>
<br><label>Theorem:
<input type="text" name="theorem"/>
</label><br>
<input type="submit" value="Save">
</form>
</body>
</html>
+27
View File
@@ -0,0 +1,27 @@
<%--
Created by IntelliJ IDEA.
User: atusa
Date: 2/1/19
Time: 8:03 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pandamonium™ Theorem Prover</title>
</head>
<body>
<div>
<div>
<h1>Theorem Prover</h1>
<h2>Hello! Welcome to Pandamonium™ Theorem Prover!!</h2>
Click on this <strong><a href="/theorem/">link</a></strong> to visit theorem entering page.
</div>
</div>
</body>
</html>
+4 -4
View File
@@ -1,7 +1,7 @@
<html>
<body>
<br><b>Name:</b><%= request.getParameter("theoremName1")%>
<br><b>Name:</b><%= request.getParameter("theoremName2")%>
<body>
<br><b>Name: </b><%= request.getParameter("theoremName")%>
<br><b>Theorem: </b><%= request.getParameter("theorem")%>
</body>
</body>
</html>
-16
View File
@@ -1,16 +0,0 @@
<%--
Created by IntelliJ IDEA.
User: atusa
Date: 2/1/19
Time: 8:03 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>abc</title>
</head>
<body>
$END$
</body>
</html>
@@ -2,44 +2,32 @@ package edu.msudenver.tsp.website.controller;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.ui.Model;
import org.springframework.web.servlet.ModelAndView;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import java.util.Map;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(MockitoJUnitRunner.class)
public class TheoremEntryControllerTest {
@InjectMocks
private TheoremEntryController theoremEntryController;
private final TheoremEntryController theoremEntryController = new TheoremEntryController();
@Test
public void theoremPage(){
final ModelAndView modelAndView= theoremEntryController.enterTheoremPage();
assertNotNull(modelAndView);
assertEquals("Theorem",modelAndView.getViewName());
}
@Test
public void saveTheorem(){
final ModelAndView modelAndView= theoremEntryController.enterTheoremPage();
@Test
public void testEnterTheoremPage() {
final ModelAndView modelAndView = theoremEntryController.enterTheoremPage();
assertNotNull(modelAndView);
assertEquals("Theorem",modelAndView.getViewName());
assertEquals("Theorem", modelAndView.getViewName());
}
//
}
}