[BAEL-19886] - minor fixes

This commit is contained in:
catalin-burcea 2020-01-03 20:15:36 +02:00
parent e2ec34707b
commit b3c126f76a
4 changed files with 14 additions and 26 deletions

View File

@ -70,10 +70,8 @@ class NodeTest {
@Test @Test
fun givenDepthTwo_whenPivotAtDepth2_then_Success() { fun givenDepthTwo_whenPivotAtDepth2_then_Success() {
val left = val left = Node(1, Node(0), Node(2))
Node(1, Node(0), Node(2)) val right = Node(5, Node(4), Node(6))
val right =
Node(5, Node(4), Node(6))
val n = Node(3, left, right) val n = Node(3, left, right)
assertEquals(left.left, n.find(0)) assertEquals(left.left, n.find(0))
} }
@ -246,8 +244,7 @@ class NodeTest {
*/ */
@Test @Test
fun givenTreeDepthOne_whenValueAbsent_thenNoChange() { fun givenTreeDepthOne_whenValueAbsent_thenNoChange() {
val n = val n = Node(1, Node(0), Node(2))
Node(1, Node(0), Node(2))
n.delete(3) n.delete(3)
assertEquals(1, n.key) assertEquals(1, n.key)
assertEquals(2, n.right!!.key) assertEquals(2, n.right!!.key)
@ -285,11 +282,7 @@ class NodeTest {
*/ */
@Test @Test
fun givenTreeDepthTwo_whenNodeToDeleteHasOneChild_thenChangeTree() { fun givenTreeDepthTwo_whenNodeToDeleteHasOneChild_thenChangeTree() {
val n = Node( val n = Node(2, Node(0, null, Node(1)), Node(3))
2,
Node(0, null, Node(1)),
Node(3)
)
n.delete(0) n.delete(0)
assertEquals(2, n.key) assertEquals(2, n.key)
with(n.right!!) { with(n.right!!) {
@ -306,13 +299,8 @@ class NodeTest {
@Test @Test
fun givenTreeDepthThree_whenNodeToDeleteHasTwoChildren_thenChangeTree() { fun givenTreeDepthThree_whenNodeToDeleteHasTwoChildren_thenChangeTree() {
val l = Node( val l = Node(2, Node(1), Node(5, Node(4), Node(6)))
2, val r = Node(10, Node(9), Node(11))
Node(1),
Node(5, Node(4), Node(6))
)
val r =
Node(10, Node(9), Node(11))
val n = Node(8, l, r) val n = Node(8, l, r)
n.delete(8) n.delete(8)
assertEquals(6, n.key) assertEquals(6, n.key)

View File

@ -7,7 +7,7 @@ class ArrayTest {
@Test @Test
fun givenArray_whenValidateArrayType_thenComplete () { fun givenArray_whenValidateArrayType_thenComplete () {
val ex = com.baeldung.interoperability.ArrayExample() val ex = ArrayExample()
val numArray = intArrayOf(1, 2, 3) val numArray = intArrayOf(1, 2, 3)
assertEquals(ex.sumValues(numArray), 6) assertEquals(ex.sumValues(numArray), 6)
@ -15,7 +15,7 @@ class ArrayTest {
@Test @Test
fun givenCustomer_whenGetSuperType_thenComplete() { fun givenCustomer_whenGetSuperType_thenComplete() {
val instance = com.baeldung.interoperability.Customer::class val instance = Customer::class
val supertypes = instance.supertypes val supertypes = instance.supertypes
assertEquals(supertypes[0].toString(), "kotlin.Any") assertEquals(supertypes[0].toString(), "kotlin.Any")
@ -23,7 +23,7 @@ class ArrayTest {
@Test @Test
fun givenCustomer_whenGetConstructor_thenComplete() { fun givenCustomer_whenGetConstructor_thenComplete() {
val instance = com.baeldung.interoperability.Customer::class.java val instance = Customer::class.java
val constructors = instance.constructors val constructors = instance.constructors
assertEquals(constructors.size, 1) assertEquals(constructors.size, 1)
@ -31,7 +31,7 @@ class ArrayTest {
} }
fun makeReadFile() { fun makeReadFile() {
val ax = com.baeldung.interoperability.ArrayExample() val ax = ArrayExample()
ax.writeList() ax.writeList()
} }
} }

View File

@ -7,7 +7,7 @@ class CustomerTest {
@Test @Test
fun givenCustomer_whenNameAndLastNameAreAssigned_thenComplete() { fun givenCustomer_whenNameAndLastNameAreAssigned_thenComplete() {
val customer = com.baeldung.interoperability.Customer() val customer = Customer()
// Setter method is being called // Setter method is being called
customer.firstName = "Frodo" customer.firstName = "Frodo"