SimpleName:IDENTIFIER 70 expected expected

SimpleName:IDENTIFIER 70 NullPointerException NullPointerException

SimpleName:IDENTIFIER 71 testMapConstructorNull testMapConstructorNull

SimpleName:IDENTIFIER 72 TrieMap TrieMap

@Test(expected = NullPointerException.class)
public void testMapConstructorNull() {
    TrieMap<String> m = new TrieMap<String>(null);
}

package edu.ucla.sspace.util;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_TrieMapTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 82 expected expected

SimpleName:IDENTIFIER 82 NullPointerException NullPointerException

SimpleName:IDENTIFIER 83 testPutNullKey testPutNullKey

SimpleName:IDENTIFIER 84 TrieMap TrieMap

StringLiteralExpr:LITERAL 85 "value" "value"

@Test(expected = NullPointerException.class)
public void testPutNullKey() {
    TrieMap<String> m = new TrieMap<String>();
    m.put(null, "value");
}

SimpleName:IDENTIFIER 88 expected expected

SimpleName:IDENTIFIER 88 NullPointerException NullPointerException

SimpleName:IDENTIFIER 89 testPutNullValue testPutNullValue

SimpleName:IDENTIFIER 90 TrieMap TrieMap

StringLiteralExpr:LITERAL 91 "key" "key"

@Test(expected = NullPointerException.class)
public void testPutNullValue() {
    TrieMap<String> m = new TrieMap<String>();
    m.put("key", null);
}


SimpleName:IDENTIFIER 498 expected expected

SimpleName:IDENTIFIER 498 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 499 testIteratorRemoveTwice testIteratorRemoveTwice

SimpleName:IDENTIFIER 501 TrieMap TrieMap

StringLiteralExpr:LITERAL 502 "cat" "cat"

SimpleName:IDENTIFIER 503 assertTrue assertTrue

SimpleName:IDENTIFIER 503 containsKey containsKey

StringLiteralExpr:LITERAL 503 "cat" "cat"

SimpleName:IDENTIFIER 505 iterator iterator

@Test(expected = IllegalStateException.class)
public void testIteratorRemoveTwice() {
    TrieMap<String> m = new TrieMap<String>();
    m.put("cat", "0");
    assertTrue(m.containsKey("cat"));
    Iterator<String> it = m.keySet().iterator();
    it.next();
    it.remove();
    it.remove();
}


SimpleName:IDENTIFIER 39 expected expected

SimpleName:IDENTIFIER 39 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 40 testRemove testRemove

SimpleName:IDENTIFIER 40 Exception Exception

SimpleName:IDENTIFIER 41 getDenseBinarySVDLIBCFile getDenseBinarySVDLIBCFile

SimpleName:IDENTIFIER 42 SvdlibcDenseBinaryFileIterator SvdlibcDenseBinaryFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getDenseBinarySVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcDenseBinaryFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_SvdlibcDenseBinaryFileIteratorTests {

    private static final double[][] testMatrix = { { 1.5, 0.0, 2.5 }, { 0.0, 1.1, 3.1 }, { 1.1, 3.3, 4.1 } };

    public static File getDenseBinarySVDLIBCFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        DataOutputStream dos = new DataOutputStream(new FileOutputStream(f));
        dos.writeInt(testMatrix.length);
        dos.writeInt(testMatrix[0].length);
        for (int r = 0; r < testMatrix.length; ++r) for (int c = 0; c < testMatrix[0].length; ++c) dos.writeFloat((float) testMatrix[r][c]);
        dos.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 47 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 47 Exception Exception

SimpleName:IDENTIFIER 48 getDenseBinarySVDLIBCFile getDenseBinarySVDLIBCFile

SimpleName:IDENTIFIER 49 SvdlibcDenseBinaryFileIterator SvdlibcDenseBinaryFileIterator

SimpleName:IDENTIFIER 51 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getDenseBinarySVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcDenseBinaryFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 39 expected expected

SimpleName:IDENTIFIER 39 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 40 testRemove testRemove

SimpleName:IDENTIFIER 40 Exception Exception

SimpleName:IDENTIFIER 41 getClutoSparseFile getClutoSparseFile

SimpleName:IDENTIFIER 42 ClutoSparseFileIterator ClutoSparseFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getClutoSparseFile();
    Iterator<MatrixEntry> it = new ClutoSparseFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_ClutoSparseFileIteratorTests {

    private static final double[][] testMatrix = { { 1.5, 0.0, 2.5 }, { 0.0, 1.1, 3.1 }, { 1.1, 3.3, 4.1 } };

    public static File getClutoSparseFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        PrintWriter pw = new PrintWriter(f);
        pw.printf("%d %d %d\n", testMatrix.length, testMatrix[0].length, 7);
        for (int r = 0; r < testMatrix.length; ++r) {
            for (int c = 0; c < testMatrix[0].length; ++c) if (testMatrix[r][c] != 0d)
                pw.printf("%d %f ", c + 1, (float) testMatrix[r][c]);
            pw.println();
        }
        pw.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 47 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 47 Exception Exception

SimpleName:IDENTIFIER 48 getClutoSparseFile getClutoSparseFile

SimpleName:IDENTIFIER 49 ClutoSparseFileIterator ClutoSparseFileIterator

SimpleName:IDENTIFIER 51 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getClutoSparseFile();
    Iterator<MatrixEntry> it = new ClutoSparseFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 39 expected expected

SimpleName:IDENTIFIER 39 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 40 testRemove testRemove

SimpleName:IDENTIFIER 40 Exception Exception

SimpleName:IDENTIFIER 41 getDenseTextFile getDenseTextFile

SimpleName:IDENTIFIER 42 DenseTextFileIterator DenseTextFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getDenseTextFile();
    Iterator<MatrixEntry> it = new DenseTextFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_DenseTextFileIteratorTests {

    private static final double[][] testMatrix = { { 1.5, 0.0, 2.5 }, { 0.0, 1.1, 3.1 }, { 1.1, 3.3, 4.1 } };

    public static File getDenseTextFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        PrintWriter pw = new PrintWriter(f);
        for (int r = 0; r < testMatrix.length; ++r) {
            for (int c = 0; c < testMatrix[0].length; ++c) pw.printf("%f ", (float) testMatrix[r][c]);
            pw.println();
        }
        pw.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 47 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 47 Exception Exception

SimpleName:IDENTIFIER 48 getDenseTextFile getDenseTextFile

SimpleName:IDENTIFIER 49 DenseTextFileIterator DenseTextFileIterator

SimpleName:IDENTIFIER 51 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getDenseTextFile();
    Iterator<MatrixEntry> it = new DenseTextFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 63 expected expected

SimpleName:IDENTIFIER 63 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 64 testInvalidSet testInvalidSet

SimpleName:IDENTIFIER 66 DiagonalMatrix DiagonalMatrix

@Test(expected = IllegalArgumentException.class)
public void testInvalidSet() {
    DiagonalMatrix matrix = new DiagonalMatrix(6);
    matrix.set(1, 2, 3);
}

package edu.ucla.sspace.matrix;

import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_DiagonalMatrixTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 72 expected expected

SimpleName:IDENTIFIER 72 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 73 testInvalidSparseListMatrix testInvalidSparseListMatrix

SimpleName:IDENTIFIER 74 vectors vectors

SimpleName:IDENTIFIER 74 ArrayList ArrayList

SimpleName:IDENTIFIER 74 SparseDoubleVector SparseDoubleVector

SimpleName:IDENTIFIER 76 vectors vectors

SimpleName:IDENTIFIER 76 CompactSparseVector CompactSparseVector

SimpleName:IDENTIFIER 77 ListMatrix ListMatrix

SimpleName:IDENTIFIER 77 SparseDoubleVector SparseDoubleVector

SimpleName:IDENTIFIER 77 vectors vectors

@Test(expected = IllegalArgumentException.class)
public void testInvalidSparseListMatrix() {
    List<SparseDoubleVector> vectors = new ArrayList<SparseDoubleVector>();
    for (double[] values : INVALID_VALUES) vectors.add(new CompactSparseVector(values));
    Matrix m = new ListMatrix<SparseDoubleVector>(vectors);
}

package edu.ucla.sspace.matrix;

import edu.ucla.sspace.vector.CompactSparseVector;
import edu.ucla.sspace.vector.SparseDoubleVector;
import java.util.ArrayList;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_ListMatrixTest {

    private static final double[][] INVALID_VALUES = { { 1, 2, 4, 5 }, { 0, 0, 0, 1, 1 } };

    private static final double[][] VALUES = { { 1, 2, 4, 5 }, { 0, 0, 0, 1 }, { 0, 5, 0, 1 } };
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 40 expected expected

SimpleName:IDENTIFIER 40 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 41 testRemove testRemove

SimpleName:IDENTIFIER 41 Exception Exception

SimpleName:IDENTIFIER 42 getSparseTextSVDLIBCFile getSparseTextSVDLIBCFile

SimpleName:IDENTIFIER 43 SvdlibcSparseTextFileIterator SvdlibcSparseTextFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getSparseTextSVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcSparseTextFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_SvdlibcSparseTextFileIteratorTests {

    private static final double[][] testMatrix = { { 1.5, 0.0, 2.5 }, { 0.0, 1.1, 3.1 }, { 1.1, 3.3, 4.1 } };

    private static final int[] numNonZeros = { 2, 2, 3 };

    public static File getSparseTextSVDLIBCFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        PrintWriter pw = new PrintWriter(f);
        pw.printf("%d %d %d\n", testMatrix.length, testMatrix[0].length, 7);
        for (int c = 0; c < testMatrix[0].length; ++c) {
            pw.printf("%d\n", numNonZeros[c]);
            for (int r = 0; r < testMatrix.length; ++r) if (testMatrix[r][c] != 0d)
                pw.printf("%d %f\n", r, (float) testMatrix[r][c]);
        }
        pw.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 47 expected expected

SimpleName:IDENTIFIER 47 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 48 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 48 Exception Exception

SimpleName:IDENTIFIER 49 getSparseTextSVDLIBCFile getSparseTextSVDLIBCFile

SimpleName:IDENTIFIER 50 SvdlibcSparseTextFileIterator SvdlibcSparseTextFileIterator

SimpleName:IDENTIFIER 52 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getSparseTextSVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcSparseTextFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 39 expected expected

SimpleName:IDENTIFIER 39 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 40 testRemove testRemove

SimpleName:IDENTIFIER 40 Exception Exception

SimpleName:IDENTIFIER 41 getDenseTextSVDLIBCFile getDenseTextSVDLIBCFile

SimpleName:IDENTIFIER 42 SvdlibcDenseTextFileIterator SvdlibcDenseTextFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getDenseTextSVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcDenseTextFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_SvdlibcDenseTextFileIteratorTests {

    private static final double[][] testMatrix = { { 1.5, 0.0, 2.5 }, { 0.0, 1.1, 3.1 }, { 1.1, 3.3, 4.1 } };

    public static File getDenseTextSVDLIBCFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        PrintWriter pw = new PrintWriter(f);
        pw.printf("%d %d\n", testMatrix.length, testMatrix[0].length);
        for (int r = 0; r < testMatrix.length; ++r) {
            for (int c = 0; c < testMatrix[0].length; ++c) pw.printf("%f ", (float) testMatrix[r][c]);
            pw.println();
        }
        pw.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 47 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 47 Exception Exception

SimpleName:IDENTIFIER 48 getDenseTextSVDLIBCFile getDenseTextSVDLIBCFile

SimpleName:IDENTIFIER 49 SvdlibcDenseTextFileIterator SvdlibcDenseTextFileIterator

SimpleName:IDENTIFIER 51 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getDenseTextSVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcDenseTextFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 66 expected expected

SimpleName:IDENTIFIER 66 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 67 testFailGetColumn testFailGetColumn

SimpleName:IDENTIFIER 68 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 69 RowScaledMatrix RowScaledMatrix

SimpleName:IDENTIFIER 70 getColumn getColumn

@Test(expected = UnsupportedOperationException.class)
public void testFailGetColumn() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.getColumn(0);
}

package edu.ucla.sspace.matrix;

import edu.ucla.sspace.vector.DenseVector;
import edu.ucla.sspace.vector.DoubleVector;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_RowScaledMatrixTest {

    public static final double[][] VALUES = new double[][] { { 1, 2, 3, 4, 5 }, { 5, 6, 7, 8, 9 }, { 1, 1, 0, 0, 1 } };

    public static final double[] SCALES = new double[] { 10, .4, 1 };

    public static final DoubleVector SCALE = new DenseVector(SCALES);
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 75 expected expected

SimpleName:IDENTIFIER 75 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 76 testFailGetColumn testFailGetColumn

SimpleName:IDENTIFIER 78 RowScaledSparseMatrix RowScaledSparseMatrix

SimpleName:IDENTIFIER 79 getColumn getColumn

@Test(expected = UnsupportedOperationException.class)
public void testFailGetColumn() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.getColumn(0);
}

package edu.ucla.sspace.matrix;

import edu.ucla.sspace.vector.DenseVector;
import edu.ucla.sspace.vector.DoubleVector;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_RowScaledSparseMatrixTest {

    public static final double[][] VALUES = new double[][] { { 1, 2, 3, 4, 5 }, { 5, 6, 7, 8, 9 }, { 1, 1, 0, 0, 1 } };

    public static final double[] SCALES = new double[] { 10, .4, 1 };

    public static final DoubleVector SCALE = new DenseVector(SCALES);

    public SparseMatrix matrix() {
        SparseMatrix m = new YaleSparseMatrix(VALUES.length, VALUES[0].length);
        for (int r = 0; r < m.rows(); ++r) for (int c = 0; c < m.columns(); ++c) if (VALUES[r][c] != 0d)
            m.set(r, c, VALUES[r][c]);
        return m;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 73 expected expected

SimpleName:IDENTIFIER 73 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 74 testFailGetColumnVector testFailGetColumnVector

SimpleName:IDENTIFIER 75 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 76 RowScaledMatrix RowScaledMatrix

SimpleName:IDENTIFIER 77 getColumnVector getColumnVector

@Test(expected = UnsupportedOperationException.class)
public void testFailGetColumnVector() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.getColumnVector(0);
}


SimpleName:IDENTIFIER 80 expected expected

SimpleName:IDENTIFIER 80 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 81 testFailSet testFailSet

SimpleName:IDENTIFIER 82 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 83 RowScaledMatrix RowScaledMatrix

@Test(expected = UnsupportedOperationException.class)
public void testFailSet() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.set(0, 0, 0);
}

SimpleName:IDENTIFIER 89 expected expected

SimpleName:IDENTIFIER 89 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 90 testFailSet testFailSet

SimpleName:IDENTIFIER 92 RowScaledSparseMatrix RowScaledSparseMatrix

@Test(expected = UnsupportedOperationException.class)
public void testFailSet() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.set(0, 0, 0);
}


SimpleName:IDENTIFIER 87 expected expected

SimpleName:IDENTIFIER 87 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 88 testFailSetColumn testFailSetColumn

SimpleName:IDENTIFIER 89 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 90 RowScaledMatrix RowScaledMatrix

SimpleName:IDENTIFIER 91 setColumn setColumn

@Test(expected = UnsupportedOperationException.class)
public void testFailSetColumn() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.setColumn(0, new double[] { 1, 1, 1 });
}

SimpleName:IDENTIFIER 96 expected expected

SimpleName:IDENTIFIER 96 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 97 testFailSetColumn testFailSetColumn

SimpleName:IDENTIFIER 99 RowScaledSparseMatrix RowScaledSparseMatrix

SimpleName:IDENTIFIER 100 setColumn setColumn

@Test(expected = UnsupportedOperationException.class)
public void testFailSetColumn() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.setColumn(0, new double[] { 1, 1, 1 });
}


SimpleName:IDENTIFIER 94 expected expected

SimpleName:IDENTIFIER 94 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 95 testFailSetColumnFull testFailSetColumnFull

SimpleName:IDENTIFIER 96 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 97 RowScaledMatrix RowScaledMatrix

SimpleName:IDENTIFIER 98 setColumn setColumn

SimpleName:IDENTIFIER 98 DenseVector DenseVector

@Test(expected = UnsupportedOperationException.class)
public void testFailSetColumnFull() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.setColumn(0, new DenseVector(new double[] { 1, 1, 1 }));
}

SimpleName:IDENTIFIER 103 expected expected

SimpleName:IDENTIFIER 103 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 104 testFailSetColumnFull testFailSetColumnFull

SimpleName:IDENTIFIER 106 RowScaledSparseMatrix RowScaledSparseMatrix

SimpleName:IDENTIFIER 107 setColumn setColumn

SimpleName:IDENTIFIER 107 DenseVector DenseVector

@Test(expected = UnsupportedOperationException.class)
public void testFailSetColumnFull() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.setColumn(0, new DenseVector(new double[] { 1, 1, 1 }));
}


