Package ass1.project

Source Code of ass1.project.CipherTest

package ass1.project;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import ass1.project.core.Ass1Cipher;

public class CipherTest {

  @Test
  public void testEncrypt() {
    byte[] input = "ABC".getBytes();
    byte[] result = new Ass1Cipher().encrypt(input);
    assertEquals("FAKFAYXZXZXZ", new String(result));

    input = "supraja\n".getBytes();
    result = new Ass1Cipher().encrypt(input);
    assertEquals("IWSBOXLIBTFWFDAAXZXZXZXZXZXZXZXZ", new String(result));

  }

  @Test
  public void testDecrypt() {
    byte[] input = "FAKFAYXZXZXZ".getBytes();
    assertEquals("ABC", new String(new Ass1Cipher().decrypt(input)));

    input = "IWSBOXLIBTFWFDAAXZXZXZXZXZXZXZXZ".getBytes();
    assertEquals("supraja\n", new String(new Ass1Cipher().decrypt(input)));
  }

}
TOP

Related Classes of ass1.project.CipherTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.