PAN-57 Refacted superfluous code
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package edu.msudenver.tsp.services.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import edu.msudenver.tsp.persistence.dto.AccountDto;
|
||||
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
@@ -12,8 +11,8 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class Account extends BaseDto implements Serializable {
|
||||
@NotBlank(groups = AccountDto.Insert.class, message = "A username must be specified") @Size(max = 50) private String username;
|
||||
@NotBlank(groups = AccountDto.Insert.class, message = "A password must be specified") @Size(max = 256) private String password;
|
||||
@NotBlank(groups = edu.msudenver.tsp.persistence.dto.Account.Insert.class, message = "A username must be specified") @Size(max = 50) private String username;
|
||||
@NotBlank(groups = edu.msudenver.tsp.persistence.dto.Account.Insert.class, message = "A password must be specified") @Size(max = 256) private String password;
|
||||
@NotNull @SerializedName("administrator_status") private boolean administratorStatus;
|
||||
@Temporal(TemporalType.DATE) @SerializedName("last_login") private Date lastLogin;
|
||||
|
||||
|
||||
@@ -1,41 +1,24 @@
|
||||
package edu.msudenver.tsp.services.parser;
|
||||
|
||||
import edu.msudenver.tsp.persistence.controller.DefinitionController;
|
||||
import edu.msudenver.tsp.persistence.controller.NotationController;
|
||||
import edu.msudenver.tsp.persistence.controller.ProofController;
|
||||
import edu.msudenver.tsp.persistence.controller.TheoremController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
class ParserService {
|
||||
private final DefinitionController definitionController;
|
||||
private final TheoremController theoremController;
|
||||
private final NotationController notationController;
|
||||
private final ProofController proofController;
|
||||
private Node root;
|
||||
|
||||
@Autowired
|
||||
public ParserService(final DefinitionController definitionController, final TheoremController theoremController,
|
||||
final NotationController notationController, final ProofController proofController) {
|
||||
this.definitionController = definitionController;
|
||||
this.theoremController = theoremController;
|
||||
this.notationController = notationController;
|
||||
this.proofController = proofController;
|
||||
}
|
||||
|
||||
public boolean parseUserInput(final String userInput)
|
||||
{
|
||||
try {
|
||||
final Node tree = parseRawInput(userInput);
|
||||
final List<String> statements = retrieveStatements(tree);
|
||||
retrieveStatements(tree);
|
||||
|
||||
return true;
|
||||
} catch(final Exception e) {
|
||||
e.printStackTrace();
|
||||
LOG.error(e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -44,7 +27,7 @@ class ParserService {
|
||||
{
|
||||
input = input.toLowerCase();
|
||||
|
||||
root = new Node(input, null);
|
||||
final Node root = new Node(input, null);
|
||||
|
||||
if(input.equals(""))
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package edu.msudenver.tsp.services.parser;
|
||||
|
||||
import edu.msudenver.tsp.persistence.controller.DefinitionController;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -12,18 +12,14 @@ import java.util.List;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ParserServiceTest {
|
||||
|
||||
private final DefinitionController definitionControllerMock = mock(DefinitionController.class);
|
||||
private final ParserService mockParserService = mock(ParserService.class);
|
||||
@Mock private ParserService mockParserService;
|
||||
|
||||
@InjectMocks
|
||||
private final ParserService parserService = new ParserService(definitionControllerMock, null,
|
||||
null, null);
|
||||
@InjectMocks private ParserService parserService;
|
||||
|
||||
@Test
|
||||
public void testEmptyStringEqualsEmptyString() {
|
||||
|
||||
Reference in New Issue
Block a user