Update to add more properties

This commit is contained in:
2024-04-24 21:12:57 -04:00
parent 33bc1f6bd9
commit db314eb7f4
65 changed files with 669 additions and 104 deletions

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.combination;
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;
@@ -42,6 +45,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
private static final String squareKeyword = "SquareKeyword";
private static final String adfgvxName = "adfgvxName";
private static final String adfgvxDescription = "adfgvxDescription";
private static final List<String> adfgvxExplanation = List.of("adfgvxExplanation1", "adfgvxExplanation2", "adfgvxExplanation3");
private static final List<String> adfgvxFacts = List.of("adfgvxFact1", "adfgvxFact2", "adfgvxFact3");
@BeforeEach
@@ -66,6 +71,8 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxName", adfgvxName);
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxDescription", adfgvxDescription);
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxExplanation", adfgvxExplanation);
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxFacts", adfgvxFacts);
}
@@ -77,7 +84,13 @@ public class AdfgvxCipherControllerIntegrationTest extends CipherStreamControlle
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(adfgvxName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgvxDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgvxDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(adfgvxExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(adfgvxExplanation.get(0), adfgvxExplanation.get(1), adfgvxExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(adfgvxFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(adfgvxFacts.get(0), adfgvxFacts.get(1), adfgvxFacts.get(2))));
//Filter
super.verifyFilter(url);

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.combination;
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 AdfgvxCipherControllerTest{
private static final String OUTPUT_STRING = "AXgvdavfxgagfa afag-aaxdxfgdagda";
private static final String adfgvxName = "adfgvxName";
private static final String adfgvxDescription = "adfgvxDescription";
private static final List<String> adfgvxExplanation = List.of("adfgvxExplanation1", "adfgvxExplanation2", "adfgvxExplanation3");
private static final List<String> adfgvxFacts = List.of("adfgvxFact1", "adfgvxFact2", "adfgvxFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxName", adfgvxName);
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxDescription", adfgvxDescription);
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxExplanation", adfgvxExplanation);
ReflectionTestUtils.setField(adfgvxCipherController, "adfgvxFacts", adfgvxFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgvxName, adfgvxDescription, adfgvxExplanation, adfgvxFacts);
ObjectNode returnedJson = adfgvxCipherController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.combination;
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;
@@ -42,6 +45,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
private static final String squareKeyword = "SquareKeyword";
private static final String adfgxName = "adfgxName";
private static final String adfgxDescription = "adfgxDescription";
private static final List<String> adfgxExplanation = List.of("adfgxExplanation1", "adfgxExplanation2", "adfgxExplanation3");
private static final List<String> adfgxFacts = List.of("adfgxFact1", "adfgxFact2", "adfgxFact3");
@BeforeEach
@@ -66,6 +71,8 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
ReflectionTestUtils.setField(adfgxCipherController, "adfgxName", adfgxName);
ReflectionTestUtils.setField(adfgxCipherController, "adfgxDescription", adfgxDescription);
ReflectionTestUtils.setField(adfgxCipherController, "adfgxExplanation", adfgxExplanation);
ReflectionTestUtils.setField(adfgxCipherController, "adfgxFacts", adfgxFacts);
}
@@ -77,7 +84,13 @@ public class AdfgxCipherControllerIntegrationTest extends CipherStreamController
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(adfgxName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgxDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(adfgxDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(adfgxExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(adfgxExplanation.get(0), adfgxExplanation.get(1), adfgxExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(adfgxFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(adfgxFacts.get(0), adfgxFacts.get(1), adfgxFacts.get(2))));
//Filter
super.verifyFilter(url);

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.combination;
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 AdfgxCipherControllerTest{
private static final String ADFGX_OUTPUT_STRING = "AAgagadfagaxxd axdx^adafafxddgdf";
private static final String adfgxName = "adfgxName";
private static final String adfgxDescription = "adfgxDescription";
private static final List<String> adfgxExplanation = List.of("adfgxExplanation1", "adfgxExplanation2", "adfgxExplanation3");
private static final List<String> adfgxFacts = List.of("adfgxFact1", "adfgxFact2", "adfgxFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(adfgxCipherController, "adfgxName", adfgxName);
ReflectionTestUtils.setField(adfgxCipherController, "adfgxDescription", adfgxDescription);
ReflectionTestUtils.setField(adfgxCipherController, "adfgxExplanation", adfgxExplanation);
ReflectionTestUtils.setField(adfgxCipherController, "adfgxFacts", adfgxFacts);
}
@Test
public void testGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(adfgxName, adfgxDescription, adfgxExplanation, adfgxFacts);
ObjectNode returnedJson = adfgxCipherController.getCipherInfo();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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 BifidCipherControllerIntegrationTest extends CipherStreamController
private static final String keyword = "keyword";
private static final String bifidName = "bifidName";
private static final String bifidDescription = "bifidDescription";
private static final List<String> bifidExplanation = List.of("bifidExplanation1", "bifidExplanation2", "bifidExplanation3");
private static final List<String> bifidFacts = List.of("bifidFact1", "bifidFact2", "bifidFact3");
@BeforeEach
@@ -63,6 +68,8 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController
ReflectionTestUtils.setField(bifidCipherController, "bifidName", bifidName);
ReflectionTestUtils.setField(bifidCipherController, "bifidDescription", bifidDescription);
ReflectionTestUtils.setField(bifidCipherController, "bifidExplanation", bifidExplanation);
ReflectionTestUtils.setField(bifidCipherController, "bifidFacts", bifidFacts);
}
@@ -74,7 +81,13 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(bifidName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(bifidDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(bifidDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(bifidExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(bifidExplanation.get(0), bifidExplanation.get(1), bifidExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(bifidFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(bifidFacts.get(0), bifidFacts.get(1), bifidFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -104,7 +117,7 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodebifid_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -144,7 +157,7 @@ public class BifidCipherControllerIntegrationTest extends CipherStreamController
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodebifid_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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 BifidCipherControllerTest{
private static final String BIFID_KEYWORD = CipherParameterUtil.KEYWORD;
private static final String bifidName = "bifidName";
private static final String bifidDescription = "bifidDescription";
private static final List<String> bifidExplanation = List.of("bifidExplanation1", "bifidExplanation2", "bifidExplanation3");
private static final List<String> bifidFacts = List.of("bifidFact1", "bifidFact2", "bifidFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(bifidCipherController, "bifidName", bifidName);
ReflectionTestUtils.setField(bifidCipherController, "bifidDescription", bifidDescription);
ReflectionTestUtils.setField(bifidCipherController, "bifidExplanation", bifidExplanation);
ReflectionTestUtils.setField(bifidCipherController, "bifidFacts", bifidFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(bifidName, bifidDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(bifidName, bifidDescription, bifidExplanation, bifidFacts);
ObjectNode returnedJson = bifidCipherController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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 ColumnarCipherControllerIntegrationTest extends CipherStreamControl
private static final String keyword = "keyword";
private static final String columnarName = "columnarName";
private static final String columnarDescription = "columnarDescription";
private static final List<String> columnarExplanation = List.of("columnarExplanation1", "columnarExplanation2", "columnarExplanation3");
private static final List<String> columnarFacts = List.of("columnarFact1", "columnarFact2", "columnarFact3");
@BeforeEach
@@ -63,6 +68,8 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl
ReflectionTestUtils.setField(columnarCipherController, "columnarName", columnarName);
ReflectionTestUtils.setField(columnarCipherController, "columnarDescription", columnarDescription);
ReflectionTestUtils.setField(columnarCipherController, "columnarExplanation", columnarExplanation);
ReflectionTestUtils.setField(columnarCipherController, "columnarFacts", columnarFacts);
}
@@ -74,7 +81,13 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(columnarName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(columnarDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(columnarDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(columnarExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(columnarExplanation.get(0), columnarExplanation.get(1), columnarExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(columnarFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(columnarFacts.get(0), columnarFacts.get(1), columnarFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -104,7 +117,7 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodecolumnar_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -144,7 +157,7 @@ public class ColumnarCipherControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodecolumnar_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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 ColumnarCipherControllerTest{
private static final String COLUMNAR_KEYWORD = CipherParameterUtil.KEYWORD;
private static final String columnarName = "columnarName";
private static final String columnarDescription = "columnarDescription";
private static final List<String> columnarExplanation = List.of("columnarExplanation1", "columnarExplanation2", "columnarExplanation3");
private static final List<String> columnarFacts = List.of("columnarFact1", "columnarFact2", "columnarFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(columnarCipherController, "columnarName", columnarName);
ReflectionTestUtils.setField(columnarCipherController, "columnarDescription", columnarDescription);
ReflectionTestUtils.setField(columnarCipherController, "columnarExplanation", columnarExplanation);
ReflectionTestUtils.setField(columnarCipherController, "columnarFacts", columnarFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(columnarName, columnarDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(columnarName, columnarDescription, columnarExplanation, columnarFacts);
ObjectNode returnedJson = columnarCipherController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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 HillCipherControllerIntegrationTest extends CipherStreamControllerI
private static final int[][] keyArray = new int[][]{{1, 4, 2}, {2, 4, 1}, {4, 1, 2}};
private static final String hillName = "hillName";
private static final String hillDescription = "hillDescription";
private static final List<String> hillExplanation = List.of("hillExplanation1", "hillExplanation2", "hillExplanation3");
private static final List<String> hillFacts = List.of("hillFact1", "hillFact2", "hillFact3");
@BeforeEach
@@ -63,6 +68,8 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI
ReflectionTestUtils.setField(hillCipherController, "hillName", hillName);
ReflectionTestUtils.setField(hillCipherController, "hillDescription", hillDescription);
ReflectionTestUtils.setField(hillCipherController, "hillExplanation", hillExplanation);
ReflectionTestUtils.setField(hillCipherController, "hillFacts", hillFacts);
}
@@ -74,7 +81,13 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(hillName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(hillDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(hillDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(hillExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(hillExplanation.get(0), hillExplanation.get(1), hillExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(hillFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(hillFacts.get(0), hillFacts.get(1), hillFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -104,7 +117,7 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodehill_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -144,7 +157,7 @@ public class HillCipherControllerIntegrationTest extends CipherStreamControllerI
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodehill_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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;
@@ -33,18 +35,22 @@ public class HillCipherControllerTest{
private static final int[][] KEY = {{1, 4, 2}, {2, 4, 1}, {4, 1, 2}};
private static final String hillName = "hillName";
private static final String hillDescription = "hillDescription";
private static final List<String> hillExplanation = List.of("hillExplanation1", "hillExplanation2", "hillExplanation3");
private static final List<String> hillFacts = List.of("hillFact1", "hillFact2", "hillFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(hillCipherController, "hillName", hillName);
ReflectionTestUtils.setField(hillCipherController, "hillDescription", hillDescription);
ReflectionTestUtils.setField(hillCipherController, "hillExplanation", hillExplanation);
ReflectionTestUtils.setField(hillCipherController, "hillFacts", hillFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(hillName, hillDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(hillName, hillDescription, hillExplanation, hillFacts);
ObjectNode returnedJson = hillCipherController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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 MorseCodeControllerIntegrationTest extends CipherStreamControllerIn
private static final String encodedString = "-- . ... ... .- --. . - --- . -. -.-. --- -.. . .---- ..--- ...--";
private static final String morseName = "morseName";
private static final String morseDescription = "morseDescription";
private static final List<String> morseExplanation = List.of("morseExplanation1", "morseExplanation2", "morseExplanation3");
private static final List<String> morseFacts = List.of("morseFact1", "morseFact2", "morseFact3");
@BeforeEach
@@ -54,6 +59,8 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn
ReflectionTestUtils.setField(morseCodeController, "morseName", morseName);
ReflectionTestUtils.setField(morseCodeController, "morseDescription", morseDescription);
ReflectionTestUtils.setField(morseCodeController, "morseExplanation", morseExplanation);
ReflectionTestUtils.setField(morseCodeController, "morseFacts", morseFacts);
}
@Test
@@ -64,7 +71,13 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(morseName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(morseDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(morseDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(morseExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(morseExplanation.get(0), morseExplanation.get(1), morseExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(morseFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(morseFacts.get(0), morseFacts.get(1), morseFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -94,7 +107,7 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodemorse_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -134,7 +147,7 @@ public class MorseCodeControllerIntegrationTest extends CipherStreamControllerIn
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodemorse_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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;
@@ -30,18 +32,22 @@ public class MorseCodeControllerTest{
private static final String MORSE_OUTPUT_STRING = "... --- ...";
private static final String morseName = "morseName";
private static final String morseDescription = "morseDescription";
private static final List<String> morseExplanation = List.of("morseExplanation1", "morseExplanation2", "morseExplanation3");
private static final List<String> morseFacts = List.of("morseFact1", "morseFact2", "morseFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(morseCodeController, "morseName", morseName);
ReflectionTestUtils.setField(morseCodeController, "morseDescription", morseDescription);
ReflectionTestUtils.setField(morseCodeController, "morseExplanation", morseExplanation);
ReflectionTestUtils.setField(morseCodeController, "morseFacts", morseFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(morseName, morseDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(morseName, morseDescription, morseExplanation, morseFacts);
ObjectNode returnedJson = morseCodeController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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;
@@ -42,6 +45,8 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl
private static final String keyword = "Play-fair@Exam ple";
private static final String playfairName = "playfairName";
private static final String playfairDescription = "playfairDescription";
private static final List<String> playfairExplanation = List.of("playfairExplanation1", "playfairExplanation2", "playfairExplanation3");
private static final List<String> playfairFacts = List.of("playfairFact1", "playfairFact2", "playfairFact3");
@BeforeEach
@@ -64,6 +69,8 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl
ReflectionTestUtils.setField(playfairCipherController, "playfairName", playfairName);
ReflectionTestUtils.setField(playfairCipherController, "playfairDescription", playfairDescription);
ReflectionTestUtils.setField(playfairCipherController, "playfairExplanation", playfairExplanation);
ReflectionTestUtils.setField(playfairCipherController, "playfairFacts", playfairFacts);
}
@@ -75,7 +82,13 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(playfairName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(playfairDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(playfairDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(playfairExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(playfairExplanation.get(0), playfairExplanation.get(1), playfairExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(playfairFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(playfairFacts.get(0), playfairFacts.get(1), playfairFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -105,7 +118,7 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodeplayfair_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -145,7 +158,7 @@ public class PlayfairCipherControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodeplayfair_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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,18 +34,22 @@ public class PlayfairCipherControllerTest{
private static final String PLAYFAIR_KEYWORD = "Play-fair@Exam ple";
private static final String playfairName = "playfairName";
private static final String playfairDescription = "playfairDescription";
private static final List<String> playfairExplanation = List.of("playfairExplanation1", "playfairExplanation2", "playfairExplanation3");
private static final List<String> playfairFacts = List.of("playfairFact1", "playfairFact2", "playfairFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(playfairCipherController, "playfairName", playfairName);
ReflectionTestUtils.setField(playfairCipherController, "playfairDescription", playfairDescription);
ReflectionTestUtils.setField(playfairCipherController, "playfairExplanation", playfairExplanation);
ReflectionTestUtils.setField(playfairCipherController, "playfairFacts", playfairFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(playfairName, playfairDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(playfairName, playfairDescription, playfairExplanation, playfairFacts);
ObjectNode returnedJson = playfairCipherController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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 PolybiusSquareControllerIntegrationTest extends CipherStreamControl
private static final String keyword = "keyword";
private static final String polybiusName = "polybiusName";
private static final String polybiusDescription = "polybiusDescription";
private static final List<String> polybiusExplanation = List.of("polybiusExplanation1", "polybiusExplanation2", "polybiusExplanation3");
private static final List<String> polybiusFacts = List.of("polybiusFact1", "polybiusFact2", "polybiusFact3");
@BeforeEach
@@ -63,6 +68,8 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl
ReflectionTestUtils.setField(polybiusSquareController, "polybiusName", polybiusName);
ReflectionTestUtils.setField(polybiusSquareController, "polybiusDescription", polybiusDescription);
ReflectionTestUtils.setField(polybiusSquareController, "polybiusExplanation", polybiusExplanation);
ReflectionTestUtils.setField(polybiusSquareController, "polybiusFacts", polybiusFacts);
}
@@ -74,7 +81,13 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(polybiusName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(polybiusDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(polybiusDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(polybiusExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(polybiusExplanation.get(0), polybiusExplanation.get(1), polybiusExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(polybiusFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(polybiusFacts.get(0), polybiusFacts.get(1), polybiusFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -104,7 +117,7 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodepolybius_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -144,7 +157,7 @@ public class PolybiusSquareControllerIntegrationTest extends CipherStreamControl
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodepolybius_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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 PolybiusSquareControllerTest{
private static final String POLYBIUS_KEYWORD = "Z Y+ X-";
private static final String polybiusName = "polybiusName";
private static final String polybiusDescription = "polybiusDescription";
private static final List<String> polybiusExplanation = List.of("PolybiusExplanation1", "PolybiusExplanation2", "PolybiusExplanation3");
private static final List<String> polybiusFacts = List.of("PolybiusFact1", "PolybiusFact2", "PolybiusFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(polybiusSquareController, "polybiusName", polybiusName);
ReflectionTestUtils.setField(polybiusSquareController, "polybiusDescription", polybiusDescription);
ReflectionTestUtils.setField(polybiusSquareController, "polybiusExplanation", polybiusExplanation);
ReflectionTestUtils.setField(polybiusSquareController, "polybiusFacts", polybiusFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(polybiusName, polybiusDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(polybiusName, polybiusDescription, polybiusExplanation, polybiusFacts);
ObjectNode returnedJson = polybiusSquareController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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 RailFenceControllerIntegrationTest extends CipherStreamControllerIn
private static final int rails = 3;
private static final String railFenceName = "railFenceName";
private static final String railFenceDescription = "railFenceDescription";
private static final List<String> railFenceExplanation = List.of("railFenceExplanation1", "railFenceExplanation2", "railFenceExplanation3");
private static final List<String> railFenceFacts = List.of("railFenceFact1", "railFenceFact2", "railFenceFact3");
@BeforeEach
@@ -63,6 +68,8 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn
ReflectionTestUtils.setField(railFenceController, "railFenceName", railFenceName);
ReflectionTestUtils.setField(railFenceController, "railFenceDescription", railFenceDescription);
ReflectionTestUtils.setField(railFenceController, "railFenceExplanation", railFenceExplanation);
ReflectionTestUtils.setField(railFenceController, "railFenceFacts", railFenceFacts);
}
@@ -74,7 +81,13 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(railFenceName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(railFenceDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(railFenceDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(railFenceExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(railFenceExplanation.get(0), railFenceExplanation.get(1), railFenceExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(railFenceFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(railFenceFacts.get(0), railFenceFacts.get(1), railFenceFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -104,7 +117,7 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncoderailFence_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -144,7 +157,7 @@ public class RailFenceControllerIntegrationTest extends CipherStreamControllerIn
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecoderailFence_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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 RailFenceControllerTest{
private static final int RAIL_FENCE_RAILS = 5;
private static final String railFenceName = "railFenceName";
private static final String railFenceDescription = "railFenceDescription";
private static final List<String> railFenceExplanation = List.of("railFenceExplanation1", "railFenceExplanation2", "railFenceExplanation3");
private static final List<String> railFenceFacts = List.of("railFenceFact1", "railFenceFact2", "railFenceFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(railFenceController, "railFenceName", railFenceName);
ReflectionTestUtils.setField(railFenceController, "railFenceDescription", railFenceDescription);
ReflectionTestUtils.setField(railFenceController, "railFenceExplanation", railFenceExplanation);
ReflectionTestUtils.setField(railFenceController, "railFenceFacts", railFenceFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(railFenceName, railFenceDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(railFenceName, railFenceDescription, railFenceExplanation, railFenceFacts);
ObjectNode returnedJson = railFenceController.getCipherInfo();

View File

@@ -1,10 +1,13 @@
package com.mattrixwv.cipherstream.controller.polysubstitution;
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;
@@ -43,6 +46,8 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle
private static final int grouplength = Integer.MAX_VALUE;
private static final String trifidName = "trifidName";
private static final String trifidDescription = "trifidDescription";
private static final List<String> trifidExplanation = List.of("trifidExplanation1", "trifidExplanation2", "trifidExplanation3");
private static final List<String> trifidFacts = List.of("trifidFact1", "trifidFact2", "trifidFact3");
@BeforeEach
@@ -69,6 +74,8 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle
ReflectionTestUtils.setField(trifidCipherController, "trifidName", trifidName);
ReflectionTestUtils.setField(trifidCipherController, "trifidDescription", trifidDescription);
ReflectionTestUtils.setField(trifidCipherController, "trifidExplanation", trifidExplanation);
ReflectionTestUtils.setField(trifidCipherController, "trifidFacts", trifidFacts);
}
@@ -80,7 +87,13 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_NAME).value(trifidName))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(trifidDescription));
.andExpect(jsonPath(CipherInfoUtil.CIPHER_DESCRIPTION).value(trifidDescription))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasSize(trifidExplanation.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_EXPLANATION, hasItems(trifidExplanation.get(0), trifidExplanation.get(1), trifidExplanation.get(2))))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS).isArray())
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasSize(trifidFacts.size())))
.andExpect(jsonPath(CipherInfoUtil.CIPHER_FACTS, hasItems(trifidFacts.get(0), trifidFacts.get(1), trifidFacts.get(2))));
//Filter
super.verifyFilter(url);
@@ -110,7 +123,7 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle
}
@Test
public void testEncodeAdfgvx_error() throws Exception{
public void testEncodetrifid_error() throws Exception{
mockMvc.perform(post(url + "/encode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)
@@ -150,7 +163,7 @@ public class TrifidCipherControllerIntegrationTest extends CipherStreamControlle
}
@Test
public void testDecodeAdfgvx_error() throws Exception{
public void testDecodetrifid_error() throws Exception{
mockMvc.perform(post(url + "/decode")
.header("X-Request-Id", requestId)
.header("X-Forwarded-For", ipAddress)

View File

@@ -3,6 +3,8 @@ package com.mattrixwv.cipherstream.controller.polysubstitution;
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;
@@ -33,18 +35,22 @@ public class TrifidCipherControllerTest{
private static final int TRIFID_GROUP_LENGTH = 3;
private static final String trifidName = "trifidName";
private static final String trifidDescription = "trifidDescription";
private static final List<String> trifidExplanation = List.of("trifidExplanation1", "trifidExplanation2", "trifidExplanation3");
private static final List<String> trifidFacts = List.of("trifidFact1", "trifidFact2", "trifidFact3");
@BeforeEach
public void setup(){
ReflectionTestUtils.setField(trifidCipherController, "trifidName", trifidName);
ReflectionTestUtils.setField(trifidCipherController, "trifidDescription", trifidDescription);
ReflectionTestUtils.setField(trifidCipherController, "trifidExplanation", trifidExplanation);
ReflectionTestUtils.setField(trifidCipherController, "trifidFacts", trifidFacts);
}
@Test
public void tetGetCipherInfo(){
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(trifidName, trifidDescription);
ObjectNode infoNode = CipherInfoUtil.buildInfoNode(trifidName, trifidDescription, trifidExplanation, trifidFacts);
ObjectNode returnedJson = trifidCipherController.getCipherInfo();