package com.codeborne.selenide.logevents;

import org.junit.Test;

import static com.codeborne.selenide.logevents.LogEvent.EventStatus.IN_PROGRESS;
import static org.junit.Assert.assertEquals;

public class SelenideLogTest {

  @Test
  public void testGetSubject() {
    SelenideLog log = new SelenideLog("Element", "Subject");
    assertEquals("Subject", log.getSubject());
  }

  @Test
  public void testGetStatus() {
    SelenideLog log = new SelenideLog("Element", "Subject");
    assertEquals(IN_PROGRESS, log.getStatus());
  }

  @Test
  public void testGetElement() {
    SelenideLog log = new SelenideLog("Element", "Subject");
    assertEquals("Element", log.getElement());
  }

  @Test
  public void testGetDuration() {
    SelenideLog log = new SelenideLog("Element", "Subject");
    long duration = (0 - System.nanoTime()) / 1000000;
    assertEquals(0, duration - log.getDuration());
  }

  @Test
  public void testError() {
    SelenideLog log = new SelenideLog("Element", "Subject");
    Throwable error = new Throwable("Error message");
    log.setError(error);
    assertEquals(error, log.getError());
  }

  @Test
  public void testToString() {
    SelenideLog log = new SelenideLog("Element", "Subject");
    assertEquals(String.format("$(%s) %s", log.getElement(), log.getSubject()), log.toString());
  }
}

@@ -685,222 +685,8 @@
  %7D%0A%0A
-  @Test%0A  public void testGetDuration() %7B%0A    SelenideLog log = new SelenideLog(%22Element%22, %22Subject%22);%0A    long duration = (0 - System.nanoTime()) / 1000000;%0A    assertEquals(0, duration - log.getDuration());%0A  %7D%0A%0A
   @T

remove flaky test that depends on test speed