feat: first basic test
This commit is contained in:
parent
6bb8c7add9
commit
7358efe1d0
|
@ -23,8 +23,11 @@ dependencies {
|
||||||
// Pour pouvoir parser le JSON
|
// Pour pouvoir parser le JSON
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
|
||||||
implementation 'org.hibernate:hibernate-core:5.4.30.Final'
|
// implementation 'org.hibernate:hibernate-core:5.4.30.Final'
|
||||||
implementation 'mysql:mysql-connector-java:8.0.24'
|
// implementation 'mysql:mysql-connector-java:8.0.24'
|
||||||
|
|
||||||
|
// des fonctions pratiques
|
||||||
|
implementation 'org.apache.commons:commons-lang3:3.0'
|
||||||
|
|
||||||
// Pour les tests
|
// Pour les tests
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
|
||||||
|
|
|
@ -107,8 +107,9 @@ public class Pixel implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Pixel pixel = (Pixel) o;
|
Pixel pixel = (Pixel) o;
|
||||||
return id.equals(pixel.id) && price == pixel.price && color == pixel.color
|
return Objects.equals(id, pixel.id) && price == pixel.price && color == pixel.color
|
||||||
&& description.equals(pixel.description) && owner.equals(pixel.owner);
|
&& Objects.equals(description, pixel.description) && Objects.equals(owner, pixel.owner)
|
||||||
|
&& Objects.equals(transactions, pixel.transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
28
src/test/java/com/pixels/beans/PixelTest.java
Normal file
28
src/test/java/com/pixels/beans/PixelTest.java
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
package com.pixels.beans;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.SerializationUtils;
|
||||||
|
|
||||||
|
public class PixelTest {
|
||||||
|
|
||||||
|
private static Pixel pixel;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
public static void setUp() throws Exception {
|
||||||
|
pixel = new Pixel();
|
||||||
|
pixel.setId(123456789L);
|
||||||
|
pixel.setPrice(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void beanIsSerializable() {
|
||||||
|
final byte[] serializedPixel = SerializationUtils.serialize(pixel);
|
||||||
|
final Pixel deserializedPixel = (Pixel) SerializationUtils.deserialize(serializedPixel);
|
||||||
|
assertEquals(pixel, deserializedPixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue