Update to add more properties
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -34,6 +37,7 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
@Mock(name = "com.mattrixwv.cipherstream.controller.monosubstitution.AffineCipherController")
|
||||
private Logger affineLogger;
|
||||
//Fields
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String url = "/affine";
|
||||
private static final String decodedString = "Message to^encode";
|
||||
private static final String encodedString = "Pbtthlb yz^burzwb";
|
||||
@@ -41,7 +45,8 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
private static final int key2 = 7;
|
||||
private static final String affineName = "affineCipherName";
|
||||
private static final String affineDescription = "affineCipherDescription";
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final List<String> affineExplanation = List.of("affineExplanation1", "affineExplanation2", "affineExplanation3");
|
||||
private static final List<String> affineFacts = List.of("affineFact1", "affineFact2", "affineFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -66,6 +71,8 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineName", affineName);
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineDescription", affineDescription);
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineExplanation", affineExplanation);
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineFacts", affineFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +84,13 @@ public class AffineCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(affineDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(affineName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(affineName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(affineExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(affineExplanation.get(0), affineExplanation.get(1), affineExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(affineFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(affineFacts.get(0), affineFacts.get(1), affineFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -32,17 +34,21 @@ public class AffineCipherControllerTest{
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String affineName = "affineCipherName";
|
||||
private static final String affineDescription = "affineCipherDescription";
|
||||
private static final List<String> affineExplanation = List.of("affineExplanation1", "affineExplanation2", "affineExplanation3");
|
||||
private static final List<String> affineFacts = List.of("affineFact1", "affineFact2", "affineFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineName", affineName);
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineDescription", affineDescription);
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineExplanation", affineExplanation);
|
||||
ReflectionTestUtils.setField(affineCipherController, "affineFacts", affineFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(affineName, affineDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(affineName, affineDescription, affineExplanation, affineFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = affineCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -29,7 +32,7 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
@Autowired
|
||||
private AtbashCipherController atbashController;
|
||||
private AtbashCipherController atbashCipherController;
|
||||
//Loggers
|
||||
@Mock(name = "com.mattrixwv.cipherstream.controller.monosubstitution.AtbashCipherController")
|
||||
protected Logger atbashLogger;
|
||||
@@ -40,6 +43,8 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
private static final String encodedString = "Nvhhztv gl^vmxlwv";
|
||||
private static final String atbashName = "atbashName";
|
||||
private static final String atbashDescription = "atbashDescription";
|
||||
private static final List<String> atbashExplanation = List.of("atbashExplanation1", "atbashExplanation2", "atbashExplanation3");
|
||||
private static final List<String> atbashFacts = List.of("atbashFact1", "atbashFact2", "atbashFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -58,8 +63,10 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
encodedNode.put(CipherParameterUtil.INPUT_STRING, encodedString);
|
||||
encodedNode.put(CipherParameterUtil.OUTPUT_STRING, decodedString);
|
||||
|
||||
ReflectionTestUtils.setField(atbashController, "atbashName", atbashName);
|
||||
ReflectionTestUtils.setField(atbashController, "atbashDescription", atbashDescription);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashName", atbashName);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashDescription", atbashDescription);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashExplanation", atbashExplanation);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashFacts", atbashFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +78,13 @@ public class AtbashCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(atbashDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(atbashName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(atbashName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(atbashExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(atbashExplanation.get(0), atbashExplanation.get(1), atbashExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(atbashFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(atbashFacts.get(0), atbashFacts.get(1), atbashFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -14,6 +16,7 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.mattrixwv.cipherstream.exception.InvalidCipherParameterException;
|
||||
import com.mattrixwv.cipherstream.utils.CipherInfoUtil;
|
||||
import com.mattrixwv.cipherstream.utils.CipherParameterUtil;
|
||||
|
||||
|
||||
@@ -29,12 +32,28 @@ public class AtbashCipherControllerTest{
|
||||
private static final String ATBASH_OUTPUT_STRING = "Nvhhztv gl^vmxlwv";
|
||||
private static final String atbashName = "atbashName";
|
||||
private static final String atbashDescription = "atbashDescription";
|
||||
private static final List<String> atbashExplanation = List.of("atbashExplanation1", "atbashExplanation2", "atbashExplanation3");
|
||||
private static final List<String> atbashFacts = List.of("atbashFact1", "atbashFact2", "atbashFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashName", atbashName);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashDescription", atbashDescription);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashExplanation", atbashExplanation);
|
||||
ReflectionTestUtils.setField(atbashCipherController, "atbashFacts", atbashFacts);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(atbashName, atbashDescription, atbashExplanation, atbashFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = atbashCipherController.getCipherInfo();
|
||||
|
||||
|
||||
assertEquals(infoNode, returnedJson);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
|
||||
private static final String keyword = "keyword";
|
||||
private static final String autokeyName = "autokeyName";
|
||||
private static final String autokeyDescription = "autokeyDescription";
|
||||
private static final List<String> autokeyExplanation = List.of("autokeyExplanation1", "autokeyExplanation2", "autokeyExplanation3");
|
||||
private static final List<String> autokeyFacts = List.of("autokeyFact1", "autokeyFact2", "autokeyFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
|
||||
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyName", autokeyName);
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyDescription", autokeyDescription);
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyExplanation", autokeyExplanation);
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyFacts", autokeyFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class AutokeyCipherControllerIntegrationTest extends CipherStreamControll
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(autokeyDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(autokeyName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(autokeyName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(autokeyExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(autokeyExplanation.get(0), autokeyExplanation.get(1), autokeyExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(autokeyFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(autokeyFacts.get(0), autokeyFacts.get(1), autokeyFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class AutokeyCipherControllerTest{
|
||||
private static final String AUTOKEY_KEYWORD = CipherParameterUtil.KEYWORD;
|
||||
private static final String autokeyName = "autokeyName";
|
||||
private static final String autokeyDescription = "autokeyDescription";
|
||||
private static final List<String> autokeyExplanation = List.of("autokeyExplanation1", "autokeyExplanation2", "autokeyExplanation3");
|
||||
private static final List<String> autokeyFacts = List.of("autokeyFact1", "autokeyFact2", "autokeyFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyName", autokeyName);
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyDescription", autokeyDescription);
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyExplanation", autokeyExplanation);
|
||||
ReflectionTestUtils.setField(autokeyCipherController, "autokeyFacts", autokeyFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(autokeyName, autokeyDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(autokeyName, autokeyDescription, autokeyExplanation, autokeyFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = autokeyCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -40,6 +43,8 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String baconianName = "baconianName";
|
||||
private static final String baconianDescription = "baconianDescription";
|
||||
private static final List<String> baconianExplanation = List.of("baconianExplanation1", "baconianExplanation2", "baconianExplanation3");
|
||||
private static final List<String> baconianFacts = List.of("baconianFact1", "baconianFact2", "baconianFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -60,6 +65,8 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
|
||||
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianName", baconianName);
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianDescription", baconianDescription);
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianExplanation", baconianExplanation);
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianFacts", baconianFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +78,13 @@ public class BaconianCipherControllerIntegrationTest extends CipherStreamControl
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(baconianDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baconianName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baconianName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(baconianExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(baconianExplanation.get(0), baconianExplanation.get(1), baconianExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(baconianFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(baconianFacts.get(0), baconianFacts.get(1), baconianFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,18 +33,22 @@ public class BaconianCipherControllerTest{
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String baconianName = "baconianName";
|
||||
private static final String baconianDescription = "baconianDescription";
|
||||
private static final List<String> baconianExplanation = List.of("baconianExplanation1", "baconianExplanation2", "baconianExplanation3");
|
||||
private static final List<String> baconianFacts = List.of("baconianFact1", "baconianFact2", "baconianFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianName", baconianName);
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianDescription", baconianDescription);
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianExplanation", baconianExplanation);
|
||||
ReflectionTestUtils.setField(baconianCipherController, "baconianFacts", baconianFacts);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baconianName, baconianDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baconianName, baconianDescription, baconianExplanation, baconianFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = baconianCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
|
||||
private static final int base = 2;
|
||||
private static final String baseXName = "baseXName";
|
||||
private static final String baseXDescription = "baseXDescription";
|
||||
private static final List<String> baseXExplanation = List.of("baseXExplanation1", "baseXExplanation2", "baseXExplanation3");
|
||||
private static final List<String> baseXFacts = List.of("baseXFact1", "baseXFact2", "baseXFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
|
||||
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXName", baseXName);
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXDescription", baseXDescription);
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXExplanation", baseXExplanation);
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXFacts", baseXFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class BaseXCipherControllerIntegrationTest extends CipherStreamController
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(baseXDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baseXName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(baseXName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(baseXExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(baseXExplanation.get(0), baseXExplanation.get(1), baseXExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(baseXFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(baseXFacts.get(0), baseXFacts.get(1), baseXFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class BaseXCipherControllerTest{
|
||||
private static final String BASE_X_OUTPUT_STRING = "1000001 101011 1000010 1000000 1000011 100000 1100100 1001 1100101 1010 1100110";
|
||||
private static final String baseXName = "baseXName";
|
||||
private static final String baseXDescription = "baseXDescription";
|
||||
private static final List<String> baseXExplanation = List.of("baseXExplanation1", "baseXExplanation2", "baseXExplanation3");
|
||||
private static final List<String> baseXFacts = List.of("baseXFact1", "baseXFact2", "baseXFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXName", baseXName);
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXDescription", baseXDescription);
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXExplanation", baseXExplanation);
|
||||
ReflectionTestUtils.setField(baseXCipherController, "baseXFacts", baseXFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baseXName, baseXDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(baseXName, baseXDescription, baseXExplanation, baseXFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = baseXCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String beaufortName = "beaufortName";
|
||||
private static final String beaufortDescription = "beaufortDescription";
|
||||
private static final List<String> beaufortExplanation = List.of("beaufortExplanation1", "beaufortExplanation2", "beaufortExplanation3");
|
||||
private static final List<String> beaufortFacts = List.of("beaufortFact1", "beaufortFact2", "beaufortFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
|
||||
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortName", beaufortName);
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortDescription", beaufortDescription);
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortExplanation", beaufortExplanation);
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortFacts", beaufortFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class BeaufortCipherControllerIntegrationTest extends CipherStreamControl
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(beaufortDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(beaufortName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(beaufortName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(beaufortExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(beaufortExplanation.get(0), beaufortExplanation.get(1), beaufortExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(beaufortFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(beaufortFacts.get(0), beaufortFacts.get(1), beaufortFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class BeaufortCipherControllerTest{
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String beaufortName = "beaufortName";
|
||||
private static final String beaufortDescription = "beaufortDescription";
|
||||
private static final List<String> beaufortExplanation = List.of("beaufortExplanation1", "beaufortExplanation2", "beaufortExplanation3");
|
||||
private static final List<String> beaufortFacts = List.of("beaufortFact1", "beaufortFact2", "beaufortFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortName", beaufortName);
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortDescription", beaufortDescription);
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortExplanation", beaufortExplanation);
|
||||
ReflectionTestUtils.setField(beaufortCipherController, "beaufortFacts", beaufortFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(beaufortName, beaufortDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(beaufortName, beaufortDescription, beaufortExplanation, beaufortFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = beaufortCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
private static final int shiftAmount = 23;
|
||||
private static final String caesarName = "caesarName";
|
||||
private static final String caesarDescription = "caesarDescription";
|
||||
private static final List<String> caesarExplanation = List.of("caesarExplanation1", "caesarExplanation2", "caesarExplanation3");
|
||||
private static final List<String> caesarFacts = List.of("caesarFact1", "caesarFact2", "caesarFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarName", caesarName);
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarDescription", caesarDescription);
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarExplanation", caesarExplanation);
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarFacts", caesarFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class CaesarCipherControllerIntegrationTest extends CipherStreamControlle
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(caesarDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(caesarName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(caesarName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(caesarExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(caesarExplanation.get(0), caesarExplanation.get(1), caesarExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(caesarFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(caesarFacts.get(0), caesarFacts.get(1), caesarFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class CaesarCipherControllerTest{
|
||||
private static final ObjectNode blankNode = mapper.createObjectNode();
|
||||
private static final String caesarName = "caesarName";
|
||||
private static final String caesarDescription = "caesarDescription";
|
||||
private static final List<String> caesarExplanation = List.of("caesarExplanation1", "caesarExplanation2", "caesarExplanation3");
|
||||
private static final List<String> caesarFacts = List.of("caesarFact1", "caesarFact2", "caesarFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarName", caesarName);
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarDescription", caesarDescription);
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarExplanation", caesarExplanation);
|
||||
ReflectionTestUtils.setField(caesarCipherController, "caesarFacts", caesarFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(caesarName, caesarDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(caesarName, caesarDescription, caesarExplanation, caesarFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = caesarCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
|
||||
private static final String keyword = "keywordThatIsTotallyRandom";
|
||||
private static final String oneTimePadName = "oneTimePadName";
|
||||
private static final String oneTimePadDescription = "oneTimePadDescription";
|
||||
private static final List<String> oneTimePadExplanation = List.of("oneTimePadExplanation1", "oneTimePadExplanation2", "oneTimePadExplanation3");
|
||||
private static final List<String> oneTimePadFacts = List.of("oneTimePadFact1", "oneTimePadFact2", "oneTimePadFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
|
||||
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadName", oneTimePadName);
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadDescription", oneTimePadDescription);
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadExplanation", oneTimePadExplanation);
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadFacts", oneTimePadFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class OneTimePadCipherControllerIntegrationTest extends CipherStreamContr
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(oneTimePadDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(oneTimePadName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(oneTimePadName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(oneTimePadExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(oneTimePadExplanation.get(0), oneTimePadExplanation.get(1), oneTimePadExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(oneTimePadFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(oneTimePadFacts.get(0), oneTimePadFacts.get(1), oneTimePadFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class OneTimePadCipherControllerTest{
|
||||
private static final String ONE_TIME_PAD_OUTPUT_STRING = "Wiqooxh mv^egkgws";
|
||||
private static final String oneTimePadName = "oneTimePadName";
|
||||
private static final String oneTimePadDescription = "oneTimePadDescription";
|
||||
private static final List<String> oneTimePadExplanation = List.of("oneTimePadExplanation1", "oneTimePadExplanation2", "oneTimePadExplanation3");
|
||||
private static final List<String> oneTimePadFacts = List.of("oneTimePadFact1", "oneTimePadFact2", "oneTimePadFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadName", oneTimePadName);
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadDescription", oneTimePadDescription);
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadExplanation", oneTimePadExplanation);
|
||||
ReflectionTestUtils.setField(oneTimePadCipherController, "oneTimePadFacts", oneTimePadFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(oneTimePadName, oneTimePadDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(oneTimePadName, oneTimePadDescription, oneTimePadExplanation, oneTimePadFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = oneTimePadCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -42,6 +45,8 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController
|
||||
private static final String keyword = "keyword";
|
||||
private static final String portaName = "portaName";
|
||||
private static final String portaDescription = "portaDescription";
|
||||
private static final List<String> portaExplanation = List.of("portaExplanation1", "portaExplanation2", "portaExplanation3");
|
||||
private static final List<String> portaFacts = List.of("portaFact1", "portaFact2", "portaFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -64,6 +69,8 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController
|
||||
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaName", portaName);
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaDescription", portaDescription);
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaExplanation", portaExplanation);
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaFacts", portaFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +82,13 @@ public class PortaCipherControllerIntegrationTest extends CipherStreamController
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(portaDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(portaName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(portaName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(portaExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(portaExplanation.get(0), portaExplanation.get(1), portaExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(portaFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(portaFacts.get(0), portaFacts.get(1), portaFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class PortaCipherControllerTest{
|
||||
private static final String PORTA_OUTPUT_STRING = "Rtghuos bm^qcwgrw";
|
||||
private static final String portaName = "portaName";
|
||||
private static final String portaDescription = "portaDescription";
|
||||
private static final List<String> portaExplanation = List.of("portaExplanation1", "portaExplanation2", "portaExplanation3");
|
||||
private static final List<String> portaFacts = List.of("portaFact1", "portaFact2", "portaFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaName", portaName);
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaDescription", portaDescription);
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaExplanation", portaExplanation);
|
||||
ReflectionTestUtils.setField(portaCipherController, "portaFacts", portaFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(portaName, portaDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(portaName, portaDescription, portaExplanation, portaFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = portaCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
|
||||
private static final String keyword = "cdefghijklmnopqrstuvwxyzab";
|
||||
private static final String substitutionName = "substitutionName";
|
||||
private static final String substitutionDescription = "substitutionDescription";
|
||||
private static final List<String> substitutionExplanation = List.of("substitutionExplanation1", "substitutionExplanation2", "substitutionExplanation3");
|
||||
private static final List<String> substitutionFacts = List.of("substitutionFact1", "substitutionFact2", "substitutionFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
|
||||
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionName", substitutionName);
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionDescription", substitutionDescription);
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionExplanation", substitutionExplanation);
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionFacts", substitutionFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class SubstitutionCipherControllerIntegrationTest extends CipherStreamCon
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(substitutionDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(substitutionName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(substitutionName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(substitutionExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(substitutionExplanation.get(0), substitutionExplanation.get(1), substitutionExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(substitutionFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(substitutionFacts.get(0), substitutionFacts.get(1), substitutionFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class SubstitutionCipherControllerTest{
|
||||
private static final String SUBSTITUTION_OUTPUT_STRING = "Oguucig vq&gpeqfg 876";
|
||||
private static final String substitutionName = "substitutionName";
|
||||
private static final String substitutionDescription = "substitutionDescription";
|
||||
private static final List<String> substitutionExplanation = List.of("substitutionExplanation1", "substitutionExplanation2", "substitutionExplanation3");
|
||||
private static final List<String> substitutionFacts = List.of("substitutionFact1", "substitutionFact2", "substitutionFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionName", substitutionName);
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionDescription", substitutionDescription);
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionExplanation", substitutionExplanation);
|
||||
ReflectionTestUtils.setField(substitutionCipherController, "substitutionFacts", substitutionFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(substitutionName, substitutionDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(substitutionName, substitutionDescription, substitutionExplanation, substitutionFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = substitutionCipherController.getCipherInfo();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -41,6 +44,8 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
|
||||
private static final String keyword = "keyword";
|
||||
private static final String vigenereName = "vigenereName";
|
||||
private static final String vigenereDescription = "vigenereDescription";
|
||||
private static final List<String> vigenereExplanation = List.of("vigenereExplanation1", "vigenereExplanation2", "vigenereExplanation3");
|
||||
private static final List<String> vigenereFacts = List.of("vigenereFact1", "vigenereFact2", "vigenereFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
@@ -63,6 +68,8 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
|
||||
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereName", vigenereName);
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereDescription", vigenereDescription);
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereExplanation", vigenereExplanation);
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereFacts", vigenereFacts);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +81,13 @@ public class VigenereCipherControllerIntegrationTest extends CipherStreamControl
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(vigenereDescription))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(vigenereName));
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(vigenereName))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(vigenereExplanation.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(vigenereExplanation.get(0), vigenereExplanation.get(1), vigenereExplanation.get(2))))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(vigenereFacts.size())))
|
||||
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(vigenereFacts.get(0), vigenereFacts.get(1), vigenereFacts.get(2))));
|
||||
|
||||
//Filter
|
||||
super.verifyFilter(url);
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.monosubstitution;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -31,17 +33,21 @@ public class VigenereCipherControllerTest{
|
||||
private static final String VIGENERE_OUTPUT_STRING = "Wiqooxh ds^cjqfgo";
|
||||
private static final String vigenereName = "vigenereName";
|
||||
private static final String vigenereDescription = "vigenereDescription";
|
||||
private static final List<String> vigenereExplanation = List.of("vigenereExplanation1", "vigenereExplanation2", "vigenereExplanation3");
|
||||
private static final List<String> vigenereFacts = List.of("vigenereFact1", "vigenereFact2", "vigenereFact3");
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void setup(){
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereName", vigenereName);
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereDescription", vigenereDescription);
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereExplanation", vigenereExplanation);
|
||||
ReflectionTestUtils.setField(vigenereCipherController, "vigenereFacts", vigenereFacts);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tetGetCipherInfo(){
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(vigenereName, vigenereDescription);
|
||||
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(vigenereName, vigenereDescription, vigenereExplanation, vigenereFacts);
|
||||
|
||||
|
||||
ObjectNode returnedJson = vigenereCipherController.getCipherInfo();
|
||||
|
||||
Reference in New Issue
Block a user