Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
154 views

Rspec expectation error: reading hash argument as keyword arguments

I'm in the middle of an update to Rails 7.1.3 and I've run into an interesting issue. I have an initialize which has one positional argument (which defaults to an empty hash) and some keyword ...
AJFaraday's user avatar
  • 2,440
0 votes
0 answers
77 views

Gmock: is it allowed to interleave expectations and calls to mock function for Different mock objects?

By the link https://github.com/google/googletest/blob/main/docs/gmock_for_dummies.md#using-mocks-in-tests it's written: Important note: gMock requires expectations to be set before the mock functions ...
JenyaKh's user avatar
  • 2,458
0 votes
0 answers
49 views

How to deal with Unsync Tables in databricks notebooks

So, my question is: i have a bronze - silver injestion, and later this data will be consumed by gold notebooks, i wan't to check if all tables that notebooks uses is updated. What i thinked, use dlt ...
Ismael's user avatar
  • 1
0 votes
0 answers
117 views

Is it possible to calculate an exact/approximate expectation over an argmax function of a random variable?

given a non-increasing vector $b\in R^n$ I would like to calculate the expected argmax of the function f(b) = i*b_i. More clear and mathematical meaning. It's worth mentioning that I assume that the ...
Sagi Levy's user avatar
0 votes
1 answer
40 views

Dot-notation not working with MixtureExpectation?

This is my first post so I apologize for any formatting issues. I'm trying to calculate the expected value of a collection of numbers in Julia, given a probability distribution that is the mixture of ...
Thomas Mikaelsen's user avatar
0 votes
1 answer
71 views

Jmockit StrictExpectations mocking unmocked static method

I am new to jmockit and StrictExpectations. Inside StrictExpectations I have recorded invocation and return value of static method of non-mocked class and the static method is mocked correctly but I ...
Nobita's user avatar
  • 1
-1 votes
1 answer
470 views

Single global instance for multiple test cases in unit testing

I want to setup a global instance variable for all the test cases. Currently I could setup the variable for one test case but it is not set for the other. Mentioned below is my setup code. func ...
Nasim Rony's user avatar
-1 votes
1 answer
40 views

probability , expectations in $L^1$

I found this in another language. I am wondering if anyone could find this in a English book please. Or if anyone know how to prove this please. Preferably one could tell me a reference book. Thank ...
G-09's user avatar
  • 449
0 votes
1 answer
516 views

Creating Expectations for all columns of certain type in Palantir Foundry

I use a expectations and Check to determine if a column of decimal type could be transformed into int or long type. A column could be safely transformed if it contains integers or decimals where ...
ZygD's user avatar
  • 24.2k
0 votes
0 answers
29 views

Best way of testing randomized function

Let's say I have a random number generator for 3 categories: Prob Yield 0.1 10 0.2 5 0.7 2 The expected yield is 1 + 1 + 1.4 = 3.4 Currently I have something like this sum = 0 N = 10000 for i in ...
zs2020's user avatar
  • 54.4k
0 votes
1 answer
1k views

Find unbiased estimator for (1+λ)e−λ in a poisson distribution

My Attempt: I tried using the MLE of λ which I find the sample mean. Then using the invariance property and it follows that (1+X¯)e^−X¯will be the MLE of (1+λ)e^−λ but I'm not sure if it is also ...
Hamed Said's user avatar
4 votes
1 answer
2k views

XCTWaiter().wait with XCTestExpectation and NSPredicate seems to fail

I am trying to write unit tests where I want my test case to wait for a variable in a certain class to change. So I create an expectation with a predicate and wait for the value to change using ...
gbroekstg's user avatar
  • 1,175
0 votes
1 answer
130 views

unit testing iOS function with dispatch

I'm working with unit testing for the first time and I'm lost with some specific cases. Despite reading a lot I'm confused about how to test a function like this in iOS: func myFunction() { ...
Wonton's user avatar
  • 1,133
0 votes
0 answers
123 views

How to estimate this expectation involving two binomial random variables?

