<file_sep>import org.testng.Assert;
import org.testng.annotations.Test;

public class TriangleTest {
    @Test
    public void equilateralTest() {
        Assert.assertEquals(Triangle.function("3", "3", "3"), "3 - Equilateral равносторонний");
        Assert.assertEquals(Triangle.function("6", "6", "6"), "3 - Equilateral равносторонний");
        Assert.assertEquals(Triangle.function("2", "2", "2"), "3 - Equilateral равносторонний");
    }

    @Test
    public void isoscelesTest() {
        Assert.assertEquals(Triangle.function("5", "5", "3"), "2 - Isosceles равнобедренный");
        Assert.assertEquals(Triangle.function("3", "5", "3"), "2 - Isosceles равнобедренный");
    }

    @Test
    public void erorTest() {
        Assert.assertEquals(Triangle.function("5", "0", "3"), "4 - Error");
        Assert.assertEquals(Triangle.function("5", "shyjcg", "3"), "4 - Error");
        Assert.assertEquals(Triangle.function("-5", "4", "3"), "4 - Error");
        Assert.assertEquals(Triangle.function("5", "0", "0"), "4 - Error");
        Assert.assertEquals(Triangle.function("5", "0", "dfh"), "4 - Error");
        Assert.assertEquals(Triangle.function("5.0", "0", "dfh"), "4 - Error");
        Assert.assertEquals(Triangle.function("null", "4", "7"), "4 - Error");


    }
}
<file_sep>import java.util.Scanner;

public class Triangle {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        System.out.print("Enter some a: ");
        String a1 = in.nextLine();
        System.out.print("Enter some b: ");
        String b1 = in.nextLine();
        System.out.print("Enter some c: ");
        String c1 = in.nextLine();
        System.out.println("Your input is a:" + a1 + " b:" + b1 + " c:" + c1);

        String result = function(a1, b1, c1);
        System.out.print(result);
    }

    public static String function(String a1, String b1, String c1) {

        int a = 0;
        int b = 0;
        int c = 0;
        try {
            a = Integer.parseInt(a1);
            b = Integer.parseInt(b1);
            c = Integer.parseInt(c1);
        } catch (NumberFormatException e) {
            return "4 - Error";
        }

        if ((a<=0) || (b<=0) || (c<=0)) return "4 - Error";
        if ((a==b) && (a==c))  return "3 - Equilateral равносторонний"; else
        if ((a==b) || (a==c) || (c==b))   return "2 - Isosceles равнобедренный";
        else return "1 - Scalene Неравносторонний";
    }
}

