Skip to content

Commit

Permalink
refactor(tests): replace asserEquals with assertThat
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jul 24, 2019
1 parent 63cf1c1 commit e06d94f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static org.junit.Assert.assertEquals
import static org.assertj.core.api.Assertions.*

@ExtendWith(InjectionExtension)
@InjectWith(CoreInjectorProvider)
Expand All @@ -32,7 +32,7 @@ class ClassParsingTest {
TestHelpers.assertModelParsedSuccessfully(result)

val classBlock = result.steps.get(0) as ClassBlock
assertEquals(classBlock.name, "Foo")
assertThat(classBlock.name).isEqualTo("Foo")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith

import static org.junit.Assert.assertEquals
import app.hypermedia.testing.dsl.core.PropertyBlock
import app.hypermedia.testing.dsl.core.PropertyStatement
import static org.assertj.core.api.Assertions.*;
Expand All @@ -38,7 +36,7 @@ class PropertyParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val propertyBlock = classBlock.children.get(0) as PropertyBlock
assertEquals(propertyBlock.name, "name")
assertThat(propertyBlock.name).isEqualTo("name")
}

@Test
Expand All @@ -55,7 +53,7 @@ class PropertyParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val propertyStmt = classBlock.children.get(0) as PropertyStatement
assertEquals(propertyStmt.name, "name")
assertThat(propertyStmt.name).isEqualTo("name")
}

@Test
Expand All @@ -72,7 +70,7 @@ class PropertyParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val propertyStmt = classBlock.children.get(0) as PropertyStatement
assertEquals(propertyStmt.value, "TOMASZ")
assertThat(propertyStmt.value).isEqualTo("TOMASZ")
}

@Test
Expand All @@ -91,7 +89,7 @@ class PropertyParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val propertyBlock = classBlock.children.get(0) as PropertyBlock
assertEquals(propertyBlock.children.length, 1)
assertThat(propertyBlock.children.length).isEqualTo(1)
assertThat(propertyBlock.children.get(0)).isInstanceOf(PropertyStatement)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static org.junit.Assert.assertEquals
import app.hypermedia.testing.dsl.tests.CoreInjectorProvider
import app.hypermedia.testing.dsl.tests.TestHelpers
import app.hypermedia.testing.dsl.core.HeaderStatement
Expand Down Expand Up @@ -39,7 +38,7 @@ class HeaderParsingTest {

val linkBlock = result.steps.get(0) as RelaxedLinkBlock
val headerStatement = linkBlock.children.get(0) as HeaderStatement
assertEquals(headerStatement.fieldName, "Location")
assertThat(headerStatement.fieldName).isEqualTo("Location")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static org.junit.Assert.assertEquals
import app.hypermedia.testing.dsl.tests.CoreInjectorProvider
import app.hypermedia.testing.dsl.core.RelaxedLinkBlock
import app.hypermedia.testing.dsl.core.ClassBlock
Expand Down Expand Up @@ -38,7 +37,7 @@ class LinkParsingTest {
TestHelpers.assertModelParsedSuccessfully(result)

val linkBlock = result.steps.get(0) as RelaxedLinkBlock
assertEquals(linkBlock.relation, "Foo")
assertThat(linkBlock.relation).isEqualTo("Foo")
assertThat(linkBlock.children).hasSize(2)
}

Expand All @@ -59,7 +58,7 @@ class LinkParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val linkBlock = classBlock.children.get(0) as RelaxedLinkBlock
assertEquals(linkBlock.relation, "Bar")
assertThat(linkBlock.relation).isEqualTo("Bar")
assertThat(linkBlock.children).hasSize(2)
}

Expand All @@ -80,7 +79,7 @@ class LinkParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val linkBlock = classBlock.children.get(0) as StrictLinkBlock
assertEquals(linkBlock.relation, "Bar")
assertThat(linkBlock.relation).isEqualTo("Bar")
assertThat(linkBlock.children).hasSize(2)
}

Expand All @@ -98,6 +97,6 @@ class LinkParsingTest {

val classBlock = result.steps.get(0) as ClassBlock
val linkBlock = classBlock.children.get(0) as LinkStatement
assertEquals(linkBlock.relation, "Bar")
assertThat(linkBlock.relation).isEqualTo("Bar")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static org.junit.Assert.assertEquals
import app.hypermedia.testing.dsl.tests.HydraInjectorProvider
import static org.assertj.core.api.Assertions.*
import app.hypermedia.testing.dsl.hydra.InvocationBlock
Expand Down Expand Up @@ -39,7 +38,7 @@ class OperationParsingTest {
TestHelpers.assertModelParsedSuccessfully(result)

val classBlock = result.steps.get(0) as RelaxedOperationBlock
assertEquals(classBlock.name, "CreateUser")
assertThat(classBlock.name).isEqualTo("CreateUser")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.extensions.InjectionExtension
import org.eclipse.xtext.testing.util.ParseHelper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static org.junit.Assert.assertEquals
import static org.assertj.core.api.Assertions.*
import app.hypermedia.testing.dsl.tests.HydraInjectorProvider
import app.hypermedia.testing.dsl.tests.TestHelpers
import app.hypermedia.testing.dsl.hydra.RelaxedOperationBlock
Expand Down Expand Up @@ -45,7 +44,7 @@ class StatusParsingTest {
val operationBlock = result.steps.get(0) as RelaxedOperationBlock
val invocationBlock = operationBlock.invocations.get(0) as InvocationBlock
val statusBlock = invocationBlock.children.get(0) as StatusStatement
assertEquals(statusBlock.status, status)
assertThat(statusBlock.status).isEqualTo(status)
}

@ParameterizedTest
Expand Down

0 comments on commit e06d94f

Please sign in to comment.