SimpleName:IDENTIFIER 101 expected expected

SimpleName:IDENTIFIER 101 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 102 testFailSetRow testFailSetRow

SimpleName:IDENTIFIER 103 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 104 RowScaledMatrix RowScaledMatrix

@Test(expected = UnsupportedOperationException.class)
public void testFailSetRow() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.setRow(0, VALUES[0]);
}

SimpleName:IDENTIFIER 110 expected expected

SimpleName:IDENTIFIER 110 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 111 testFailSetRow testFailSetRow

SimpleName:IDENTIFIER 113 RowScaledSparseMatrix RowScaledSparseMatrix

@Test(expected = UnsupportedOperationException.class)
public void testFailSetRow() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.setRow(0, VALUES[0]);
}


SimpleName:IDENTIFIER 108 expected expected

SimpleName:IDENTIFIER 108 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 109 testFailSetRowFull testFailSetRowFull

SimpleName:IDENTIFIER 110 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 111 RowScaledMatrix RowScaledMatrix

SimpleName:IDENTIFIER 112 DenseVector DenseVector

@Test(expected = UnsupportedOperationException.class)
public void testFailSetRowFull() {
    Matrix base = new ArrayMatrix(VALUES);
    Matrix scaled = new RowScaledMatrix(base, SCALE);
    scaled.setRow(0, new DenseVector(VALUES[0]));
}

SimpleName:IDENTIFIER 117 expected expected

SimpleName:IDENTIFIER 117 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 118 testFailSetRowFull testFailSetRowFull

SimpleName:IDENTIFIER 120 RowScaledSparseMatrix RowScaledSparseMatrix

SimpleName:IDENTIFIER 121 DenseVector DenseVector

@Test(expected = UnsupportedOperationException.class)
public void testFailSetRowFull() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.setRow(0, new DenseVector(VALUES[0]));
}


SimpleName:IDENTIFIER 35 expected expected

SimpleName:IDENTIFIER 35 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 36 testConstructorIllegalSize testConstructorIllegalSize

SimpleName:IDENTIFIER 37 OnDiskMatrix OnDiskMatrix

@Test(expected = IllegalArgumentException.class)
public void testConstructorIllegalSize() {
    new OnDiskMatrix(0, 0);
}

package edu.ucla.sspace.matrix;

import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_OnDiskMatrixTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 39 expected expected

SimpleName:IDENTIFIER 39 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 40 testRemove testRemove

SimpleName:IDENTIFIER 40 Exception Exception

SimpleName:IDENTIFIER 41 getMatlabFile getMatlabFile

SimpleName:IDENTIFIER 42 MatlabSparseFileIterator MatlabSparseFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getMatlabFile();
    Iterator<MatrixEntry> it = new MatlabSparseFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_MatlabSparseFileIteratorTests {

    private static final double[][] testMatrix = { { 2.3, 0, 4.2 }, { 0, 1.3, 2.2 }, { 3.8, 0, 0.5 } };

    public static File getMatlabFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        PrintWriter pw = new PrintWriter(f);
        for (int r = 0; r < testMatrix.length; ++r) for (int c = 0; c < testMatrix[0].length; ++c) pw.printf("%d %d %f\n", r + 1, c + 1, testMatrix[r][c]);
        pw.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 47 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 47 Exception Exception

SimpleName:IDENTIFIER 48 getMatlabFile getMatlabFile

SimpleName:IDENTIFIER 49 MatlabSparseFileIterator MatlabSparseFileIterator

SimpleName:IDENTIFIER 51 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getMatlabFile();
    Iterator<MatrixEntry> it = new MatlabSparseFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 34 expected expected

SimpleName:IDENTIFIER 34 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 35 testRemove testRemove

SimpleName:IDENTIFIER 35 Exception Exception

SimpleName:IDENTIFIER 36 getSparseBinarySVDLIBCFile getSparseBinarySVDLIBCFile

SimpleName:IDENTIFIER 37 SvdlibcSparseBinaryFileIterator SvdlibcSparseBinaryFileIterator

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    File f = getSparseBinarySVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcSparseBinaryFileIterator(f);
    it.remove();
}

package edu.ucla.sspace.matrix;

import java.io.*;
import java.util.*;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_SvdlibcSparseBinaryFileIteratorTests {

    public static File getSparseBinarySVDLIBCFile() throws Exception {
        File f = File.createTempFile("unit-test", ".dat");
        DataOutputStream pw = new DataOutputStream(new FileOutputStream(f));
        pw.writeInt(3);
        pw.writeInt(3);
        pw.writeInt(6);
        pw.writeInt(2);
        pw.writeInt(0);
        pw.writeFloat(2.3f);
        pw.writeInt(2);
        pw.writeFloat(3.8f);
        pw.writeInt(1);
        pw.writeInt(1);
        pw.writeFloat(1.3f);
        pw.writeInt(3);
        pw.writeInt(0);
        pw.writeFloat(4.2f);
        pw.writeInt(1);
        pw.writeFloat(2.2f);
        pw.writeInt(2);
        pw.writeFloat(0.5f);
        pw.close();
        return f;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 41 expected expected

SimpleName:IDENTIFIER 41 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 42 testEmptyNext testEmptyNext

SimpleName:IDENTIFIER 42 Exception Exception

SimpleName:IDENTIFIER 43 getSparseBinarySVDLIBCFile getSparseBinarySVDLIBCFile

SimpleName:IDENTIFIER 44 SvdlibcSparseBinaryFileIterator SvdlibcSparseBinaryFileIterator

SimpleName:IDENTIFIER 46 hasNext hasNext

@Test(expected = NoSuchElementException.class)
public void testEmptyNext() throws Exception {
    File f = getSparseBinarySVDLIBCFile();
    Iterator<MatrixEntry> it = new SvdlibcSparseBinaryFileIterator(f);
    while (it.hasNext()) it.next();
    it.next();
}


SimpleName:IDENTIFIER 82 expected expected

SimpleName:IDENTIFIER 82 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 83 testFailGetColumnVector testFailGetColumnVector

SimpleName:IDENTIFIER 85 RowScaledSparseMatrix RowScaledSparseMatrix

SimpleName:IDENTIFIER 86 getColumnVector getColumnVector

@Test(expected = UnsupportedOperationException.class)
public void testFailGetColumnVector() {
    SparseMatrix base = matrix();
    Matrix scaled = new RowScaledSparseMatrix(base, SCALE);
    scaled.getColumnVector(0);
}


SimpleName:IDENTIFIER 104 expected expected

SimpleName:IDENTIFIER 104 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 105 testBelowZeroOrdering testBelowZeroOrdering

SimpleName:IDENTIFIER 106 baseMatrix baseMatrix

SimpleName:IDENTIFIER 106 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 108 reordering reordering

SimpleName:IDENTIFIER 109 RowMaskedMatrix RowMaskedMatrix

SimpleName:IDENTIFIER 109 baseMatrix baseMatrix

SimpleName:IDENTIFIER 109 reordering reordering

@Test(expected = IllegalArgumentException.class)
public void testBelowZeroOrdering() {
    Matrix baseMatrix = new ArrayMatrix(VALUES);
    int[] reordering = new int[] { 1, -1, 3 };
    RowMaskedMatrix mapped = new RowMaskedMatrix(baseMatrix, reordering);
}

package edu.ucla.sspace.matrix;

import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_RowMaskedMatrixTest {

    public static final double[][] VALUES = { { 1, 2, 4, 5, 6 }, { .1, .2, .3, .4, .5 }, { 7, 8, 9, 0, 11 }, { .1, .2, .3, .4, .5 } };
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 112 expected expected

SimpleName:IDENTIFIER 112 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 113 testOutOfBoundsOrdering testOutOfBoundsOrdering

SimpleName:IDENTIFIER 114 baseMatrix baseMatrix

SimpleName:IDENTIFIER 114 ArrayMatrix ArrayMatrix

SimpleName:IDENTIFIER 116 reordering reordering

SimpleName:IDENTIFIER 117 RowMaskedMatrix RowMaskedMatrix

SimpleName:IDENTIFIER 117 baseMatrix baseMatrix

SimpleName:IDENTIFIER 117 reordering reordering

@Test(expected = IllegalArgumentException.class)
public void testOutOfBoundsOrdering() {
    Matrix baseMatrix = new ArrayMatrix(VALUES);
    int[] reordering = new int[] { 1, 2, 4 };
    RowMaskedMatrix mapped = new RowMaskedMatrix(baseMatrix, reordering);
}


SimpleName:IDENTIFIER 135 constructMalformed constructMalformed

SimpleName:IDENTIFIER 135 Exception Exception

@Test
public void constructMalformed() throws Exception {
    AlexaOutput.ask("").build();
    AlexaOutput.ask("intentName").withReader(null).build();
}

@Test(expected = IllegalArgumentException.class)
public void constructMalformed() throws Exception {
    AlexaOutput.ask("").build();
    AlexaOutput.ask("intentName").withReader(null).build();
}

package io.klerch.alexa.tellask.model;

import com.amazon.speech.ui.StandardCard;
import io.klerch.alexa.state.model.AlexaStateModel;
import io.klerch.alexa.tellask.dummies.model.AlexaStateModelSample;
import io.klerch.alexa.tellask.schema.type.AlexaOutputFormat;
import io.klerch.alexa.tellask.util.resource.ResourceUtteranceReader;
import org.hamcrest.core.Is;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.List;

public class adhoc_AlexaOutputTest {

    @Rule
    public ExpectedException exception = ExpectedException.none();
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 77 constructWithIllegalArguments constructWithIllegalArguments

SimpleName:IDENTIFIER 77 Exception Exception

@Test
public void constructWithIllegalArguments() throws Exception {
    new AlexaOutputSlot("", "value");
    new AlexaOutputSlot("name", null);
    new AlexaOutputSlot("name", "value").formatAs(null);
}

@Test(expected = IllegalArgumentException.class)
public void constructWithIllegalArguments() throws Exception {
    new AlexaOutputSlot("", "value");
    new AlexaOutputSlot("name", null);
    new AlexaOutputSlot("name", "value").formatAs(null);
}

package io.klerch.alexa.tellask.model;

import io.klerch.alexa.tellask.schema.type.AlexaOutputFormat;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.time.LocalDateTime;
import java.util.Date;

public class adhoc_AlexaOutputSlotTest {

    private final Logger LOG = Logger.getLogger(adhoc_AlexaOutputSlotTest.class);

    @Rule
    public ExpectedException exception = ExpectedException.none();

    private void testSsml(final AlexaOutputFormat format, final Object value) {
        final AlexaOutputSlot slot = new AlexaOutputSlot("name", value).formatAs(format);
        final String ssml = slot.getSsml();
        LOG.info(ssml);
        Assert.assertEquals(format.getSsml(slot.getValue()), ssml);
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 316 testNoWriteKeyInArray testNoWriteKeyInArray

SimpleName:IDENTIFIER 316 IOException IOException

SimpleName:IDENTIFIER 317 AJsonSerHelper AJsonSerHelper

SimpleName:IDENTIFIER 317 ByteArrayOutputStream ByteArrayOutputStream

SimpleName:IDENTIFIER 318 startArray startArray

SimpleName:IDENTIFIER 320 writeKey writeKey

@Test
public void testNoWriteKeyInArray() throws IOException {
    final AJsonSerHelper ser = new AJsonSerHelper(new ByteArrayOutputStream());
    ser.startArray();
    ser.writeKey("a");
}

@Test(expected = IllegalStateException.class)
public void testNoWriteKeyInArray() throws IOException {
    final AJsonSerHelper ser = new AJsonSerHelper(new ByteArrayOutputStream());
    ser.startArray();
    ser.writeKey("a");
}

package com.ajjpj.afoundation.io;

import com.ajjpj.afoundation.io.AJsonSerHelper;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import static org.junit.Assert.*;

public class adhoc_AJsonSerHelperTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 75 testCycle testCycle

SimpleName:IDENTIFIER 76 ADiGraph ADiGraph

SimpleName:IDENTIFIER 78 assertTrue assertTrue

SimpleName:IDENTIFIER 80 assertTrue assertTrue

SimpleName:IDENTIFIER 80 hasCycles hasCycles

SimpleName:IDENTIFIER 81 assertTrue assertTrue

SimpleName:IDENTIFIER 81 minimalCycles minimalCycles

SimpleName:IDENTIFIER 83 assertTrue assertTrue

SimpleName:IDENTIFIER 83 hasEdge hasEdge

SimpleName:IDENTIFIER 84 assertTrue assertTrue

SimpleName:IDENTIFIER 84 hasEdge hasEdge

SimpleName:IDENTIFIER 86 assertTrue assertTrue

SimpleName:IDENTIFIER 86 hasPath hasPath

SimpleName:IDENTIFIER 87 assertTrue assertTrue

SimpleName:IDENTIFIER 87 hasPath hasPath

SimpleName:IDENTIFIER 88 assertTrue assertTrue

SimpleName:IDENTIFIER 88 hasPath hasPath

SimpleName:IDENTIFIER 89 assertTrue assertTrue

SimpleName:IDENTIFIER 89 hasPath hasPath

SimpleName:IDENTIFIER 91 assertTrue assertTrue

SimpleName:IDENTIFIER 91 incomingEdges incomingEdges

SimpleName:IDENTIFIER 92 assertTrue assertTrue

SimpleName:IDENTIFIER 92 incomingEdges incomingEdges

SimpleName:IDENTIFIER 94 assertTrue assertTrue

SimpleName:IDENTIFIER 94 incomingPaths incomingPaths

SimpleName:IDENTIFIER 95 assertTrue assertTrue

SimpleName:IDENTIFIER 95 incomingPaths incomingPaths

SimpleName:IDENTIFIER 97 assertTrue assertTrue

SimpleName:IDENTIFIER 97 outgoingEdges outgoingEdges

SimpleName:IDENTIFIER 98 assertTrue assertTrue

SimpleName:IDENTIFIER 98 outgoingEdges outgoingEdges

SimpleName:IDENTIFIER 100 assertTrue assertTrue

SimpleName:IDENTIFIER 100 outgoingPaths outgoingPaths

SimpleName:IDENTIFIER 101 assertTrue assertTrue

SimpleName:IDENTIFIER 101 outgoingPaths outgoingPaths

SimpleName:IDENTIFIER 103 assertFalse assertFalse

SimpleName:IDENTIFIER 103 isAcyclic isAcyclic

SimpleName:IDENTIFIER 104 assertFalse assertFalse

SimpleName:IDENTIFIER 104 isForest isForest

SimpleName:IDENTIFIER 105 assertFalse assertFalse

SimpleName:IDENTIFIER 107 assertTrue assertTrue

SimpleName:IDENTIFIER 107 leafNodes leafNodes

SimpleName:IDENTIFIER 107 isEmpty isEmpty

SimpleName:IDENTIFIER 108 assertTrue assertTrue

SimpleName:IDENTIFIER 109 assertTrue assertTrue

SimpleName:IDENTIFIER 109 rootNodes rootNodes

SimpleName:IDENTIFIER 109 isEmpty isEmpty

SimpleName:IDENTIFIER 112 sortedNodesByReachability sortedNodesByReachability

@Test
public void testCycle() {
    final ADiGraph<String, ASimpleEdge<String>> graph = ADiGraph.create(Arrays.asList(edge("a", "b"), edge("b", "a")));
    assertTrue(eqSet(graph.edges(), edge("a", "b"), edge("b", "a")));
    assertTrue(graph.hasCycles());
    assertTrue(eqSet(graph.minimalCycles(), path("a", "b", "a"), path("b", "a", "b")));
    assertTrue(graph.hasEdge("a", "b"));
    assertTrue(graph.hasEdge("b", "a"));
    assertTrue(graph.hasPath("a", "b"));
    assertTrue(graph.hasPath("b", "a"));
    assertTrue(graph.hasPath("a", "a"));
    assertTrue(graph.hasPath("b", "b"));
    assertTrue(eqSet(graph.incomingEdges("a"), edge("b", "a")));
    assertTrue(eqSet(graph.incomingEdges("b"), edge("a", "b")));
    assertTrue(eqSet(graph.incomingPaths("a"), path("b", "a"), path("a", "b", "a")));
    assertTrue(eqSet(graph.incomingPaths("b"), path("a", "b"), path("b", "a", "b")));
    assertTrue(eqSet(graph.outgoingEdges("a"), edge("a", "b")));
    assertTrue(eqSet(graph.outgoingEdges("b"), edge("b", "a")));
    assertTrue(eqSet(graph.outgoingPaths("a"), path("a", "b"), path("a", "b", "a")));
    assertTrue(eqSet(graph.outgoingPaths("b"), path("b", "a"), path("b", "a", "b")));
    assertFalse(graph.isAcyclic());
    assertFalse(graph.isForest());
    assertFalse(graph.isTree());
    assertTrue(graph.leafNodes().isEmpty());
    assertTrue(eqSet(graph.nodes(), "a", "b"));
    assertTrue(graph.rootNodes().isEmpty());
    graph.sortedNodesByReachability();
}

@Test(expected = AGraphCircularityException.class)
public void testCycle() {
    final ADiGraph<String, ASimpleEdge<String>> graph = ADiGraph.create(Arrays.asList(edge("a", "b"), edge("b", "a")));
    assertTrue(eqSet(graph.edges(), edge("a", "b"), edge("b", "a")));
    assertTrue(graph.hasCycles());
    assertTrue(eqSet(graph.minimalCycles(), path("a", "b", "a"), path("b", "a", "b")));
    assertTrue(graph.hasEdge("a", "b"));
    assertTrue(graph.hasEdge("b", "a"));
    assertTrue(graph.hasPath("a", "b"));
    assertTrue(graph.hasPath("b", "a"));
    assertTrue(graph.hasPath("a", "a"));
    assertTrue(graph.hasPath("b", "b"));
    assertTrue(eqSet(graph.incomingEdges("a"), edge("b", "a")));
    assertTrue(eqSet(graph.incomingEdges("b"), edge("a", "b")));
    assertTrue(eqSet(graph.incomingPaths("a"), path("b", "a"), path("a", "b", "a")));
    assertTrue(eqSet(graph.incomingPaths("b"), path("a", "b"), path("b", "a", "b")));
    assertTrue(eqSet(graph.outgoingEdges("a"), edge("a", "b")));
    assertTrue(eqSet(graph.outgoingEdges("b"), edge("b", "a")));
    assertTrue(eqSet(graph.outgoingPaths("a"), path("a", "b"), path("a", "b", "a")));
    assertTrue(eqSet(graph.outgoingPaths("b"), path("b", "a"), path("b", "a", "b")));
    assertFalse(graph.isAcyclic());
    assertFalse(graph.isForest());
    assertFalse(graph.isTree());
    assertTrue(graph.leafNodes().isEmpty());
    assertTrue(eqSet(graph.nodes(), "a", "b"));
    assertTrue(graph.rootNodes().isEmpty());
    graph.sortedNodesByReachability();
}

package com.ajjpj.afoundation.collection.graph;

import com.ajjpj.afoundation.collection.immutable.AHashSet;
import com.ajjpj.afoundation.collection.immutable.AList;
import org.junit.Test;
import java.util.*;
import static org.junit.Assert.*;

@SuppressWarnings("unchecked")
public class adhoc_ADiGraphTest {

    private static ASimpleEdge<String> edge(String from, String to) {
        return new ASimpleEdge<>(from, to);
    }

    private static AEdgePath<String, ASimpleEdge<String>> path(String first, String... others) {
        final List<ASimpleEdge<String>> edges = new ArrayList<>();
        AHashSet<String> nodeSet = AHashSet.create(first);
        String from, to = first;
        for (String target : others) {
            nodeSet = nodeSet.with(target);
            from = to;
            to = target;
            edges.add(edge(from, to));
        }
        return new AEdgePath<>(AList.create(edges), nodeSet, to);
    }

    private <T> boolean eqSet(Iterable<T> coll1, T... values) {
        return eqSet(coll1, Arrays.asList(values));
    }

    private <T> boolean eqSet(Iterable<T> coll1, Iterable<T> coll2) {
        final Set<T> set1 = new HashSet<>();
        final Set<T> set2 = new HashSet<>();
        for (T o : coll1) {
            set1.add(o);
        }
        for (T o : coll2) {
            set2.add(o);
        }
        return set1.equals(set2);
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 57 testNone testNone

SimpleName:IDENTIFIER 57 Exception Exception

SimpleName:IDENTIFIER 58 AOption AOption

@Test
public void testNone() throws Exception {
    final AOption<String> s = AOption.none();
    s.get();
}

@Test(expected = NoSuchElementException.class)
public void testNone() throws Exception {
    final AOption<String> s = AOption.none();
    s.get();
}

package com.ajjpj.afoundation.collection;

import com.ajjpj.afoundation.collection.immutable.AOption;
import com.ajjpj.afoundation.function.AFunction0NoThrow;
import com.ajjpj.afoundation.function.AFunction1;
import com.ajjpj.afoundation.function.APredicate;
import org.junit.Test;
import java.io.IOException;
import java.util.NoSuchElementException;
import static org.junit.Assert.*;

public class adhoc_AOptionTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 23 testHasNextPlusNext testHasNextPlusNext

@Test
public void testHasNextPlusNext() {
    final ACompositeIterator<Integer> iter = new ACompositeIterator<>(Arrays.asList(Arrays.asList(1, 2, 3, 4).iterator(), Arrays.asList(5, 6, 7, 8).iterator(), Arrays.asList(9, 10).iterator()));
    int expected = 1;
    while (expected <= 10) {
        assertTrue(iter.hasNext());
        int elem = iter.next();
        assertEquals(expected, elem);
        expected++;
    }
    assertFalse(iter.hasNext());
    iter.next();
}

@Test(expected = NoSuchElementException.class)
public void testHasNextPlusNext() {
    final ACompositeIterator<Integer> iter = new ACompositeIterator<>(Arrays.asList(Arrays.asList(1, 2, 3, 4).iterator(), Arrays.asList(5, 6, 7, 8).iterator(), Arrays.asList(9, 10).iterator()));
    int expected = 1;
    while (expected <= 10) {
        assertTrue(iter.hasNext());
        int elem = iter.next();
        assertEquals(expected, elem);
        expected++;
    }
    assertFalse(iter.hasNext());
    iter.next();
}

package com.ajjpj.afoundation.collection;

import com.ajjpj.afoundation.collection.ACompositeIterator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.NoSuchElementException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class adhoc_ACompositeIteratorTest {

    @Rule
    public ExpectedException expectedException = ExpectedException.none();
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 43 testPureNext testPureNext

@Test
public void testPureNext() {
    final ACompositeIterator<Integer> iter = new ACompositeIterator<>(Arrays.asList(Arrays.asList(1, 2, 3, 4).iterator(), Arrays.asList(5, 6, 7, 8).iterator(), Arrays.asList(9, 10).iterator()));
    int expected = 1;
    while (expected <= 10) {
        int elem = iter.next();
        assertEquals(expected, elem);
        expected++;
    }
    iter.next();
}

@Test(expected = NoSuchElementException.class)
public void testPureNext() {
    final ACompositeIterator<Integer> iter = new ACompositeIterator<>(Arrays.asList(Arrays.asList(1, 2, 3, 4).iterator(), Arrays.asList(5, 6, 7, 8).iterator(), Arrays.asList(9, 10).iterator()));
    int expected = 1;
    while (expected <= 10) {
        int elem = iter.next();
        assertEquals(expected, elem);
        expected++;
    }
    iter.next();
}


SimpleName:IDENTIFIER 22 testHexStringToByteArray testHexStringToByteArray

SimpleName:IDENTIFIER 23 assertEquals assertEquals

SimpleName:IDENTIFIER 23 StringHelper StringHelper

SimpleName:IDENTIFIER 23 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 24 assertEq assertEq

SimpleName:IDENTIFIER 24 StringHelper StringHelper

SimpleName:IDENTIFIER 24 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 25 assertEq assertEq

SimpleName:IDENTIFIER 25 StringHelper StringHelper

SimpleName:IDENTIFIER 25 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 26 assertEq assertEq

SimpleName:IDENTIFIER 26 StringHelper StringHelper

SimpleName:IDENTIFIER 26 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 27 assertEq assertEq

SimpleName:IDENTIFIER 27 StringHelper StringHelper

SimpleName:IDENTIFIER 27 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 29 assertEq assertEq

SimpleName:IDENTIFIER 29 StringHelper StringHelper

SimpleName:IDENTIFIER 29 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 30 assertEq assertEq

SimpleName:IDENTIFIER 30 StringHelper StringHelper

SimpleName:IDENTIFIER 30 hexStringToByteArray hexStringToByteArray

SimpleName:IDENTIFIER 33 StringHelper StringHelper

SimpleName:IDENTIFIER 33 hexStringToByteArray hexStringToByteArray

@Test
public void testHexStringToByteArray() {
    assertEquals(null, StringHelper.hexStringToByteArray(null));
    assertEq(new byte[] {}, StringHelper.hexStringToByteArray(""));
    assertEq(new byte[] { 0, 1, 2 }, StringHelper.hexStringToByteArray("000102"));
    assertEq(new byte[] { 14, 15, 16 }, StringHelper.hexStringToByteArray("0E0F10"));
    assertEq(new byte[] { -128, -1 }, StringHelper.hexStringToByteArray("80FF"));
    assertEq(new byte[] { 26 }, StringHelper.hexStringToByteArray("1a"));
    assertEq(new byte[] { -2 }, StringHelper.hexStringToByteArray("fE"));
    StringHelper.hexStringToByteArray("1");
}

@Test(expected = Exception.class)
public void testHexStringToByteArray() {
    assertEquals(null, StringHelper.hexStringToByteArray(null));
    assertEq(new byte[] {}, StringHelper.hexStringToByteArray(""));
    assertEq(new byte[] { 0, 1, 2 }, StringHelper.hexStringToByteArray("000102"));
    assertEq(new byte[] { 14, 15, 16 }, StringHelper.hexStringToByteArray("0E0F10"));
    assertEq(new byte[] { -128, -1 }, StringHelper.hexStringToByteArray("80FF"));
    assertEq(new byte[] { 26 }, StringHelper.hexStringToByteArray("1a"));
    assertEq(new byte[] { -2 }, StringHelper.hexStringToByteArray("fE"));
    StringHelper.hexStringToByteArray("1");
}

package com.ajjpj.afoundation.util;

import com.ajjpj.afoundation.util.StringHelper;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_StringHelperTest {

    private void assertEq(byte[] b1, byte[] b2) {
        assertEquals(b1.length, b2.length);
        for (int i = 0; i < b1.length; i++) {
            assertEquals(b1[i], b2[i]);
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 16 expected expected

SimpleName:IDENTIFIER 16 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 17 Exception Exception

SimpleName:IDENTIFIER 18 somefile somefile

SimpleName:IDENTIFIER 18 createTempFile createTempFile

StringLiteralExpr:LITERAL 18 "somefile" "somefile"

SimpleName:IDENTIFIER 19 compressedFile compressedFile

SimpleName:IDENTIFIER 19 CompressedFile CompressedFile

SimpleName:IDENTIFIER 19 somefile somefile

@Test(expected = IllegalArgumentException.class)
public void passingInAFileThatDoesNotHaveAFileNameEndingInGZOrBZ2ThrowsError() throws Exception {
    File somefile = File.createTempFile("somefile", ".tmp");
    CompressedFile compressedFile = new CompressedFile(somefile);
}

package com.lazerycode.selenium.extract;

import com.lazerycode.selenium.exceptions.InvalidFileTypeException;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static com.lazerycode.selenium.extract.DownloadableFileType.TAR;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;

public class adhoc_CompressedFileTest {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 22 expected expected

SimpleName:IDENTIFIER 22 InvalidFileTypeException InvalidFileTypeException

SimpleName:IDENTIFIER 23 Exception Exception

SimpleName:IDENTIFIER 24 somefile somefile

SimpleName:IDENTIFIER 24 createTempFile createTempFile

StringLiteralExpr:LITERAL 24 "somefile" "somefile"

SimpleName:IDENTIFIER 25 compressedFile compressedFile

SimpleName:IDENTIFIER 25 CompressedFile CompressedFile

SimpleName:IDENTIFIER 25 somefile somefile

@Test(expected = InvalidFileTypeException.class)
public void passingInAFileThatDoesNotHaveAFileNameEndingInGZOrBZ2ButIsAKnownArchiveTypeThrowsError() throws Exception {
    File somefile = File.createTempFile("somefile", ".zip");
    CompressedFile compressedFile = new CompressedFile(somefile);
}


SimpleName:IDENTIFIER 28 expected expected

SimpleName:IDENTIFIER 28 IOException IOException

SimpleName:IDENTIFIER 29 Exception Exception

SimpleName:IDENTIFIER 30 somefile somefile

SimpleName:IDENTIFIER 30 createTempFile createTempFile

StringLiteralExpr:LITERAL 30 "somefile" "somefile"

SimpleName:IDENTIFIER 31 compressedFile compressedFile

SimpleName:IDENTIFIER 31 CompressedFile CompressedFile

SimpleName:IDENTIFIER 31 somefile somefile

SimpleName:IDENTIFIER 32 compressedFile compressedFile

SimpleName:IDENTIFIER 32 getInputStream getInputStream

@Test(expected = IOException.class)
public void passingInAFileThatIsNotAGZFileThrowsErrorWhenYouTryToGetAnInputStream() throws Exception {
    File somefile = File.createTempFile("somefile", ".tmp.gz");
    CompressedFile compressedFile = new CompressedFile(somefile);
    compressedFile.getInputStream();
}

SimpleName:IDENTIFIER 67 expected expected

SimpleName:IDENTIFIER 67 IOException IOException

SimpleName:IDENTIFIER 68 Exception Exception

SimpleName:IDENTIFIER 69 somefile somefile

SimpleName:IDENTIFIER 69 createTempFile createTempFile

StringLiteralExpr:LITERAL 69 "somefile" "somefile"

SimpleName:IDENTIFIER 70 compressedFile compressedFile

SimpleName:IDENTIFIER 70 CompressedFile CompressedFile

SimpleName:IDENTIFIER 70 somefile somefile

SimpleName:IDENTIFIER 71 compressedFile compressedFile

SimpleName:IDENTIFIER 71 getInputStream getInputStream

@Test(expected = IOException.class)
public void passingInAFileThatIsNotABZ2FileThrowsErrorWhenYouTryToGetAnInputStream() throws Exception {
    File somefile = File.createTempFile("somefile", ".tmp.bz2");
    CompressedFile compressedFile = new CompressedFile(somefile);
    compressedFile.getInputStream();
}


SimpleName:IDENTIFIER 137 expected expected

SimpleName:IDENTIFIER 137 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 138 tryToUntarAnArchiveThatIsNotATarFile tryToUntarAnArchiveThatIsNotATarFile

SimpleName:IDENTIFIER 138 Exception Exception

SimpleName:IDENTIFIER 139 fileExtractor fileExtractor

SimpleName:IDENTIFIER 139 FileExtractor FileExtractor

SimpleName:IDENTIFIER 140 fileExtractor fileExtractor

SimpleName:IDENTIFIER 140 extractFileFromArchive extractFileFromArchive

SimpleName:IDENTIFIER 140 getFile getFile

SimpleName:IDENTIFIER 140 tempDir tempDir

SimpleName:IDENTIFIER 140 BinaryType BinaryType

SimpleName:IDENTIFIER 140 PHANTOMJS PHANTOMJS

@Test(expected = IllegalArgumentException.class)
public void tryToUntarAnArchiveThatIsNotATarFile() throws Exception {
    FileExtractor fileExtractor = new FileExtractor(DO_NOT_OVERWRITE_EXISTING_FILES);
    fileExtractor.extractFileFromArchive(new File(test7ZipFile.getFile()), tempDir, BinaryType.PHANTOMJS);
}

package com.lazerycode.selenium.extract;

import com.lazerycode.selenium.repository.BinaryType;
import org.apache.commons.codec.digest.DigestUtils;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;

public class adhoc_FileExtractorTest {

    private static final boolean OVERWRITE_EXISTING_FILES = true;

    private static final boolean DO_NOT_OVERWRITE_EXISTING_FILES = false;

    private static final String VALID_HASH = "add36bb347a987b56e533c2034fd37b1";

    private static final String VALID_HASH_FOR_EXE = "0a263b6c69c81e137d74240350e293bc0ca604a3";

    private final URL test7ZipFile = this.getClass().getResource("/jetty/files/download.7z");

    private final URL testZipFile = this.getClass().getResource("/jetty/files/download.zip");

    private final URL testTarGZFile = this.getClass().getResource("/jetty/files/download.tar.gz");

    private final URL testTarBZ2File = this.getClass().getResource("/jetty/files/download.tar.bz2");

    private final URL textExeFile = this.getClass().getResource("/jetty/files/MicrosoftWebDriver.exe");

    private final URL testFirefoxZipFile = this.getClass().getResource("/jetty/files/FirefoxPortable.zip");

    private final URL testFirefoxTarFile = this.getClass().getResource("/jetty/files/FirefoxPortable.tar.bz2");

    private static File phantomJSTestFile;

    private static String tempDir;

    @Before
    public void initialiseFile() {
        String tempDirectory = System.getProperty("java.io.tmpdir");
        if (tempDirectory.endsWith(File.separator)) {
            tempDir = System.getProperty("java.io.tmpdir") + java.util.UUID.randomUUID();
        } else {
            tempDir = System.getProperty("java.io.tmpdir") + File.separator + java.util.UUID.randomUUID();
        }
        phantomJSTestFile = new File(tempDir + File.separator + "phantomjs");
    }

    @After
    public void cleanUp() {
        if (phantomJSTestFile.exists()) {
            assertThat(phantomJSTestFile.delete(), is(equalTo(true)));
        }
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 176 expected expected

SimpleName:IDENTIFIER 176 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 177 tryAndExtractFromAnUnsupportedArchive tryAndExtractFromAnUnsupportedArchive

SimpleName:IDENTIFIER 177 Exception Exception

SimpleName:IDENTIFIER 178 fileExtractor fileExtractor

SimpleName:IDENTIFIER 178 FileExtractor FileExtractor

SimpleName:IDENTIFIER 179 fileExtractor fileExtractor

SimpleName:IDENTIFIER 179 extractFileFromArchive extractFileFromArchive

SimpleName:IDENTIFIER 179 getFile getFile

SimpleName:IDENTIFIER 179 tempDir tempDir

SimpleName:IDENTIFIER 179 BinaryType BinaryType

SimpleName:IDENTIFIER 179 PHANTOMJS PHANTOMJS

@Test(expected = IllegalArgumentException.class)
public void tryAndExtractFromAnUnsupportedArchive() throws Exception {
    FileExtractor fileExtractor = new FileExtractor(DO_NOT_OVERWRITE_EXISTING_FILES);
    fileExtractor.extractFileFromArchive(new File(test7ZipFile.getFile()), tempDir, BinaryType.PHANTOMJS);
}


SimpleName:IDENTIFIER 79 expected expected

SimpleName:IDENTIFIER 79 MojoExecutionException MojoExecutionException

SimpleName:IDENTIFIER 80 downloadAFile downloadAFile

SimpleName:IDENTIFIER 80 Exception Exception

SimpleName:IDENTIFIER 81 fileDetails fileDetails

SimpleName:IDENTIFIER 81 DriverDetails DriverDetails

DriverDetails fileDetails = new DriverDetails()

DriverDetails fileDetails = new DriverDetails();

SimpleName:IDENTIFIER 82 fileDetails fileDetails

SimpleName:IDENTIFIER 82 fileLocation fileLocation

SimpleName:IDENTIFIER 82 downloadZipURL downloadZipURL

SimpleName:IDENTIFIER 83 fileDetails fileDetails

SimpleName:IDENTIFIER 83 hashType hashType

SimpleName:IDENTIFIER 84 fileDetails fileDetails

SimpleName:IDENTIFIER 85 driverMap driverMap

SimpleName:IDENTIFIER 85 DriverMap DriverMap

SimpleName:IDENTIFIER 86 driverMap driverMap

SimpleName:IDENTIFIER 86 getMapForDriverContext getMapForDriverContext

SimpleName:IDENTIFIER 86 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 86 GOOGLECHROME GOOGLECHROME

SimpleName:IDENTIFIER 86 fileDetails fileDetails

SimpleName:IDENTIFIER 87 downloadTestFile downloadTestFile

SimpleName:IDENTIFIER 87 DownloadHandler DownloadHandler

SimpleName:IDENTIFIER 87 downloadDirectory downloadDirectory

SimpleName:IDENTIFIER 87 oneRetryAttempt oneRetryAttempt

SimpleName:IDENTIFIER 87 connectTimeout connectTimeout

SimpleName:IDENTIFIER 87 readTimeout readTimeout

SimpleName:IDENTIFIER 87 doNotOverwriteFilesThatExist doNotOverwriteFilesThatExist

SimpleName:IDENTIFIER 87 checkFileHashes checkFileHashes

SimpleName:IDENTIFIER 87 doNotUseSystemProxy doNotUseSystemProxy

SimpleName:IDENTIFIER 87 getAllVersions getAllVersions

SimpleName:IDENTIFIER 88 downloadTestFile downloadTestFile

SimpleName:IDENTIFIER 88 downloadFile downloadFile

SimpleName:IDENTIFIER 88 fileDetails fileDetails

SimpleName:IDENTIFIER 88 checkFileHashes checkFileHashes

@Test(expected = MojoExecutionException.class)
public void downloadAFile() throws Exception {
    DriverDetails fileDetails = new DriverDetails();
    fileDetails.fileLocation = downloadZipURL;
    fileDetails.hashType = SHA1;
    fileDetails.hash = "";
    DriverMap driverMap = new DriverMap();
    driverMap.getMapForDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT)).put("2.13", fileDetails);
    DownloadHandler downloadTestFile = new DownloadHandler(null, downloadDirectory, oneRetryAttempt, connectTimeout, readTimeout, null, doNotOverwriteFilesThatExist, checkFileHashes, doNotUseSystemProxy, getAllVersions);
    downloadTestFile.downloadFile(fileDetails, checkFileHashes);
}

package com.lazerycode.selenium.download;

import com.lazerycode.selenium.repository.DriverContext;
import com.lazerycode.selenium.repository.DriverDetails;
import com.lazerycode.selenium.repository.DriverMap;
import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.junit.*;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import static com.lazerycode.selenium.hash.HashType.SHA1;
import static com.lazerycode.selenium.repository.BinaryType.GOOGLECHROME;
import static com.lazerycode.selenium.repository.BinaryType.PHANTOMJS;
import static com.lazerycode.selenium.repository.DriverContext.binaryDataFor;
import static com.lazerycode.selenium.repository.OperatingSystem.OSX;
import static com.lazerycode.selenium.repository.SystemArchitecture.ARCHITECTURE_64_BIT;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;

public class adhoc_DownloadHandlerTest {

    private static final String webServerAddress = "http://localhost";

    private static final int webServerPort = 9081;

    private final String downloadDirectoryPath = System.getProperty("java.io.tmpdir") + File.separator + "download_test_file_dir";

    private final String rootStandaloneServerDirectoryPath = System.getProperty("java.io.tmpdir") + File.separator + "server_test_file_dir";

    private final String expectedDownloadedFilePath = downloadDirectoryPath + File.separator + "download.zip";

    private final int oneRetryAttempt = 1;

    private final int connectTimeout = 15000;

    private final int readTimeout = 15000;

    private final boolean overwriteFilesThatExist = true;

    private final boolean doNotOverwriteFilesThatExist = false;

    private final boolean doNotCheckFileHashes = false;

    private final boolean checkFileHashes = true;

    private final boolean doNotUseSystemProxy = false;

    private final boolean getAllVersions = false;

    private static final String validSHA1Hash = "8604c05969a0eefa0edf0d71ae809310832afdc7";

    private static final JettyServer localWebServer = new JettyServer();

    private static final String webServerURL = webServerAddress + ":" + webServerPort;

    private static DriverMap validDriverMap = new DriverMap();

    private static DriverDetails validFileDetails = new DriverDetails();

    private static File downloadDirectory;

    private static File rootStandaloneServerDirectory;

    private static URL downloadZipURL;

    @BeforeClass
    public static void start() throws Exception {
        localWebServer.startJettyServer(webServerPort);
        downloadZipURL = new URL(webServerURL + "/files/download.zip");
        validFileDetails.fileLocation = downloadZipURL;
        validFileDetails.hashType = SHA1;
        validFileDetails.hash = validSHA1Hash;
        validDriverMap.getMapForDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT)).put("2.13", validFileDetails);
    }

    @AfterClass
    public static void stop() throws Exception {
        localWebServer.stopJettyServer();
    }

    @Before
    public void instantiateTestFiles() throws Exception {
        downloadDirectory = new File(downloadDirectoryPath);
        rootStandaloneServerDirectory = new File(rootStandaloneServerDirectoryPath);
    }

    @After
    public void cleanUpFiles() throws IOException {
        if (downloadDirectory.exists())
            FileUtils.deleteDirectory(downloadDirectory);
        if (rootStandaloneServerDirectory.exists())
            FileUtils.deleteDirectory(rootStandaloneServerDirectory);
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 91 expected expected

SimpleName:IDENTIFIER 91 MojoExecutionException MojoExecutionException

SimpleName:IDENTIFIER 92 invalidHashCheck invalidHashCheck

SimpleName:IDENTIFIER 92 Exception Exception

SimpleName:IDENTIFIER 93 fileDetails fileDetails

SimpleName:IDENTIFIER 93 DriverDetails DriverDetails

DriverDetails fileDetails = new DriverDetails()

DriverDetails fileDetails = new DriverDetails();

SimpleName:IDENTIFIER 94 fileDetails fileDetails

SimpleName:IDENTIFIER 94 fileLocation fileLocation

SimpleName:IDENTIFIER 94 downloadZipURL downloadZipURL

SimpleName:IDENTIFIER 95 fileDetails fileDetails

SimpleName:IDENTIFIER 95 hashType hashType

SimpleName:IDENTIFIER 96 fileDetails fileDetails

StringLiteralExpr:LITERAL 96 "invalidHash" "invalidHash"

SimpleName:IDENTIFIER 97 driverMap driverMap

SimpleName:IDENTIFIER 97 DriverMap DriverMap

SimpleName:IDENTIFIER 98 driverMap driverMap

SimpleName:IDENTIFIER 98 getMapForDriverContext getMapForDriverContext

SimpleName:IDENTIFIER 98 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 98 GOOGLECHROME GOOGLECHROME

SimpleName:IDENTIFIER 98 fileDetails fileDetails

SimpleName:IDENTIFIER 99 downloadTestFile downloadTestFile

SimpleName:IDENTIFIER 99 DownloadHandler DownloadHandler

SimpleName:IDENTIFIER 99 downloadDirectory downloadDirectory

SimpleName:IDENTIFIER 99 oneRetryAttempt oneRetryAttempt

SimpleName:IDENTIFIER 99 connectTimeout connectTimeout

SimpleName:IDENTIFIER 99 readTimeout readTimeout

SimpleName:IDENTIFIER 99 doNotOverwriteFilesThatExist doNotOverwriteFilesThatExist

SimpleName:IDENTIFIER 99 checkFileHashes checkFileHashes

SimpleName:IDENTIFIER 99 doNotUseSystemProxy doNotUseSystemProxy

SimpleName:IDENTIFIER 99 getAllVersions getAllVersions

SimpleName:IDENTIFIER 100 downloadTestFile downloadTestFile

SimpleName:IDENTIFIER 100 downloadFile downloadFile

SimpleName:IDENTIFIER 100 fileDetails fileDetails

SimpleName:IDENTIFIER 100 checkFileHashes checkFileHashes

@Test(expected = MojoExecutionException.class)
public void invalidHashCheck() throws Exception {
    DriverDetails fileDetails = new DriverDetails();
    fileDetails.fileLocation = downloadZipURL;
    fileDetails.hashType = SHA1;
    fileDetails.hash = "invalidHash";
    DriverMap driverMap = new DriverMap();
    driverMap.getMapForDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT)).put("2.13", fileDetails);
    DownloadHandler downloadTestFile = new DownloadHandler(null, downloadDirectory, oneRetryAttempt, connectTimeout, readTimeout, null, doNotOverwriteFilesThatExist, checkFileHashes, doNotUseSystemProxy, getAllVersions);
    downloadTestFile.downloadFile(fileDetails, checkFileHashes);
}

SimpleName:IDENTIFIER 111 expected expected

SimpleName:IDENTIFIER 111 MojoExecutionException MojoExecutionException

SimpleName:IDENTIFIER 112 tryToDownloadAnInvalidFile tryToDownloadAnInvalidFile

SimpleName:IDENTIFIER 112 Exception Exception

SimpleName:IDENTIFIER 113 fileDetails fileDetails

SimpleName:IDENTIFIER 113 DriverDetails DriverDetails

DriverDetails fileDetails = new DriverDetails()

DriverDetails fileDetails = new DriverDetails();

SimpleName:IDENTIFIER 114 fileDetails fileDetails

SimpleName:IDENTIFIER 114 fileLocation fileLocation

SimpleName:IDENTIFIER 114 webServerURL webServerURL

new URL(webServerURL + "/files/null/download.zip")

SimpleName:IDENTIFIER 115 fileDetails fileDetails

SimpleName:IDENTIFIER 115 hashType hashType

SimpleName:IDENTIFIER 116 fileDetails fileDetails

SimpleName:IDENTIFIER 117 driverMap driverMap

SimpleName:IDENTIFIER 117 DriverMap DriverMap

SimpleName:IDENTIFIER 118 driverMap driverMap

SimpleName:IDENTIFIER 118 getMapForDriverContext getMapForDriverContext

SimpleName:IDENTIFIER 118 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 118 GOOGLECHROME GOOGLECHROME

SimpleName:IDENTIFIER 118 fileDetails fileDetails

SimpleName:IDENTIFIER 119 downloadTestFile downloadTestFile

SimpleName:IDENTIFIER 119 DownloadHandler DownloadHandler

SimpleName:IDENTIFIER 119 downloadDirectory downloadDirectory

SimpleName:IDENTIFIER 119 connectTimeout connectTimeout

SimpleName:IDENTIFIER 119 readTimeout readTimeout

SimpleName:IDENTIFIER 119 doNotOverwriteFilesThatExist doNotOverwriteFilesThatExist

SimpleName:IDENTIFIER 119 checkFileHashes checkFileHashes

SimpleName:IDENTIFIER 119 doNotUseSystemProxy doNotUseSystemProxy

SimpleName:IDENTIFIER 119 getAllVersions getAllVersions

SimpleName:IDENTIFIER 120 downloadTestFile downloadTestFile

SimpleName:IDENTIFIER 120 downloadFile downloadFile

SimpleName:IDENTIFIER 120 fileDetails fileDetails

SimpleName:IDENTIFIER 120 checkFileHashes checkFileHashes

@Test(expected = MojoExecutionException.class)
public void tryToDownloadAnInvalidFile() throws Exception {
    DriverDetails fileDetails = new DriverDetails();
    fileDetails.fileLocation = new URL(webServerURL + "/files/null/download.zip");
    fileDetails.hashType = SHA1;
    fileDetails.hash = validSHA1Hash;
    DriverMap driverMap = new DriverMap();
    driverMap.getMapForDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT)).put("2.13", fileDetails);
    DownloadHandler downloadTestFile = new DownloadHandler(null, downloadDirectory, 3, connectTimeout, readTimeout, null, doNotOverwriteFilesThatExist, checkFileHashes, doNotUseSystemProxy, getAllVersions);
    downloadTestFile.downloadFile(fileDetails, checkFileHashes);
}


SimpleName:IDENTIFIER 49 expected expected

SimpleName:IDENTIFIER 49 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 51 driverMap driverMap

SimpleName:IDENTIFIER 51 DriverMap DriverMap

SimpleName:IDENTIFIER 52 driverMap driverMap

SimpleName:IDENTIFIER 52 getDetailsForVersionOfDriverContext getDetailsForVersionOfDriverContext

SimpleName:IDENTIFIER 52 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 52 GOOGLECHROME GOOGLECHROME

@Test(expected = IllegalArgumentException.class)
public void willThrowAnExceptionWhenTryingToGetSpecificVersionMapForInvalidContext() {
    DriverMap driverMap = new DriverMap();
    driverMap.getDetailsForVersionOfDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT), "4");
}

package com.lazerycode.selenium.repository;

import com.lazerycode.selenium.hash.HashType;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import static com.lazerycode.selenium.repository.BinaryType.GOOGLECHROME;
import static com.lazerycode.selenium.repository.BinaryType.OPERACHROMIUM;
import static com.lazerycode.selenium.repository.DriverContext.binaryDataFor;
import static com.lazerycode.selenium.repository.OperatingSystem.OSX;
import static com.lazerycode.selenium.repository.OperatingSystem.WINDOWS;
import static com.lazerycode.selenium.repository.SystemArchitecture.ARCHITECTURE_32_BIT;
import static com.lazerycode.selenium.repository.SystemArchitecture.ARCHITECTURE_64_BIT;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsInstanceOf.instanceOf;

public class adhoc_DriverMapTest {
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 55 expected expected

SimpleName:IDENTIFIER 55 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 57 driverMap driverMap

SimpleName:IDENTIFIER 57 DriverMap DriverMap

SimpleName:IDENTIFIER 58 originalVersionMap originalVersionMap

SimpleName:IDENTIFIER 58 driverMap driverMap

SimpleName:IDENTIFIER 58 getMapForDriverContext getMapForDriverContext

SimpleName:IDENTIFIER 58 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 58 GOOGLECHROME GOOGLECHROME

SimpleName:IDENTIFIER 59 originalVersionMap originalVersionMap

SimpleName:IDENTIFIER 59 DriverDetails DriverDetails

SimpleName:IDENTIFIER 61 driverMap driverMap

SimpleName:IDENTIFIER 61 getDetailsForVersionOfDriverContext getDetailsForVersionOfDriverContext

SimpleName:IDENTIFIER 61 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 61 GOOGLECHROME GOOGLECHROME

@Test(expected = NoSuchElementException.class)
public void willThrowAnExceptionWhenTryingToGetAnInvalidVersion() {
    DriverMap driverMap = new DriverMap();
    Map originalVersionMap = driverMap.getMapForDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT));
    originalVersionMap.put("2.13", new DriverDetails());
    driverMap.getDetailsForVersionOfDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT), "4");
}


SimpleName:IDENTIFIER 64 expected expected

SimpleName:IDENTIFIER 64 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 66 driverMap driverMap

SimpleName:IDENTIFIER 66 DriverMap DriverMap

SimpleName:IDENTIFIER 67 driverMap driverMap

SimpleName:IDENTIFIER 67 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 67 GOOGLECHROME GOOGLECHROME

@Test(expected = IllegalArgumentException.class)
public void willThrowAnExceptionWhenTryingToGetLatestVersionMapForInvalidContext() {
    DriverMap driverMap = new DriverMap();
    driverMap.getDetailsForLatestVersionOfDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT));
}

SimpleName:IDENTIFIER 70 expected expected

SimpleName:IDENTIFIER 70 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 72 driverMap driverMap

SimpleName:IDENTIFIER 72 DriverMap DriverMap

SimpleName:IDENTIFIER 73 driverMap driverMap

SimpleName:IDENTIFIER 73 getMapForDriverContext getMapForDriverContext

SimpleName:IDENTIFIER 73 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 73 GOOGLECHROME GOOGLECHROME

SimpleName:IDENTIFIER 75 driverMap driverMap

SimpleName:IDENTIFIER 75 binaryDataFor binaryDataFor

SimpleName:IDENTIFIER 75 GOOGLECHROME GOOGLECHROME

@Test(expected = NoSuchElementException.class)
public void willThrowAnExceptionWhenTryingToGetAnInvalidLatestVersion() {
    DriverMap driverMap = new DriverMap();
    driverMap.getMapForDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT));
    driverMap.getDetailsForLatestVersionOfDriverContext(binaryDataFor(OSX, GOOGLECHROME, ARCHITECTURE_64_BIT));
}


