Skip to content

Commit

Permalink
BC-7234 - test
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored May 22, 2024
1 parent 236532b commit 2cbf05f
Showing 1 changed file with 42 additions and 19 deletions.
61 changes: 42 additions & 19 deletions src/test/java/de/svs/doido/mongo/dto/ConfigmapTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,44 @@

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import static org.junit.jupiter.api.Assertions.assertEquals;

@QuarkusTest
class ConfigmapTest {

private Configmap c;
private Configmap d;

@BeforeEach
public void before() {
c = new Configmap();
d = new Configmap();
}

@Test
void testGetterSetterName() {
Configmap c = new Configmap();
String name = "hausboot";
c.setName(name);
assertEquals(name,c.getName());
}

@Test
void testGetterSetterUri() {
Configmap c = new Configmap();
String uri = "ftp://foo.bar.com/";
c.setUri(uri);
assertEquals(uri,c.getUri());
}

@Test
void testGetterSetterUriFail() {
Configmap c = new Configmap();
String uri = "proto:foo.bar.com/";
c.setUri(uri);
assertEquals("", c.getUri());
}

@Test
void testToString() {
Configmap c = new Configmap();
Configmap d = new Configmap();
String uri = "proto://foo.bar.com/";
String name = "hausboot";
c.setName(name);
Expand All @@ -45,8 +51,17 @@ void testToString() {

@Test
void testHashcode() {
Configmap c = new Configmap();
Configmap d = new Configmap();
String uri = "proto://foo.bar.com/";
String name = "hausboot";
c.setName(name);
c.setUri(uri);
d.setName(name);
d.setUri(uri);
assertEquals(d.hashCode(), c.hashCode());
}

@Test
void testHashcode() {
String uri = "proto://foo.bar.com/";
String name = "hausboot";
c.setName(name);
Expand All @@ -58,8 +73,6 @@ void testHashcode() {

@Test
void testEquals () {
Configmap c = new Configmap();
Configmap d = new Configmap();
String uri = "proto://foo.bar.com/";
String name = "hausboot";
c.setName(name);
Expand All @@ -71,8 +84,6 @@ void testEquals () {

@Test
void testEquals2 () {
Configmap c = new Configmap();
Configmap d = new Configmap();
String uri = "proto://foo.bar.com/";
String name = "hausboot";
String uri2 = "proto://foo.bar.com/";
Expand All @@ -86,26 +97,40 @@ void testEquals2 () {

@Test
void testEqualsEmpty () {
Configmap c = new Configmap();
Configmap d = new Configmap();
assertEquals( true, d.equals(c));
}

@Test
void testEqualsEmptyAndNot () {
Configmap c = new Configmap();
Configmap d = new Configmap();
String uri2 = "proto://foo.bar.com/";
String name2 = "hausboot2";
d.setName(name2);
d.setUri(uri2);
assertEquals( false, d.equals(c));
}

@Test
void testEqualsEmptyAndNotUri () {
String uri2 = "proto://foo.bar.com/";
String name2 = "hausboot2";
c.setName(name2);
d.setName(name2);
d.setUri(uri2);
assertEquals( false, d.equals(c));
}

@Test
void testEqualsEmptyAndNotName () {
String uri2 = "proto://foo.bar.com/";
String name2 = "hausboot2";
d.setName(name2);
c.setUri(uri2);
d.setUri(uri2);
assertEquals( false, d.equals(c));
}

@Test
void testEqualsNoUri () {
Configmap c = new Configmap();
Configmap d = new Configmap();
String name = "hausboot";
c.setUri(name);
d.setUri(name);
Expand All @@ -114,8 +139,6 @@ void testEqualsNoUri () {

@Test
void testEqualsUriNotPass () {
Configmap c = new Configmap();
Configmap d = new Configmap();
String uri = "proto:foo.bar.com/";
c.setUri(uri);
d.setUri(uri);
Expand Down

0 comments on commit 2cbf05f

Please sign in to comment.