eranboudjnah / cleanarchitectureforandroid Goto Github PK
View Code? Open in Web Editor NEWClean Architecture for Android - a sample project
Home Page: https://amzn.to/3rBSxOb
License: MIT License
Clean Architecture for Android - a sample project
Home Page: https://amzn.to/3rBSxOb
License: MIT License
Hello Eran. This seems to be a problem the view not restoring the HistoryViewState into HistoryViewState.HistoryRecords. So when the screen rotates it stays on HistoryViewState.Loading
Hello Eran. I am on the process of reading your book and came across to the testing of the model mappers.
On the file SavedIpAddressRecordToPresentationMapperTest.kt how does the actualValue work? I mean when you call the toPresentation that should return different instance of an object right? so why the test succeeded?
val actualValue = classUnderTest.toPresentation(givenSavedRecord)
When I tried I have a failure test. Even though my expected and actual are the same they are different object since classUnderTest.toPresentation(givenSavedRecord) will create a new instance
here is my error
Expected :link.limecode.newsfeed.presentation.model.pagination.PaginationPresentationModel@7bd7d6d6
Actual :link.limecode.newsfeed.presentation.model.pagination.PaginationPresentationModel@50029372
I cant wrap around my head why does yours works and mine did not
here is my full class
package link.limecode.newsfeed.presentation.mapper
import link.limecode.newsfeed.domain.model.pagination.PaginationDomainModel
import link.limecode.newsfeed.presentation.model.pagination.PaginationPresentationModel
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
@RunWith(Parameterized::class)
class PaginationToPresentationMapperTest(
private val given: PaginationDomainModel,
private val expected: PaginationPresentationModel
) {
companion object {
@JvmStatic
@Parameters(name = "Given {0} then {1}")
fun data(): Collection<Array<*>> = listOf(
testCase(
nextCursor = null,
prevCursor = null
),
testCase(
nextCursor = "next_id",
prevCursor = null
),
testCase(
nextCursor = null,
prevCursor = "prev_id"
)
)
private fun testCase(
nextCursor: String?,
prevCursor: String?
) = arrayOf(
PaginationDomainModel(
nextCursor = nextCursor,
prevCursor = prevCursor
),
PaginationPresentationModel(
nextCursor = nextCursor,
prevCursor = prevCursor
)
)
}
private lateinit var classUnderTest: PaginationToPresentationMapper
@Before
fun setUp() {
classUnderTest = PaginationToPresentationMapper()
}
@Test
fun `When toPresentation`() {
// given
// when
val actual = classUnderTest.toPresentation(given)
// then
assertEquals(expected, actual)
}
}
thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.