the same as the previous message java.lang.Exception: Method addActionWithHandler() should be public
at org.junit.runners.model.FrameworkMethod.validatePublicVoid(FrameworkMethod.java:96) at org.junit.runners.model.FrameworkMethod.validatePublicVoidNoArg(FrameworkMethod.java:74) at org.junit.runners.ParentRunner.validatePublicVoidNoArgMethods(ParentRunner.java:155) at org.junit.runners.BlockJUnit4ClassRunner.validateTestMethods(BlockJUnit4ClassRunner.java:208) at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:188) at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128) at org.junit.runners.ParentRunner.validate(ParentRunner.java:416) at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84) at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65) at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101) at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87) at com.intellij.junit4.JUnit46ClassesRequestBuilder.collectWrappedRunners(JUnit46ClassesRequestBuilder.java:90) at com.intellij.junit4.JUnit46ClassesRequestBuilder.getClassesRequest(JUnit46ClassesRequestBuilder.java:51) at com.intellij.junit4.JUnit4TestRunnerUtil.buildRequest(JUnit4TestRunnerUtil.java:91) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:40) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Process finished with exit code 255 Il 25/apr/2016 12:52, "Richard Thompson" <[email protected]> ha scritto: > What error do you get then? > > On 25 April 2016 at 11:05, BruceAndroid <[email protected]> wrote: > >> sorry on posted code method is not pubblic but on real code yes... >> >> Il giorno lunedì 25 aprile 2016 11:50:42 UTC+2, richarth ha scritto: >>> >>> You need to make the addActionWithHandler method public. >>> >>> On 25 April 2016 at 10:34, BruceAndroid <[email protected]> wrote: >>> >>>> hello this my code >>>> >>>> >>>> my test >>>> >>>> [code] >>>> package UnitTests; >>>> >>>> import android.test.suitebuilder.annotation.SmallTest; >>>> >>>> import org.junit.Test; >>>> >>>> import static org.junit.Assert.assertEquals; >>>> import static org.junit.Assert.assertFalse; >>>> import static org.junit.Assert.assertTrue; >>>> /** >>>> * Created by on 23/04/16. >>>> */ >>>> >>>> @SmallTest >>>> public class MappingActionByTagTest { >>>> >>>> @Test >>>> void addActionWithHandler() >>>> { >>>> //arrange >>>> MappingActionByTag mact = new MappingActionByTag(); >>>> mact.addActionWithTag("test", new ICommand() { >>>> public String exec() { >>>> return "tag_test"; >>>> } >>>> }); >>>> >>>> >>>> //act >>>> String actual = mact.getAction("test").exec(); >>>> >>>> >>>> //assert >>>> assertEquals(actual,"tag_test"); >>>> >>>> } >>>> >>>> } >>>> [/code] >>>> >>>> class on test >>>> >>>> [code] >>>> package UnitTests; >>>> >>>> >>>> /** >>>> * Created by on 23/04/16. >>>> */ >>>> public interface ICommand { >>>> String exec(); >>>> >>>> } >>>> >>>> >>>> >>>> package UnitTests; >>>> >>>> >>>> /** >>>> * Created by on 23/04/16. >>>> */ >>>> public class CommandContentRecent implements ICommand { >>>> >>>> public String exec() { >>>> return ""; >>>> } >>>> } >>>> >>>> >>>> package UnitTests; >>>> >>>> import java.util.HashMap; >>>> import java.util.Map; >>>> >>>> /** >>>> * Created by on 23/04/16. >>>> */ >>>> public class MappingActionByTag { >>>> private Map<String, ICommand> m_commandMap = new HashMap<>(); >>>> >>>> public void addActionWithTag(String p_tag, ICommand p_iCommand) { >>>> m_commandMap.put(p_tag,p_iCommand); >>>> } >>>> >>>> public ICommand getAction(String p_tag) { >>>> return m_commandMap.get(p_tag); >>>> } >>>> } >>>> >>>> [/code] >>>> >>>> mi viene dato questo errore che non capisco come risolvere >>>> >>>> java.lang.Exception: Method addActionWithHandler() should be public >>>> >>>> at >>>> org.junit.runners.model.FrameworkMethod.validatePublicVoid(FrameworkMethod.java:96) >>>> at >>>> org.junit.runners.model.FrameworkMethod.validatePublicVoidNoArg(FrameworkMethod.java:74) >>>> at >>>> org.junit.runners.ParentRunner.validatePublicVoidNoArgMethods(ParentRunner.java:155) >>>> at >>>> org.junit.runners.BlockJUnit4ClassRunner.validateTestMethods(BlockJUnit4ClassRunner.java:208) >>>> at >>>> org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:188) >>>> at >>>> org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:128) >>>> at org.junit.runners.ParentRunner.validate(ParentRunner.java:416) >>>> at org.junit.runners.ParentRunner.<init>(ParentRunner.java:84) >>>> at >>>> org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:65) >>>> at >>>> org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10) >>>> at >>>> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) >>>> at >>>> org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) >>>> at >>>> org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) >>>> at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:101) >>>> at org.junit.runners.model.RunnerBuilder.runners(RunnerBuilder.java:87) >>>> at >>>> com.intellij.junit4.JUnit46ClassesRequestBuilder.collectWrappedRunners(JUnit46ClassesRequestBuilder.java:90) >>>> at >>>> com.intellij.junit4.JUnit46ClassesRequestBuilder.getClassesRequest(JUnit46ClassesRequestBuilder.java:51) >>>> at >>>> com.intellij.junit4.JUnit4TestRunnerUtil.buildRequest(JUnit4TestRunnerUtil.java:91) >>>> at >>>> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:40) >>>> at >>>> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) >>>> at >>>> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>> at >>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >>>> at >>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:606) >>>> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) >>>> >>>> >>>> Process finished with exit code 255 >>>> >>>> >>>> the other test ... work >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/android-developers. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/android-developers/ed7df915-b124-4a47-9249-368b6ec83579%40googlegroups.com >>>> <https://groups.google.com/d/msgid/android-developers/ed7df915-b124-4a47-9249-368b6ec83579%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Android Developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/android-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/android-developers/68975a2d-8dcf-4f7c-b45f-71ef2608ce08%40googlegroups.com >> <https://groups.google.com/d/msgid/android-developers/68975a2d-8dcf-4f7c-b45f-71ef2608ce08%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Android Developers" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/android-developers/JKwkMO_nzDY/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/android-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-developers/CAPhephWyHETSr6B_e%3Djq170zb0mH9kMsRmYuVZw65iUSpMWy_w%40mail.gmail.com > <https://groups.google.com/d/msgid/android-developers/CAPhephWyHETSr6B_e%3Djq170zb0mH9kMsRmYuVZw65iUSpMWy_w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/CAEWtEa%2BhxJB_M0tYb%2B-DtAX%3D61U_COKY94gqt4KJ6S2shszEGw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

