Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Deserialization Tests Begin */
- @Test
- public void invalidMessageType() throws KVException{
- sock = setupSocket("invalidMessageType.txt");
- KVMessage kvm = new KVMessage("wrong_type");
- assertNotNull(kvm);
- try{
- kvm.sendMessage(sock);
- } catch(KVException e){
- assertEquals(ERROR_INVALID_FORMAT, e.getKVMessage().getMessage());
- }
- }
- I'm trying to make the output stream atm.
- private Socket setupOutputSocket(String filename) {
- sock = mock(Socket.class);
- File f = new File(System.getProperty("user.dir"), TEST_INPUT_DIR + filename);
- try {
- doNothing().when(sock).setSoTimeout(anyInt());
- when(sock.getOutputStream()).thenAnswer(new FileInputStream(f));
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return sock;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement