TriangleList2 { public TriangleList2 readFile(String fileNameIn) throws IOException { Scanner scanFile = new Scanner(new File(fileNameIn)); Triangle[] myList = new Triangle[20]; String tListName = ""; int numTriangles = 0; double side1 = 0, side2 = 0, side3 = 0; listName = scanFile.nextLine(); while (scanFile.hasNext()) { side1 = Double.parseDouble(scanFile.nextLine()); side2 = Double.parseDouble(scanFile.nextLine()); side3 = Double.parseDouble(scanFile.nextLine()); Triangle t = new Triangle(side1, side2, side3); myList[numTriangles] = t; numTriangles++; } TriangleList2 tL = new TriangleList2(listName, myList, numTriangles); return tL; } TriangleList2(String listNameIn, Triangle[] tListIn, 
                        int numberOfTrianglesIn); String getListName(); Triangle[] getList(); int numTriangles(); double totalOfPerimeters(); double totalOfPerimeters2(); double smallestPerimeter(); double largestPerimeter(); String largestPerimeterWithSides(); String toString(); String summary(); TriangleList2 readFile(String fileNameIn); void addTriangle(double s1In, double s2In, double s3In); boolean deleteTriangle(double s1In, double s2In, double s3In);  }
@Test public void readFileTest() throws IOException { Triangle[] tArray = new Triangle[20]; tArray[0] = new Triangle(3, 4, 5); tArray[1] = new Triangle(3, 5, 5); tArray[2] = new Triangle(3, 3, 3); TriangleList2 tList = new TriangleList2("Test List", null, 0); tList = tList.readFile("triangle.txt"); Assert.assertEquals("Nice Small Set of Triangles", tList.getListName()); }