The method body() in the type ResponseOptions<Response> is not applicable for the arguments - rest-assured

Exception:
The method body() in the type ResponseOptions is not applicable for the arguments (String,equalTo("ShipVia"))
The method equalsTo(String) is undefined for the type String
code:
Response Query1= RestAssured.
given().body("{\"SearchedString\":\"orderdate , customerid by
shipvia \",\"IsTobeSearch\":true,\"dict\":\"{}\"}\r\n" + "").
header("access_token", token).
when().
post("http://xyz/ProcessNLQ").
then().assertThat().statusCode(200).
and().contentType(ContentType.JSON).and().
extract().response().
body("data.reportDefinition.reportPart[0].
reportPartContent.columns.elements[0].name",equalTo("ShipVia"));
//print body in pretty raw format
String Q1 =Query1.prettyPrint();
It is throwing me error as :
The method body() in the type ResponseOptions is not applicable for the arguments (String,equalTo("ShipVia"))

Related

What literal expression has type `void`?

In Zig 0.9, I need a literal expression that has type void, for use as the context parameter to std.sort.sort, so that my lessThan function signature is semantically accurate. Is there some?
I tried these but to no avail:
const ek = #import("std").io.getStdOut().writer();
test "void" {
const kandidati = .{ type, u0, .{}, void, null, undefined };
inline for (kandidati) |k|
try ek.print("{}, ", .{#TypeOf(k)});
try ek.print("\n", .{});
}
giving
Test [0/1] test "void"... type, type, struct:31:37, type, #Type(.Null), #Type(.Undefined),
All 1 tests passed.
I don't want to use a dummy variable like const v: void = undefined;; that's too verbose.
For reference, using void as the context parameter to std.sort.sort with a lessThan function that takes a parameter of type void, gives an error message like
error: expected type 'fn(type,anytype,anytype) anytype', found 'fn(void, Type1, Type1) bool'
The expressions void{}, #as(void, undefined), and {} have type void, for example. You can see {} used in the standard library test cases for std.sort.sort.
The "canonical" way of getting the void value is to use an empty block.

what does [ ] mean in dart when used to wrap a parameter in a function

I have been writing dart for a while and stumbled on this line of code:
String makeCommand(String executable, [List<String>? arguments]) {
var result = executable;
if (arguments == null) return result;
return result + ' ' + arguments.join(' ');
}
the parameter [List<String>? arguments] confuses me because I am used to this {List<String>? arguments}. Can someone help me explain this?
In dart, if you give a function like this hello(int a, int b). You have to provide both a and b value if you are using this function or else you will get type error.
Now if the function is like this hello(int a , [int b]), the parameter b is optional now. You don't have to give the value of b and yet the function works when called by giving only one parameter.
Difference between hello(int a , [int b]) and hello(int a , {int b})
Valid Function call for hello(int a , [int b])
hello(1) //valid
hello(1,2) //valid
hello(1, b:2) // not valid
Valid Function call for hello(int a , {int b})
hello(1) // not valid
hello(1,2) // not valid
hello(1, b:2) // valid
The parameters enclosed in [] are optional positional parameters as shown in the docs
What that means is that you can write both makeCommand("some executable name") and makeCommand("some executable name", some list of arguments) without error

dart's print method only takes one argument

I am trying to print my output to the console, but whenever I do that I get this error, only when I pass it two arguments
Too many positional arguments: 1 allowed, but 2 found. print(nums,experiment); ^.
void main() {
List<int>nums = [2,7,11,15];
nums.addAll([5]);
var experiment = 9;
print(nums,experiment);
}
Too many positional arguments: 1 allowed, but 2 found.
print(nums,experiment);
^
The print function only accept one argument, so you should pass those parameters as a string:
print("$nums,$experiment");
The nums is a list so you can do this:
print("${nums[1]},$experiment");

Error CS1501: No overload for method 'AddArtist' takes 1 arguments

I have this method in my ArtistDB class.
public string AddArtist(Artist ar)
and
ArtistDB obj = new ArtistDB();
obj.AddArtist(ab);
It's giving this error while passing variable the ab to the obj instance of ArtistDB.
Error CS1501: No overload for method 'AddArtist' takes 1 arguments

Mocking NLog4Net with NSubstitute and capturing parameters passed to log.ErrorFormat

Am trying to rewrite into F# the following C# which mocks up a Log4Net logger with NSubstitute and captures the parameters passed to a Log.ErrorFormat call into the _loggerException string.
string _loggerException = string.Empty;
this.c_logger.When(log => log.ErrorFormat(
Arg.Any<string>(), Arg.Any<string>()))
.Do(logger => _loggerException = logger.Arg<string>().ToString());
The following is the F# I have reached
let mutable _loggerException = System.String.Empty
let _logger = Substitute.For<ILog>()
SubstituteExtensions.When(_logger, _logger.WarnFormat(Arg.Any<string>(), Arg.Any<string>())).Do(fun logger -> _loggerException <- logger.Arg<string>())
However I am getting an error on the second parameter to SubstituteExtensions.When - _logger.WarnFormat(Arg.Any<string>(), Arg.Any<string>()) as follows:
This expression was expected to have type Action<ILog> but here has type unit.
Any thoughts on what I am doing wrong?

Resources