SimpleName:IDENTIFIER 15 expected expected

SimpleName:IDENTIFIER 15 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 17 OperatingSystem OperatingSystem

SimpleName:IDENTIFIER 17 getOperatingSystem getOperatingSystem

StringLiteralExpr:LITERAL 17 "foo" "foo"

@Test(expected = IllegalArgumentException.class)
public void willThrowAnIllegalArgumentExceptionIfOperatingSystemIsNotValid() {
    OperatingSystem.getOperatingSystem("foo");
}

package com.lazerycode.selenium.repository;

import org.junit.Test;
import java.util.HashSet;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertThat;

public class adhoc_OperatingSystemTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 27 expected expected

SimpleName:IDENTIFIER 27 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 28 Exception Exception

SimpleName:IDENTIFIER 29 hashTypeAdaptor hashTypeAdaptor

SimpleName:IDENTIFIER 29 HashTypeAdaptor HashTypeAdaptor

SimpleName:IDENTIFIER 30 hashTypeAdaptor hashTypeAdaptor

SimpleName:IDENTIFIER 30 unmarshal unmarshal

StringLiteralExpr:LITERAL 30 "FOO" "FOO"

@Test(expected = IllegalArgumentException.class)
public void throwsAnIllegalArgumentExceptionIfHashTypeIsInvalid() throws Exception {
    HashTypeAdaptor hashTypeAdaptor = new HashTypeAdaptor();
    hashTypeAdaptor.unmarshal("FOO");
}

