Questions tagged [expected-exception]

90 questions
0
votes
1 answer

Parse Issue: Expected Statement only when archiving

I get a Parse Issue Expected Statement error only when trying to archive my XCode project. I do not receive this error and the app runs fine when I regularly build it instead of archiving. -(void)viewWillAppear:(BOOL)animated { [super…
Timothy Frisch
  • 2,995
  • 2
  • 30
  • 64
0
votes
1 answer

Trouble Arrays and '.class' expected error

Java. So basically I'm having issues with the return in 'createWarehouses' array. Either I get a .class expected error if I return w[] or if I return w I get a mismatch error: "array required but warehouse found" for all the public variables…
abd9344
  • 71
  • 1
  • 1
  • 7
0
votes
0 answers

Testing for MySQL errors

Whenever MySql encounters an error, it stops processing, even if there are more statements following. I need it to report errors but continue processing the remaining statements. I read in…
Devsman
  • 1
  • 1
  • 2
0
votes
2 answers

Why won't this Expect Exception Junit Test Work?

This is my test so far: @Test(expected = FileNotFoundException.class) public void testExpectedException() { UserDataObject u = new UserDataObject("rob123", "Smith", "Robert", "Danny", 1); FlatFileStorage ffstorage = new FlatFileStorage(); …
DeaIss
  • 2,525
  • 7
  • 27
  • 37
0
votes
1 answer

Junit catch Expected Exception

I am doing a tutorial on how to use Expected Exception method to catch exception. I have 2 questions for the code. I used single quote instead of double quote in the line shown below, the error message says 'Invalid character…
user2061466
  • 485
  • 9
  • 17
  • 27
0
votes
2 answers

Expected Exception JUNIT

i want to add an object in DB than check if the object is already there so we can't add it twice. I used JUNIT to test it: @org.junit.Test (expected = ExistingProduct.class) public void AddExisting() { Register aRegister = new Register(); …
0
votes
2 answers

How to indicate that I don't expect an exception in JUnit?

In google test, we have an EXPECT_NO_THROW(x.foo()); How can I do this in JUnit? The thing I want to avoid is having to write a try/catch block, and to specify that my test function would throw anything. Java forces me to declare a throws clause…
xtofl
  • 40,723
  • 12
  • 105
  • 192
-1
votes
1 answer

IndentationError: expected an indented block, but it seems correct

In the code I provided there is an >IndentationError in line 10, or at the END of: > while ((while_bolian == "") and (correct_count >= 0) and (total_count != 0)) or ((while_bolian == True) and (correct_count >= 0) and (total_count != 0)): However…
Jason Rieder
  • 177
  • 1
  • 2
  • 10
-1
votes
1 answer

expected identifier before the name of the function on first line

I have a code: void switch (int *a, int *b) { int temp = *a; *a = *b; *b = temp; } It's the function I include in other .c file by this one .h file: #ifndef SWITCHINT_H #define SWITCHINT_H void switch (int *a, int *b); #endif But…
-1
votes
2 answers

How could I allow Assert in Unit Test with [ExpectedException(typeof(ArgumentException))]?

I found, that simple Unit test [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void UT_UU() { } gives fault with Message: Test method did not throw expected exception System.ArgumentException. I…
-1
votes
2 answers

Expected identifier or '(' in simple for-loop in C

I write functiton, that check is string contain only letters or not. If i declare n outside the loop: int n = strlen(str); for (int i = 0; i < n; i++) it has no errors and works great, but if i move n declaration inside: for (int i = 0, int n =…
lebvlad
  • 49
  • 1
  • 7
-1
votes
1 answer

expected class-name before '{' token, class inheritance

I have a problem with a file of my project, i guess caused by some include issues. The code itself worked fine but since I changed some lines in some other files I get a 'expected class name before '{' token' error. I've already tried to use forward…
-1
votes
2 answers

Why doesn't JUnit's ExpectedException lead to unpredictable state?

From the documentation: public class SimpleExpectedExceptionTest { @Rule public ExpectedException thrown= ExpectedException.none(); @Test public void throwsNothing() { // no exception expected, none thrown: passes. …
djechlin
  • 59,258
  • 35
  • 162
  • 290
-2
votes
3 answers

Why am I receiving a .class is expected? Trying to call a method in java

I'm pretty new to programming feel free to be harsh in your replies. Anything helps. Basically I'm trying to call in a method LineCount() but when I try to compile the command prompt complains about .class being expected at String[A] (line 8 I…
T-coder
  • 105
  • 1
  • 5
-5
votes
1 answer

Where shoud I fix a C++ code about the template?

When I wrote a C++ code and compiled it by the clang++ compiler, error: expected expression template ^ was represented. Why did this error appeared and how do I fix it? #include using namespace std; int main() { template…
user8489282
1 2 3 4 5
6