Search in sources :

Example 1 with Message

use of org.sonar.ce.task.log.CeTaskMessages.Message in project sonarqube by SonarSource.

the class CeTaskMessagesMessageTest method hashsode_is_based_on_text_and_timestamp.

@Test
public void hashsode_is_based_on_text_and_timestamp() {
    long timestamp = 10_000_000_000L;
    String text = randomAlphabetic(23);
    Message underTest = new Message(text, timestamp);
    assertThat(underTest.hashCode()).isEqualTo(underTest.hashCode()).isEqualTo(new Message(text, timestamp).hashCode()).isNotEqualTo(new Message(text + "ç", timestamp).hashCode()).isNotEqualTo(new Message(text, timestamp + 10_999L).hashCode()).isNotEqualTo(new Object().hashCode());
}
Also used : Message(org.sonar.ce.task.log.CeTaskMessages.Message) Test(org.junit.Test)

Example 2 with Message

use of org.sonar.ce.task.log.CeTaskMessages.Message in project sonarqube by SonarSource.

the class CeTaskMessagesMessageTest method equals_is_based_on_text_and_timestamp.

@Test
public void equals_is_based_on_text_and_timestamp() {
    long timestamp = 10_000_000_000L;
    String text = randomAlphabetic(23);
    Message underTest = new Message(text, timestamp);
    assertThat(underTest).isEqualTo(underTest).isEqualTo(new Message(text, timestamp)).isNotEqualTo(new Message(text + "ç", timestamp)).isNotEqualTo(new Message(text, timestamp + 10_999L)).isNotNull().isNotEqualTo(new Object());
}
Also used : Message(org.sonar.ce.task.log.CeTaskMessages.Message) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Message (org.sonar.ce.task.log.CeTaskMessages.Message)2