package com.lazerycode.selenium.hash;

import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;

public class adhoc_HashTypeAdaptorTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 133 expected expected

SimpleName:IDENTIFIER 133 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 134 testTokenInvalidAlgorithms testTokenInvalidAlgorithms

SimpleName:IDENTIFIER 134 IOException IOException

SimpleName:IDENTIFIER 135 validAlgorithms validAlgorithms

SimpleName:IDENTIFIER 135 SignatureAlgorithm SignatureAlgorithm

SimpleName:IDENTIFIER 136 validAlgorithms validAlgorithms

SimpleName:IDENTIFIER 137 ValidationToken ValidationToken

SimpleName:IDENTIFIER 137 Builder Builder

SimpleName:IDENTIFIER 137 privateKey privateKey

SimpleName:IDENTIFIER 138 algorithm algorithm

StringLiteralExpr:LITERAL 139 "GET" "GET"

StringLiteralExpr:LITERAL 140 "/Messages" "/Messages"

SimpleName:IDENTIFIER 141 queryString queryString

SimpleName:IDENTIFIER 142 headers headers

SimpleName:IDENTIFIER 143 signedHeaders signedHeaders

SimpleName:IDENTIFIER 144 requestBody requestBody

StringLiteralExpr:LITERAL 144 "foobar" "foobar"

