|
1 | 1 | /*
|
2 |
| - * Copyright (C) 2009-2018 the original author(s). |
| 2 | + * Copyright (C) 2009-2017 the original author(s). |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
18 | 18 | import org.fusesource.jansi.Ansi.Color;
|
19 | 19 | import org.junit.Test;
|
20 | 20 |
|
21 |
| -import static org.junit.Assert.*; |
| 21 | +import static org.junit.Assert.assertEquals; |
22 | 22 |
|
23 | 23 | /**
|
24 | 24 | * Tests for the {@link Ansi} class.
|
|
27 | 27 | */
|
28 | 28 | public class AnsiTest {
|
29 | 29 | @Test
|
30 |
| - public void testSetEnabled() throws InterruptedException { |
31 |
| - |
| 30 | + public void testSetEnabled() throws Exception { |
32 | 31 | Ansi.setEnabled(false);
|
33 |
| - Thread threadDisabled = new Thread() { |
| 32 | + new Thread() { |
34 | 33 | @Override
|
35 | 34 | public void run() {
|
36 |
| - System.out.println(Ansi.ansi().fgRed().a("ANSI disabled").reset()); |
37 |
| - assertFalse( Ansi.isEnabled() ); |
| 35 | + assertEquals(false, Ansi.isEnabled()); |
38 | 36 | }
|
39 |
| - }; |
| 37 | + }.run(); |
40 | 38 |
|
41 | 39 | Ansi.setEnabled(true);
|
42 |
| - Thread threadEnabled =new Thread() { |
| 40 | + new Thread() { |
43 | 41 | @Override
|
44 | 42 | public void run() {
|
45 |
| - System.out.println(Ansi.ansi().fgBlue().a("ANSI enabled").reset()); |
46 |
| - assertTrue( Ansi.isEnabled() ); |
| 43 | + assertEquals(true, Ansi.isEnabled()); |
47 | 44 | }
|
48 |
| - }; |
49 |
| - |
50 |
| - Ansi.setEnabled(false); |
51 |
| - System.out.println(Ansi.ansi().fgBlue().a("Ansi test thread start").reset()); |
52 |
| - |
53 |
| - threadDisabled.start(); |
54 |
| - threadEnabled.start(); |
55 |
| - |
56 |
| - threadEnabled.join(); |
57 |
| - threadDisabled.join(); |
| 45 | + }.run(); |
58 | 46 | }
|
59 | 47 |
|
60 | 48 | @Test
|
61 |
| - public void testClone() { |
| 49 | + public void testClone() throws CloneNotSupportedException { |
62 | 50 | Ansi ansi = Ansi.ansi().a("Some text").bg(Color.BLACK).fg(Color.WHITE);
|
63 | 51 | Ansi clone = new Ansi(ansi);
|
64 | 52 |
|
|
0 commit comments