X and Y are two independent binomial random variables where X~ B(K_1, q), Y~ B(K_0, p), (Note: p+q is not necessarily equal to 1). I am wondering how to compute the following expectation (the ...
luw's user avatar
  • 217
0 votes
0 answers
278 views

A question about the realization and randomness

I am doing an assignment for my data class and new to R programming. If a fair 6-sided die is rolled, Let X be the number showing on the top of the die. (The first question is involved the R ...
Carlos Ying Yan's user avatar
1 vote
1 answer
314 views

Expectation of a product in python sympy

In python sympy I have the following code from sympy.stats import P, E, variance, covariance, Normal mu, sigma = symbols('mu sigma') epsilon_t = Normal('epsilon_t', 0, sigma) epsilon_t1 = Normal('...
Daniel's user avatar
  • 165
1 vote
2 answers
10k views

queryStringParameters in mock-server

I have the following url: http://10.11.100.163:1080/v1/publish/?category=conf&product=UFED_INFIELD&serial=123&productGUIDs%5B0%5D%5Bproduct%5D=GLOBAL&productGUIDs%5B0%5D%5Bguid%5D=...
Limbo's user avatar
  • 663
0 votes
1 answer
896 views

Issue with NonStrictExpections to Expectations conversion in junit test cases

Here is my sample code example, which starts failing when I made jmockit update related changes. class A { public static boolean validate(String name, int age, boolean flag) { boolean ...
IfOnly's user avatar
  • 540
1 vote
0 answers
504 views

JMockit mock constructor in Expectations

I'm trying to set a result on a constructor call in an Expectations block, but the constructor call in the tested code doesn't return the result I'm setting. There must be a different way to do this, ...
eriksmith200's user avatar
  • 2,179
0 votes
2 answers
160 views

Program is not throwing ArgumentOutOfRange Exception

I have a simple program that takes a number from the user and returns the number located at that position/index in an array. However, if the given number is not withing the index range, it throws an ...
user avatar
0 votes
1 answer
298 views

Does Serverspec support expectations or do I have to use should?

I hear I should be using expectations rather than "should" statements in Serverspec I have been Googling around for expectations that can be used for file matching but all of the tutorials I see for ...
Kaliklipper's user avatar
3 votes
0 answers
867 views

Clear JMockit expectations after a test or a testclass

We are having an old codebase with few tests mocking global static object. That influences other tests that fail if being called in a same testsuite (the same JVM) after the test which mocks static ...
Michal's user avatar
  • 395
0 votes
3 answers
1k views

How can we mock scala method with generic return type and implicit parameters?

I have a configuration fetcher that looks something like this. def getForCountry[A](path: String, fallbackToDefault: Boolean) (implicit loader: ConfigLoader[A], ac: AppContext): A =...
Ritabrata's user avatar
  • 119
1 vote
0 answers
280 views

Jmockit How to match 'any' parameter type for Class<T> clazz

Using jmockit, i am creating new expectation new Expectations(){{ ConfigurationService.get(anyString,****); }}; of static method public static <T> T get(String key, Class<...
Melad Basilius's user avatar
0 votes
1 answer
553 views

Unable to parse expectation on mockserver-netty when adding Content-Type header

I have an integration test where I am using mockserver-netty (v5.3.0) with a springboot 2.0 application..everything is working fine but if I try to add the Content-Type header, I get the following ...
filmac's user avatar
  • 197
0 votes
1 answer
195 views

How can I set jmockit expectations for a chain of calls using times?

I am testing a class instance called server and I am using partial mocking, like this: new Expectations(server) {{ server.readPortNumber(withInstanceOf(File.class)); result = new ...
mvallebr's user avatar
  • 2,508
0 votes
0 answers
69 views

Does expected value of F(x)/x(1-F(x)) have a name, F(x) is CDF? Is it related to hazard function?

I was solving a problem and encountered the following: \sum (f(x)/x) (F(x)/(1-F(x)) Here f(x) is pmf and F(x) is CDF. Is expected value of F(x)/x(1-F(x)) a known function? I found out that f(x)/(1-F(...
Joe's user avatar
  • 79
0 votes
0 answers
87 views

Expectations, covariances and correlations

This is the question I am trying to solve. Create a sample of 10,000 pairs (X,Y). Using the above facts, estimateE(X), E(X^2), E(Y ), E(Y^2) and E(XY ) from your sample of data. Hence, compute an ...
Han's user avatar
  • 15
1 vote
1 answer
2k views

Why don't array include checks work as expected in chai.js?

I'm using chai.js expectations with the mocha JS test framework. I'm trying to test inclusion of objects in arrays but it appears the includes behavior supported by chai in their documentation doesn't ...
scorpiodawg's user avatar
  • 5,752
1 vote
3 answers
2k views

Java Mockito when accept arguments but conditionally

I am writing a test case using Mockito, and have to write expectation for a method (signature shown below) public Object process(Employee e); In my test class, I have to simulate my expectations as ...
pankaj_ar's user avatar
  • 765
8 votes
1 answer
11k views

Jasmine : spy on a function called X times, and get the n-th call

I can't seem to find a solution online. Here is a sample of code so you get the issue : // Spy on the wanted function spyOn(object, 'myFunction'); // Call it 3 times with different parameters ...
user avatar
0 votes
0 answers
99 views

R: Difference in expected values of empirical distributions - functional forms unknown

Given a generated two empirical distributions I am trying to find the expected value of each distribution and then take the difference between these two expected values. Most questions that I have ...
EDennnis's user avatar
  • 331
0 votes
0 answers
404 views

Moq setup does not match parameter because it is a subtype?

I'm trying to use Setup on a Moq like I've done many times to return a value, but I can't seem to understand why the parameter matching fails in this case. Here's what I'm doing: var myParameter = ...
MarioDS's user avatar
  • 13.1k
0 votes
2 answers
875 views

JMockit is not instantiating captured interfaces in Expectations block

I'm not sure whether I'm using JMockit incorrectly, or there's something amiss in my setup. I'm using JMockit 1.32 with JUnit 4.12 in Eclipse. My problem seems to be that interfaces aren't being ...
Didjit's user avatar
  • 805
8 votes
3 answers
11k views

c++ gtest print additional information in the end of a test when and only when the test fails

I want to do somethink like this: TEST(MyTestFixture, printAfterExpectationFailure) { const string request("bring me tea"); const string&& response = sendRequestAndGetResponse(request); ...
baziorek's user avatar
  • 2,674
0 votes
1 answer
184 views

Matlab: Covariance Matrix from matrix of combinations using E(X) and E(X^2)

I have a set of independent binary random variables (say A,B,C) which take a positive value with some probability and zero otherwise, for which I have generated a matrix of 0s and 1s of all possible ...
rock3000's user avatar
13 votes
2 answers
4k views

Interleaving EXPECT_CALL()s and calls to the mock functions

The Google Mock documentation says: Important note: Google Mock requires expectations to be set before the mock functions are called, otherwise the behavior is undefined. In particular, you mustn't ...
Jordan's user avatar
  • 1,625
0 votes
1 answer
592 views

How to calculate the expected value of a given distribution in SAS

For example, gamma(2,3) is given. Is there any function in SAS like ExpectedValue("Gamma",2,3) to give the expected value of the distribution. I have googled for a while and no satisfactory answer ...
Sun Dayu's user avatar
1 vote
1 answer
2k views

IllegalArgumentException: Invalid conditional statement inside expectation block

I have a problem with an Expectations block I have written in my test case: new Expectations() { { mFindHandlerMock.findAll((Model) any, (Set<Id>) any, false); if (!...
nano_nano's user avatar
  • 12.5k
0 votes
2 answers
434 views

JMockit method that isn't mocked doesn't work

Sample class public class Test{ @Tested ClassA objA; @Test(expected = MyException.class){ String expectedVar = "expectedVar"; new Expectations(objA) { { objA.someMethod(); ...
Ababababa's user avatar
  • 362
0 votes
1 answer
65 views

jasmine expect not matching array result

I'm trying the following code: describe("array deletion", function () { it("leaves a hole in middle", function () { var array = ['one','two','three']; delete array[1]; //'two' ...
William Chang's user avatar
1 vote
3 answers
21k views

java.lang.Exception: Test class should have exactly one public zero-argument constructor:

I have a class : Function Library where I am instantiating the webdriver instance in constructor as below public class FunctionLibrary { public WebDriver driver; public FunctionLibrary(...
Shilpa's user avatar
  • 85
3 votes
1 answer
4k views

JMockit - Expectations - matching invocation of method that includes mocked object as argument

I am using JMockit to test an application (Java 8, Junit 4.12, JMockit 1.17). I have some code which is supposed to upload some data to a list of endpoints. The class that actually performs an ...
user3441604's user avatar
1 vote
0 answers
58 views

Is there a way to find unused expectations in jMock?

We use jMock for a lot of our Java tests. In some test classes, most of the tests work the same way, so common expectations end up in a setUp() method. Quite often, some of the expectations in the ...
Hakanai's user avatar
  • 12.7k
0 votes
0 answers
541 views

Jmockit: Mock calls in the @Parameters method

I have a parameterized test class @RunWith(Parameterized.class) class Tests{ private int count; MyClass object; @Parameters public static Collection<Object[]> data() { ...
deborah-digges's user avatar
4 votes
1 answer
278 views

How to implement fixtures in clojure expectations?

I have recently started using the Clojure test framework expectations. As part of my test, I have a data set that I want to reset to its original value before the start of a new test/expect statement. ...
Jared Holmberg's user avatar
1 vote
1 answer
934 views

JMockit mock returns String instead of the List<String> provided

Granted, it's been a while since I used JMockit, but I don't remember this kind of difficulty. I have a very simple test of some very simple code. But even though I set returns = List, the mocked ...
Didjit's user avatar
  • 805
0 votes
0 answers
179 views

Mathematica Conditional Expectation using Mixture Distribution

I'm using Mathematica to find a closed-form solution for a conditional expectation. The distribution I am interested in is a mixture of two trivariate normals. In particular, I would like to know the ...
jackblun's user avatar
1 vote
1 answer
2k views

JMock expectations oneOf VS one difference

Is any difference in using one() or oneOf() in JMock? Cheat sheet says that: oneOf = The invocation is expected once and once only. exactly(n).of = The invocation is expected exactly n times. Note: ...
user1097772's user avatar
  • 3,529
0 votes
1 answer
891 views

rspec, validate the actual Expectation parameter

Is it possible to validate the actual parameter received by a mock objects method parameter? I cannot do a direct comparison because i'm using Fabricate and converting the object into a serialised ...
wired00's user avatar
  • 14.4k