SimpleName:IDENTIFIER 148 getClaimFromJwtToken getClaimFromJwtToken

@Test(expected = IllegalArgumentException.class)
public void testTokenInvalidAlgorithms() throws IOException {
    List<SignatureAlgorithm> validAlgorithms = Arrays.asList(SignatureAlgorithm.HS256, SignatureAlgorithm.ES256, RS384, RS512, PS384, PS512);
    for (SignatureAlgorithm alg : validAlgorithms) {
        Jwt jwt = new ValidationToken.Builder(ACCOUNT_SID, CREDENTIAL_SID, SIGNING_KEY_SID, privateKey).algorithm(alg).method("GET").uri("/Messages").queryString("PageSize=5&Limit=10").headers(headers).signedHeaders(SIGNED_HEADERS).requestBody("foobar").build();
        getClaimFromJwtToken(jwt);
    }
}

package com.twilio.jwt.validation;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.twilio.http.ValidationInterceptor;
import com.twilio.jwt.Jwt;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.message.BasicHeader;
import org.apache.hc.core5.http.message.BasicHttpRequest;
import org.apache.hc.core5.http.message.RequestLine;
import org.apache.hc.core5.net.URIAuthority;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import static org.mockito.Mockito.when;
import static io.jsonwebtoken.SignatureAlgorithm.PS256;
import static io.jsonwebtoken.SignatureAlgorithm.PS384;
import static io.jsonwebtoken.SignatureAlgorithm.PS512;
import static io.jsonwebtoken.SignatureAlgorithm.RS256;
import static io.jsonwebtoken.SignatureAlgorithm.RS384;
import static io.jsonwebtoken.SignatureAlgorithm.RS512;

