|
| 1 | +package dev.findfirst.core.model; |
| 2 | + |
| 3 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
| 4 | +import static org.junit.jupiter.api.Assertions.assertNotEquals; |
| 5 | + |
| 6 | +import org.junit.jupiter.api.Test; |
| 7 | + |
| 8 | +import dev.findfirst.core.service.RobotsFetcher; |
| 9 | +import dev.findfirst.core.service.RobotsFetcher.RobotsTxtResponse; |
| 10 | + |
| 11 | +public class RobotsTxtResponseTest { |
| 12 | + |
| 13 | + @Test |
| 14 | + void robotsTxtResponseEquality() { |
| 15 | + RobotsTxtResponse response1 = new RobotsFetcher.RobotsTxtResponse(200, "response from server".getBytes(), "json"); |
| 16 | + RobotsTxtResponse response2 = new RobotsFetcher.RobotsTxtResponse(200, "response from server".getBytes(), "json"); |
| 17 | + RobotsTxtResponse response3 = new RobotsFetcher.RobotsTxtResponse(200, "new message".getBytes(), "json"); |
| 18 | + RobotsTxtResponse response400 = new RobotsFetcher.RobotsTxtResponse(400, "response from server".getBytes(), "json"); |
| 19 | + RobotsTxtResponse responseContent = new RobotsFetcher.RobotsTxtResponse(400, "response from server".getBytes(), |
| 20 | + "html"); |
| 21 | + RobotsTxtResponse responseContent2 = new RobotsFetcher.RobotsTxtResponse(400, "response from server".getBytes(), |
| 22 | + null); |
| 23 | + |
| 24 | + assertTrue(response1.equals(response2)); |
| 25 | + assertNotEquals(response1, response3); |
| 26 | + assertNotEquals(response1, response400); |
| 27 | + assertNotEquals(response1, null); |
| 28 | + assertNotEquals(response1, (Object) ""); |
| 29 | + assertNotEquals(response1, responseContent); |
| 30 | + assertNotEquals(responseContent, responseContent2); |
| 31 | + } |
| 32 | + |
| 33 | +} |
0 commit comments