From 1e0f7068465dddf4c18fa282923b06df52d705d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Sun, 15 Apr 2018 13:20:55 +0200 Subject: [PATCH] Revert "Fix Thread test to run test in additional threads" This reverts commit 89180993494a176ea8c7dfbb1250f81d693637cb. --- .../java/org/fusesource/jansi/AnsiTest.java | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/jansi/src/test/java/org/fusesource/jansi/AnsiTest.java b/jansi/src/test/java/org/fusesource/jansi/AnsiTest.java index 7c9a26d3..f5e683ee 100644 --- a/jansi/src/test/java/org/fusesource/jansi/AnsiTest.java +++ b/jansi/src/test/java/org/fusesource/jansi/AnsiTest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2018 the original author(s). + * Copyright (C) 2009-2017 the original author(s). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ import org.fusesource.jansi.Ansi.Color; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; /** * Tests for the {@link Ansi} class. @@ -27,38 +27,26 @@ */ public class AnsiTest { @Test - public void testSetEnabled() throws InterruptedException { - + public void testSetEnabled() throws Exception { Ansi.setEnabled(false); - Thread threadDisabled = new Thread() { + new Thread() { @Override public void run() { - System.out.println(Ansi.ansi().fgRed().a("ANSI disabled").reset()); - assertFalse( Ansi.isEnabled() ); + assertEquals(false, Ansi.isEnabled()); } - }; + }.run(); Ansi.setEnabled(true); - Thread threadEnabled =new Thread() { + new Thread() { @Override public void run() { - System.out.println(Ansi.ansi().fgBlue().a("ANSI enabled").reset()); - assertTrue( Ansi.isEnabled() ); + assertEquals(true, Ansi.isEnabled()); } - }; - - Ansi.setEnabled(false); - System.out.println(Ansi.ansi().fgBlue().a("Ansi test thread start").reset()); - - threadDisabled.start(); - threadEnabled.start(); - - threadEnabled.join(); - threadDisabled.join(); + }.run(); } @Test - public void testClone() { + public void testClone() throws CloneNotSupportedException { Ansi ansi = Ansi.ansi().a("Some text").bg(Color.BLACK).fg(Color.WHITE); Ansi clone = new Ansi(ansi);