public class adhoc_ValidationTokenTest {

    private static final List<String> SIGNED_HEADERS = Arrays.asList("host", "authorization");

    private static final String ACCOUNT_SID = "AC123";

    private static final String CREDENTIAL_SID = "CR123";

    private static final String SIGNING_KEY_SID = "SK123";

    private Header[] headers;

    private PrivateKey privateKey;

    private PublicKey publicKey;

    @Mock
    private HttpRequest request;

    @Mock
    private RequestLine requestLine;

    @Mock
    private ClassicHttpRequest requestWithEntity;

    @Mock
    private HttpEntity entity;

    @Before
    public void setup() throws Exception {
        MockitoAnnotations.openMocks(this);
        headers = new Header[2];
        headers[0] = new BasicHeader("host", "api.twilio.com");
        headers[1] = new BasicHeader("authorization", "foobar");
        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
        keyGen.initialize(2048);
        KeyPair pair = keyGen.generateKeyPair();
        privateKey = pair.getPrivate();
        publicKey = pair.getPublic();
    }

    private Claims getClaimFromJwtToken(Jwt token) throws IOException {
        io.jsonwebtoken.Jwt<?, ?> claims = Jwts.parser().verifyWith(publicKey).build().parse(token.toJwt());
        ObjectMapper objectMapper = new ObjectMapper();
        Map<String, ?> map = (Map<String, ?>) objectMapper.readValue((byte[]) claims.getPayload(), Map.class);
        return Jwts.claims().add(map).build();
    }

    private BasicHttpRequest getBasicRequest() {
        return new BasicHttpRequest("GET", "/some-url?with=params", new URIAuthority("api.twilio.com:443"), "");
    }

