summaryrefslogtreecommitdiff
path: root/jessie-tests/gnu/javax/net/ssl/provider/testAlert.java
blob: d209248e2c54447535cddaf324e1afb3b2d639dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48


package gnu.javax.net.ssl.provider;

import java.nio.ByteBuffer;

class testAlert
{
  public static void main (String[] argv)
  {
    Alert a1 = new Alert (ByteBuffer.allocate (2));
    try
      {
        a1.setLevel (Alert.Level.WARNING);
        System.out.println ("PASS: setLevel()");
        a1.setDescription (Alert.Description.UNEXPECTED_MESSAGE);
        System.out.println ("PASS: setDescription()");
      }
    catch (Throwable t)
      {
        System.out.println ("FAIL: " + t);
        t.printStackTrace ();
        System.exit (1);
      }

    Alert a2 = new Alert (ByteBuffer.allocate (2));
    try
      {
        a2.setLevel (Alert.Level.WARNING);
        System.out.println ("PASS: setLevel()");
        a2.setDescription (Alert.Description.UNEXPECTED_MESSAGE);
        System.out.println ("PASS: setDescription()");
      }
    catch (Throwable t)
      {
        System.out.println ("FAIL: " + t);
        t.printStackTrace ();
        System.exit (1);
      }

    if (a1.equals (a2))
      System.out.println ("PASS: equals()");
    else
      System.out.println ("FAIL: equals()");

    System.err.println (a1);
  }
}