Unit Testing Atomic Kotlin, how can I activate it? - kotlin

I want to use something called AtomicTest. I put at the top:
import atomictest.eq
But it is not working. I got an error saying: Kotlin: Unresolved reference: eq
Is there anything that I have to do in order for this test to work?

Just copy AtomicTest.kt from AtomicKotlinExamples to your project.

Related

The method expect(boolean) is undefined for the type in Shiro test

I'm doing my first test in Java, and I have a Shiro Security... I follow the tutorial (https://shiro.apache.org/testing.html) but says:
(this example uses EasyMock, but Mockito works equally as well):
Subject subjectUnderTest = createNiceMock(Subject.class);
expect(subjectUnderTest.isAuthenticated()).andReturn(true);
Because I use Mockito I implement with
Subject mockSubject = mock(Subject.class);
expect(subjectUnderTest.isAuthenticated()).andReturn(true);
But when I do it have this error
The method expect(boolean) is undefined for the type AdminControllerTest
And don't give me the posibility to import it. I don't know if expect is especific of EasyMock and if yes what I have to use in Mockito.
I search here and see more person doing it and always recomend use this expect
How to mock a shirosession?
If we look at this code example ...
Subject mockSubject = mock(Subject.class);
expect(subjectUnderTest.isAuthenticated()).andReturn(true);
We can see that ...
You are using mockito syntax to do the mocking.
You are using easyMock syntax to configure the mock. It is not even in the dependency list, so this method is not found.
The solution is to use mockito syntax to configure the mock.
Subject mockSubject = mock(Subject.class);
when(mockSubject.isAuthenticated()).thenReturn(true);
This will make everything work as expected and your Subject will return true, when the isAuthenticated() method is called.
If you want to up your mockito game, try this resource, which comes with working github code examples.

"inferred type is FragmentManager? but FragmentManager was expected" error after moving to androidX

I just moved my project to androidX. I used android studio refactor->upgrade to androidX. TargetSDK was already 28 and was working fine. So was not expecting many errors. But I was wrong and getting many errors, most of them are about fragmentManager
inferred type is FragmentManager? but FragmentManager was expected
This is when I am calling show method of a custom bottomSheetDialogue in a fragment.
bottomDialog.newInstance(//options here
).show(fragmentManager, bottomDialog.TAG)
The method is annotated as Nullable. Change like this
fragmentManager?.let { manager ->
bottomDialog.newInstance(//options here
).show(manager, bottomDialog.TAG)
}
Make sure you import androidx.fragment.app.FragmentManager instead of a android.app.FragmentManager
I ended up using parentFrgamentManager and it solved the issue. I tried with supportFragmentManager but it wasn't recognised, so used parentFragmentManager. This is the code I used.
bottomDialog.newInstance(//options here
).show(parentFragmentManager, bottomDialog.TAG)

gen_contour_region_xld control parameter error in c#

After I developed my code in HDevelop,
find_local_deformable_model (ImageReduced1, ImageRectified, VectorField, DeformedContours, ModelID...)
gen_region_contour_xld (DeformedContours, EdgeRegion, 'margin')
union1(EdgeRegion, RegionUnion)
region_features(RegionUnion,['width','height'],WidthAndHeight)
It can run, but after I export it to C#, it cannot, reported:
HALCON error #1301: Wrong value of control parameter 1 in operator
When I export it to cpp, it can run also.
What is the problem?
finaly I find this is a typo, when coding against VS, I made the code install of export, so this introduced a typo, by HOperateSet., it gave me GenContourGeionXld, should be GenRegionContourXld.

grammar.y error happended when compiled Cobalt

When compile Cobalt, the following error happend, is there anyone who knows why?
It said the 'ShadowType' is not a class or namespace in grammy.y:3421, I did not know what is used for grammy.y, and try to trace and modify the code, it does not work.
grammar.y error details
Your issue is that C++ version before C++0x does not support ShadowType::kBoxShadow(member in enum type) use at all, you can change the cflags_cc from "-std=gnu++98" to "-std=gnu++0x"in third_party/starboard/linux/shared/gyp_configuration.gypi, and try again.

Building modified AOSP throws error (Trying to change API)

out/target/common/obj/PACKAGING/public_api.txt:4316: error 5: Added public field android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_MOVEMENT
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
So i tried to add an #hide annotation to my member variable, but it will only give me another error:
frameworks/base/core/java/android/app/admin/DevicePolicyManager.java:233: cannot find symbol
symbol : class hide
location: class android.app.admin.DevicePolicyManager
#hide
How can I solve this problem?
I made the mistake of using #hide such as #Override, but you have to use it in a JavaDoc comment:
/**
* #hide
*/