    private void validateToken(Claims claims) {
        Assert.assertEquals(SIGNING_KEY_SID, claims.getIssuer());
        Assert.assertEquals(ACCOUNT_SID, claims.getSubject());
        Assert.assertNotNull(claims.getExpiration());
        Assert.assertNotNull(claims.get("hrh"));
        Assert.assertNotNull(claims.get("rqh"));
        Assert.assertTrue(claims.getExpiration().getTime() > new Date().getTime());
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 171 expected expected

SimpleName:IDENTIFIER 171 InvalidRequestException InvalidRequestException

StringLiteralExpr:LITERAL
173
"/this is a bad path"
"/this is a bad path"

SimpleName:IDENTIFIER 175 canonicalizeWithPath canonicalizeWithPath

@Test(expected = InvalidRequestException.class)
public void testInvalidUriPathPassedToRequestCanonicalizer() {
    String path = "/this is a bad path";
    canonicalizeWithPath(path);
}

package com.twilio.jwt.validation;

import com.twilio.exception.InvalidRequestException;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.message.BasicHeader;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
import java.util.List;

public class adhoc_RequestCanonicalizerTest {

    private static final List<String> signedHeaders = Arrays.asList("authorization", "duplicate", "host");

    private static final int PATH_LINE = 1;

    private static final int QUERY_LINE = 2;

    private Header[] headers;

    @Before
    public void setup() {
        headers = new Header[4];
        headers[0] = new BasicHeader("host", "api.twilio.com");
        headers[1] = new BasicHeader("authorization", "foobar");
        headers[2] = new BasicHeader("duplicate", "value2");
        headers[3] = new BasicHeader("Duplicate", "value1");
    }

    private String canonicalizeWithPath(String path) {
        return new RequestCanonicalizer("GET", path, "queryParam2=Hello+World", "foobar", headers).create(signedHeaders);
    }

    private String canonicalizeWithQueryParams(String queryParams) {
        return new RequestCanonicalizer("GET", "/Messages", queryParams, "foobar", headers).create(signedHeaders);
    }

    private String getLine(int lineNumber, String canonicalRequest) {
        return canonicalRequest.split("\n")[lineNumber];
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 101 testSetFormParametersNull testSetFormParametersNull

SimpleName:IDENTIFIER 102 request request

SimpleName:IDENTIFIER 102 IRequest IRequest

SimpleName:IDENTIFIER 102 HttpMethod HttpMethod

SimpleName:IDENTIFIER 105 request request

SimpleName:IDENTIFIER 105 setFormParameters setFormParameters

"Should have thrown IllegalArgumentException"

@Test
public void testSetFormParametersNull() {
    IRequest request = new IRequest(HttpMethod.POST, "http://example.com");
    request.setFormParameters(null);
}

@Test(expected = IllegalArgumentException.class)
public void testSetFormParametersNull() {
    IRequest request = new IRequest(HttpMethod.POST, "http://example.com");
    request.setFormParameters(null);
}

package com.twilio.http;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import com.twilio.http.IRequest.FormParameters;
import com.twilio.http.IRequest.FormParameters.Type;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

public class adhoc_IRequestTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 44 expected expected

SimpleName:IDENTIFIER 44 ApiException ApiException

SimpleName:IDENTIFIER 45 testConstructURLURISyntaxException testConstructURLURISyntaxException

SimpleName:IDENTIFIER 46 request request

SimpleName:IDENTIFIER 46 Request Request

SimpleName:IDENTIFIER 46 HttpMethod HttpMethod

SimpleName:IDENTIFIER 47 request request

SimpleName:IDENTIFIER 47 constructURL constructURL

StringLiteralExpr:LITERAL
48
"ApiException was expected"
"ApiException was expected"

@Test(expected = ApiException.class)
public void testConstructURLURISyntaxException() {
    Request request = new Request(HttpMethod.DELETE, "http://{");
    request.constructURL();
    fail("ApiException was expected");
}

package com.twilio.http;

import com.twilio.constant.EnumConstants;
import com.twilio.exception.ApiException;
import com.twilio.rest.Domains;
import java.time.ZonedDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.LocalDate;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.URL;
import static com.twilio.Assert.assertQueryStringsEqual;
import static com.twilio.Assert.assertUrlsEqual;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertThat;

public class adhoc_RequestTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 27 expected expected

SimpleName:IDENTIFIER 27 JsonMappingException JsonMappingException

SimpleName:IDENTIFIER 28 testInvalidCurrency testInvalidCurrency

SimpleName:IDENTIFIER 28 IOException IOException

StringLiteralExpr:LITERAL
29
"{ \"currency\": \"poo\" }"
"{ \"currency\": \"poo\" }"

SimpleName:IDENTIFIER 30 ObjectMapper ObjectMapper

SimpleName:IDENTIFIER 32 Container Container

SimpleName:IDENTIFIER 32 fromJson fromJson

@Test(expected = JsonMappingException.class)
public void testInvalidCurrency() throws IOException {
    String json = "{ \"currency\": \"poo\" }";
    ObjectMapper mapper = new ObjectMapper();
    Container.fromJson(json, mapper);
}

package com.twilio.converter;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.util.Currency;

public class adhoc_CurrencyDeserializerTest {

    private static class Container {

        private final Currency currency;

        public Container(@JsonProperty("currency") @JsonDeserialize(using = CurrencyDeserializer.class) Currency currency) {
            this.currency = currency;
        }

        public static Container fromJson(String json, ObjectMapper mapper) throws IOException {
            return mapper.readValue(json, Container.class);
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 61 expected expected

SimpleName:IDENTIFIER 61 AuthenticationException AuthenticationException

SimpleName:IDENTIFIER 62 testGetRestClientNullAccountSid testGetRestClientNullAccountSid

SimpleName:IDENTIFIER 63 setRestClient setRestClient

SimpleName:IDENTIFIER 64 setUsername setUsername

SimpleName:IDENTIFIER 65 setPassword setPassword

SimpleName:IDENTIFIER 67 getRestClient getRestClient

StringLiteralExpr:LITERAL
68
"AuthenticationException was expected"
"AuthenticationException was expected"

@Test(expected = AuthenticationException.class)
public void testGetRestClientNullAccountSid() {
    Twilio.setRestClient(null);
    Twilio.setUsername(null);
    Twilio.setPassword(null);
    Twilio.getRestClient();
    fail("AuthenticationException was expected");
}

package com.twilio;

import com.twilio.exception.ApiException;
import com.twilio.exception.AuthenticationException;
import com.twilio.exception.CertificateValidationException;
import com.twilio.http.HttpMethod;
import com.twilio.http.NetworkHttpClient;
import com.twilio.http.Request;
import com.twilio.http.Response;
import com.twilio.http.TwilioRestClient;
import com.twilio.type.RegionEndpoints;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.mockito.MockitoAnnotations;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.when;

public class adhoc_TwilioTest {

    private static final String USER_NAME = "UserName";

    private static final String TOKEN = "Password";

    public static String serialize(Object object) {
        return object.toString();
    }

    public static String serialize(List list) {
        return list.get(0).toString();
    }

    @Mock
    private NetworkHttpClient networkHttpClient;

    @Before
    public void init() {
        MockitoAnnotations.openMocks(this);
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 71 expected expected

SimpleName:IDENTIFIER 71 AuthenticationException AuthenticationException

SimpleName:IDENTIFIER 72 testSetAccountSidNull testSetAccountSidNull

SimpleName:IDENTIFIER 73 setUsername setUsername

StringLiteralExpr:LITERAL
74
"AuthenticationException was expected"
"AuthenticationException was expected"

@Test(expected = AuthenticationException.class)
public void testSetAccountSidNull() {
    Twilio.setUsername(null);
    fail("AuthenticationException was expected");
}


SimpleName:IDENTIFIER 77 expected expected

SimpleName:IDENTIFIER 77 AuthenticationException AuthenticationException

SimpleName:IDENTIFIER 78 testSetAuthTokenNull testSetAuthTokenNull

SimpleName:IDENTIFIER 79 setPassword setPassword

StringLiteralExpr:LITERAL
80
"AuthenticationException was expected"
"AuthenticationException was expected"

@Test(expected = AuthenticationException.class)
public void testSetAuthTokenNull() {
    Twilio.setPassword(null);
    fail("AuthenticationException was expected");
}


SimpleName:IDENTIFIER 133 testValidateSslCertificateError testValidateSslCertificateError

SimpleName:IDENTIFIER 134 request request

SimpleName:IDENTIFIER 134 Request Request

SimpleName:IDENTIFIER 134 HttpMethod HttpMethod

SimpleName:IDENTIFIER 135 networkHttpClient networkHttpClient

SimpleName:IDENTIFIER 135 makeRequest makeRequest

SimpleName:IDENTIFIER 135 request request

SimpleName:IDENTIFIER 135 thenReturn thenReturn

SimpleName:IDENTIFIER 135 Response Response

SimpleName:IDENTIFIER 137 validateSslCertificate validateSslCertificate

SimpleName:IDENTIFIER 137 networkHttpClient networkHttpClient

"Unexpected response from certificate endpoint"

@Test
public void testValidateSslCertificateError() {
    final Request request = new Request(HttpMethod.GET, "https://tls-test.twilio.com:443");
    when(networkHttpClient.makeRequest(request)).thenReturn(new Response("", 500));
    Twilio.validateSslCertificate(networkHttpClient);
}

@Test(expected = CertificateValidationException.class)
public void testValidateSslCertificateError() {
    final Request request = new Request(HttpMethod.GET, "https://tls-test.twilio.com:443");
    when(networkHttpClient.makeRequest(request)).thenReturn(new Response("", 500));
    Twilio.validateSslCertificate(networkHttpClient);
}

SimpleName:IDENTIFIER 145 testValidateSslCertificateException testValidateSslCertificateException

SimpleName:IDENTIFIER 146 request request

SimpleName:IDENTIFIER 146 Request Request

SimpleName:IDENTIFIER 146 HttpMethod HttpMethod

SimpleName:IDENTIFIER 147 networkHttpClient networkHttpClient

SimpleName:IDENTIFIER 147 makeRequest makeRequest

SimpleName:IDENTIFIER 147 request request

SimpleName:IDENTIFIER 147 thenThrow thenThrow

SimpleName:IDENTIFIER 147 ApiException ApiException

SimpleName:IDENTIFIER 150 validateSslCertificate validateSslCertificate

SimpleName:IDENTIFIER 150 networkHttpClient networkHttpClient

"Could not get response from certificate endpoint"

@Test
public void testValidateSslCertificateException() {
    final Request request = new Request(HttpMethod.GET, "https://tls-test.twilio.com:443");
    when(networkHttpClient.makeRequest(request)).thenThrow(new ApiException("No"));
    Twilio.validateSslCertificate(networkHttpClient);
}

@Test(expected = CertificateValidationException.class)
public void testValidateSslCertificateException() {
    final Request request = new Request(HttpMethod.GET, "https://tls-test.twilio.com:443");
    when(networkHttpClient.makeRequest(request)).thenThrow(new ApiException("No"));
    Twilio.validateSslCertificate(networkHttpClient);
}


SimpleName:IDENTIFIER 34 expected expected

SimpleName:IDENTIFIER 34 NullPointerException NullPointerException

SimpleName:IDENTIFIER 35 testErrorShouldBeSentWithNull testErrorShouldBeSentWithNull

SimpleName:IDENTIFIER 36 governor governor

SimpleName:IDENTIFIER 36 ErrorGovernor ErrorGovernor

SimpleName:IDENTIFIER 37 governor governor

SimpleName:IDENTIFIER 37 errorShouldBeSent errorShouldBeSent

@Test(expected = NullPointerException.class)
public void testErrorShouldBeSentWithNull() {
    ErrorGovernor governor = new ErrorGovernor();
    governor.errorShouldBeSent(null);
}

package com.stackify.api.common.error;

import org.junit.Assert;
import org.junit.Test;
import com.stackify.api.ErrorItem;
import com.stackify.api.StackifyError;

public class adhoc_ErrorGovernorTest {
    /*TEST PLACEHOLDER*/
}

testErrorShouldBeSentWithNull


SimpleName:IDENTIFIER 35 expected expected

SimpleName:IDENTIFIER 35 NullPointerException NullPointerException

SimpleName:IDENTIFIER 36 testGetBaseErrorWithNull testGetBaseErrorWithNull

SimpleName:IDENTIFIER 37 ErrorCounter ErrorCounter

SimpleName:IDENTIFIER 37 getBaseError getBaseError

{
    ErrorCounter.getBaseError(null);
}

@Test(expected = NullPointerException.class)
public void testGetBaseErrorWithNull() {
    ErrorCounter.getBaseError(null);
}

{
    ErrorCounter.getBaseError(null);
}

package com.stackify.api.common.error;

import org.junit.Assert;
import org.junit.Test;
import com.stackify.api.ErrorItem;
import com.stackify.api.StackifyError;
import com.stackify.api.common.codec.MessageDigests;

public class adhoc_ErrorCounterTest {
    /*TEST PLACEHOLDER*/
}

testGetBaseErrorWithNull


SimpleName:IDENTIFIER 57 expected expected

SimpleName:IDENTIFIER 57 NullPointerException NullPointerException

SimpleName:IDENTIFIER 58 testGetUniqueKeyWithNull testGetUniqueKeyWithNull

SimpleName:IDENTIFIER 59 ErrorCounter ErrorCounter

SimpleName:IDENTIFIER 59 getUniqueKey getUniqueKey

{
    ErrorCounter.getUniqueKey(null);
}

@Test(expected = NullPointerException.class)
public void testGetUniqueKeyWithNull() {
    ErrorCounter.getUniqueKey(null);
}

{
    ErrorCounter.getUniqueKey(null);
}

testGetUniqueKeyWithNull


SimpleName:IDENTIFIER 111 expected expected

SimpleName:IDENTIFIER 111 NullPointerException NullPointerException

SimpleName:IDENTIFIER 112 testIncrementCounterWithNull testIncrementCounterWithNull

SimpleName:IDENTIFIER 113 errorCounter errorCounter

SimpleName:IDENTIFIER 113 ErrorCounter ErrorCounter

SimpleName:IDENTIFIER 114 errorCounter errorCounter

SimpleName:IDENTIFIER 114 incrementCounter incrementCounter

@Test(expected = NullPointerException.class)
public void testIncrementCounterWithNull() {
    ErrorCounter errorCounter = new ErrorCounter();
    errorCounter.incrementCounter(null, 0);
}

testIncrementCounterWithNull


SimpleName:IDENTIFIER 37 expected expected

SimpleName:IDENTIFIER 37 NullPointerException NullPointerException

SimpleName:IDENTIFIER 38 testGetCausalChainWithNull testGetCausalChainWithNull

SimpleName:IDENTIFIER 39 Throwables Throwables

SimpleName:IDENTIFIER 39 getCausalChain getCausalChain

{
    Throwables.getCausalChain(null);
}

@Test(expected = NullPointerException.class)
public void testGetCausalChainWithNull() {
    Throwables.getCausalChain(null);
}

{
    Throwables.getCausalChain(null);
}

package com.stackify.api.common.lang;

import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.stackify.api.ErrorItem;
import com.stackify.api.TraceFrame;

public class adhoc_ThrowablesTest {
    /*TEST PLACEHOLDER*/
}

testGetCausalChainWithNull


SimpleName:IDENTIFIER 31 expected expected

SimpleName:IDENTIFIER 31 NullPointerException NullPointerException

SimpleName:IDENTIFIER 33 MessageDigests MessageDigests

@Test(expected = NullPointerException.class)
public void testMd5HexWithNull() {
    MessageDigests.md5Hex(null);
}

package com.stackify.api.common.codec;

import org.junit.Assert;
import org.junit.Test;

public class adhoc_MessageDigestsTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 38 testCheckNotNullWithNull testCheckNotNullWithNull

SimpleName:IDENTIFIER 39 Preconditions Preconditions

SimpleName:IDENTIFIER 39 checkNotNull checkNotNull

{
    Preconditions.checkNotNull(null);
}

@Test(expected = NullPointerException.class)
public void testCheckNotNullWithNull() {
    Preconditions.checkNotNull(null);
}

{
    Preconditions.checkNotNull(null);
}

package com.stackify.api.common.util;

import org.junit.Test;

public class adhoc_PreconditionsTest {
    /*TEST PLACEHOLDER*/
}

testCheckNotNullWithNull


SimpleName:IDENTIFIER 53 expected expected

SimpleName:IDENTIFIER 53 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 54 testCheckArgumentFalse testCheckArgumentFalse

SimpleName:IDENTIFIER 55 Preconditions Preconditions

SimpleName:IDENTIFIER 55 checkArgument checkArgument

BooleanLiteralExpr:LITERAL 55 false false

{
    Preconditions.checkArgument(false);
}

@Test(expected = IllegalArgumentException.class)
public void testCheckArgumentFalse() {
    Preconditions.checkArgument(false);
}

{
    Preconditions.checkArgument(false);
}

testCheckArgumentFalse


SimpleName:IDENTIFIER 66 testInitWrong testInitWrong

SimpleName:IDENTIFIER 66 Exception Exception

SimpleName:IDENTIFIER 67 exporter exporter

SimpleName:IDENTIFIER 68 exporter exporter

SimpleName:IDENTIFIER 68 XRemotingExporter XRemotingExporter

SimpleName:IDENTIFIER 70 exporter exporter

SimpleName:IDENTIFIER 70 setServiceInterface setServiceInterface

SimpleName:IDENTIFIER 70 CoolServiceInterface CoolServiceInterface

SimpleName:IDENTIFIER 71 exporter exporter

SimpleName:IDENTIFIER 71 setService setService

SimpleName:IDENTIFIER 71 CoolService CoolService

SimpleName:IDENTIFIER 72 exporter exporter

SimpleName:IDENTIFIER 72 setSerializer setSerializer

SimpleName:IDENTIFIER 72 XStreamSerializer XStreamSerializer

SimpleName:IDENTIFIER 73 exporter exporter

SimpleName:IDENTIFIER 73 setSerializerClass setSerializerClass

SimpleName:IDENTIFIER 73 XStreamSerializer XStreamSerializer

SimpleName:IDENTIFIER 76 exporter exporter

SimpleName:IDENTIFIER 76 afterPropertiesSet afterPropertiesSet

@Test
public void testInitWrong() throws Exception {
    XRemotingExporter exporter;
    exporter = new XRemotingExporter();
    exporter.setServiceInterface(CoolServiceInterface.class);
    exporter.setService(new CoolService());
    exporter.setSerializer(new XStreamSerializer());
    exporter.setSerializerClass(XStreamSerializer.class);
    exporter.afterPropertiesSet();
}

@Test(expected = IllegalArgumentException.class)
public void testInitWrong() throws Exception {
    XRemotingExporter exporter;
    exporter = new XRemotingExporter();
    exporter.setServiceInterface(CoolServiceInterface.class);
    exporter.setService(new CoolService());
    exporter.setSerializer(new XStreamSerializer());
    exporter.setSerializerClass(XStreamSerializer.class);
    exporter.afterPropertiesSet();
}

package com.googlecode.xremoting.spring;

import org.junit.Assert;
import org.junit.Test;
import com.googlecode.xremoting.core.test.CoolService;
import com.googlecode.xremoting.core.test.CoolServiceInterface;
import com.googlecode.xremoting.core.xstream.XStreamSerializer;

public class adhoc_XRemotingExporterTest {
    /*TEST PLACEHOLDER*/
}