Eclipse breakpoint condition for objects - eclipse

I have a problem with the eclipse breakpoint condition pattern.
Regarding this code snippet
public void updateGateway(Gateway pGatewy) {
mGateway = pGateway;
I want to stop the process only if
pGateway.getNumber()==123.
But the condition is without effect and I tested it already successful with this number(but without condition).
What I have to insert in the editor of the Breakpoint properties dialog? The checkbox Conditional is selected.
Thx in advance.

Update your condition
pGateway.getNumber()==123.
to
pGateway.getNumber()==123
Choose Suspend when true option.
Conditional debugging can be run on my machine. You can reference here.

Related

How to handle test case fails in Katalon Studio

In my test case I decide whether I want to toggle my radio button. I check if my radio button does not have the checked attribute as follows:
TestObject srcCurrOpModeRadioBtn = guiUtils.createControl('config-src-op-mode-currentradio')
if(WebUI.verifyElementNotHasAttribute(srcCurrOpModeRadioBtn, 'checked', 5)){
TestObject srcCurrOpModeToggle = guiUtils.createControl('config-src-op-mode-current')
WebUI.click(srcCurrOpModeToggle)
WebUI.delay(1)
}
This works fine when my object does not have the checked attribute, but when my object is already checked (in the state that I want it to be), my test case fails. How do I make it so that instead of failing, it carries out the remaining test?
In simpler words, I have a toggle that toggles between 2 modes, lets call them mode1 and mode2. This specific test tests mode1's preferences, so before testing mode1's preferences, I have to toggle to mode1. My logic works when the toggle is at mode2 at the start of the test but it fails when I am already on mode1. I know that it fails because when mode1 is selected, its radio button already has a checked attribute and so the if statement fails but I don't want my test case to fail because of this, I want to test mode1's preferences.
There is another parameter to WebUI.verifyElementNotHasAttribute() - flow control.
You need to set FailureHandling.OPTIONAL so the test continues execution even if the function returns false. Then you can write the "else" part with corresponding logic.

Test in mocha not completing if shareReplay operator of RxJS is used

I have a simple Javascript function that returns an observable to which I have applied the shareReplay operator with parameter 1.
[![export function doStuffWithShareReplay() {
return interval(100).pipe(
shareReplay(1),
tap(d => console.log('do stuff 1', d)),
take(5)
);
}
If I put such function within a mocha test and run it from within VSCode, it seems that the execution of the test never completes and I have to stop the test execution manually. More precisely, the test passes as expected, but the small control pad at the top-center of VScode is not closed and I have to click on the red button to close it, as you can see in the following picture. If I remove shareReplay the execution ends as expected. I am wondering which is the reason of the behavior.
Use publishReplay(1) and refCount() instead of shareReplay(1):
return interval(100).pipe(
publishReplay(1),
refCount(),
...
There's a bug in shareReplay(1) since RxJS 5.5 (that still exists in RxJS 6.1) that prevents it from unsubscribing from its source.
For more details see this issue: https://github.com/ReactiveX/rxjs/issues/3336

ImperativeExpression for ToolItems

I add the same ImperativeExpression to DirectToolItem and DirectMenuItem, but my #Evaluate method in class for expression was called only for DirectMenuItem. So I can't manage the visibility of DirectToolItem by ImperativeExpression. This is bug or I need to send some event to update visibility? Something like UIEvents.REQUEST_ENABLEMENT_UPDATE_TOPIC?
Unfortunately the visible-when expression for a tool item does not currently work at all. Eclipse bug 494663 describes the problem.

Unity How to use Editor Script to remove StateMachineBehaviour

I have a problem use editor script to remove a statemachinebehaviour,like this:
I use AnimatorState.AddStateMachineBehaviour add the behaviour
The Documentation said use Object.Destroy,I use this api,but it appears:
I want to know how to use Editor Script to implement the function as "remove"
thanks for any idea!!!
In order to remove the state machine behaviour you have to grab the state machine behaviour array, remove the behaviour that you're after, and then reassign the array.
Something along these lines should do it:
using UnityEditor;
using UnityEditor.Animations;
//how you invoke this is up to you
[MenuItem("CONTEXT/StateMachineBehaviour/Remove Test")]
public static void RemoveBehaviour(MenuCommand command)
{
Object selection = Selection.activeObject;
AnimatorState state = selection as AnimatorState;
if(state != null)
{
StateMachineBehaviour behaviour = command.context as StateMachineBehaviour;
StateMachineBehaviour[] theBehaviours = state.behaviours;
ArrayUtility.Remove(ref theBehaviours, behaviour);
Undo.RegisterCompleteObjectUndo(state, "Removed behaviour");
Undo.DestroyObjectImmediate(behaviour);
state.behaviours = theBehaviours;
}
}
This will remove the behaviour using the state machine dropdown menu, with added undo and redo support, an optional bonus.
Depending on how you want to handle the remove, this approach will change but in terms of removing the behaviour, this should be what you're after.
Also, for animator state machines the approach is exactly the same, you just cast the selection object to an AnimatorStateMachine instead.
Hopefully this helps.

Perl Selenium::ActionChains move_to_element not working

I am trying to click on a menu dropdown. The dropdown appears when the mouse pointer is on a menu element. The workaround can be by clicking on the menu element aslo but that sometimes is giving error due to wait time being large or small depending on the speed of site.Thus, I want to use ActionChains move_to_element for this. But it is not working no errors nothing but not working.
my $driver = Selenium::Chrome->new(binary=>"D:\\chromedriver_win32\\chromedriver.exe");
my $action_chains = Selenium::ActionChains->new(driver => $driver);
$elem = $driver->find_element(".//*[\#id='navl']/li[3]/a");
$action_chains->move_to_element($elem);
$driver->pause(5000);
$driver->find_element_by_xpath(".//*[\#id='navl']/li[3]/ul/li[1]/a")->click;
$driver->pause(50000);
$driver->shutdown_binary;
I am not sure if it is of any help - there are many questions about Selenium actions and action chains and many suggestions - I struggled with a similar problem, using Python Selenium bindings though.
First of all in the code above, it could be that there is no final perform() method called after move_to_element
Secondly - and that thing was my own problem and the source of lots of bafflement on my side - i discovered that in my case, after a single perform(), i couldn't reuse the same ActionChains object - there was no error or complaint, but something was not happening right. After I created a new ActionChains object, the subsequent new chain of actions and the final perform() worked as expected.