Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update unit testing environment to use mocks #120

Closed
wants to merge 6 commits into from
Closed

Update unit testing environment to use mocks #120

wants to merge 6 commits into from

Conversation

wluyima
Copy link
Member

@wluyima wluyima commented Nov 17, 2012

@@ -285,7 +314,11 @@ public void shouldNotAllowTaskExecuteToRunBeforeInitializationIsComplete() throw
}
}

/**
* TODO This should be an integration test, get rid of it
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, so do get rid of it instead of putting @ignore. :-)

@ghost ghost assigned rkorytkowski Nov 19, 2012
@Before
public void before() {
MessageSourceService as = mock(MessageSourceService.class);
PowerMockito.stub(PowerMockito.method(Context.class, "getMessageSourceService")).toReturn(as);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to use plain Mockito here: Mockito.when(Context.getMessageSourceService()).thenReturn(as);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that i need to mock some methods at the sametime invoke the actual code in some and at the same time i want some not to be called at all, to achieve this, i need to use stub for specific methods otherwise i will end up having the code cluttered with calls like Mockito.spy, Mockito.doCallRealMethod and Mockito.doNothing everywhere, i basically found stub much cleaner.

@wluyima wluyima closed this Aug 19, 2013
@sonarcloud
Copy link

sonarcloud bot commented Oct 2, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug D 8 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 26 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

RandilaP pushed a commit to RandilaP/openmrs-core that referenced this pull request Jul 31, 2023
…on -> frontend.json (openmrs#120)

* Add support for JSON parameterization of build. And microfrontends.json -> frontend.json

* Prettier

* frontend.json --> spa-build-config.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants