Jeanne Boyarsky

author & internet detective
+ Follow
since May 26, 2003
Jeanne likes ...
Eclipse IDE Java VI Editor
Forum Moderator
New York
Cows and Likes
Cows
Total received
726
In last 30 days
2
Total given
99883
Likes
Total received
3941
Received in last 30 days
15
Total given
2822
Given in last 30 days
14
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt Green check
expand Ranch Hand Scavenger Hunt Green check
expand Greenhorn Scavenger Hunt Green check

Recent posts by Jeanne Boyarsky

Junilu Lacar wrote:So these aren't unit tests then? More like contract tests?


Sorta. This is for a COTS application. So we are testing that the configuration of the application is right. So we don't control the REST API we are calling.

Junilu Lacar wrote:If so, there's still a smell of testing at the wrong level. Would you mind showing what a couple of these tests look like in their entirety?


My employer doesn't allow us to post code publicly. But here's the gist:

  • Get credentials
  • Call REST API to get list of users
  • Get user I am trying to account (in this case one that is used to connect two systems)
  • Fail if user not found because config is wrong
  • Assert roles are correct
  • 3 hours ago
    Mohammed,
    Good question! And curiosity is definitely a good thing!

    "private" means that you can only access values of the same class. However, it still allows different instances of the same class to access each other's private variables. Think of it as "private to the class" vs "private to the object".
    3 hours ago
    There isn't an object under test. These tests are calling REST APIs to check data in a system.  Like a monitoring thing.

    For example, I want to get a user from the REST API that returns a list of all users and check the roles it is.
    6 hours ago
    No. That would be a privacy issue.
    9 hours ago
    Rob: I like that! It calls fail and doesn't introduce extra complexity to the code.

    Devaka: I had considered and rejected that idea. Because then I need to add the extra variable (optional vs the one I want.) And also, I need to call get later unconditionally. I'd rather not sprinkle that in my code.
    1 day ago
    Because I can't call fail() in there. If I wasn't using streams, I'd call fail or assert. I'm trying to make the unit test fail if the value isn't found. Hmm. That question suggests that this approach is better.

    1 day ago
    The errata fix avoids that by saying

    DoubleToIntFunction" is not true. It should say "DoubleToIntFunction and ToIntFunction meet all three of these criteria. As does "ToIntFunction"



    It doesn't get into all the generic variations.
    I've found myself writing code like this a few times in JUnit tests. Is there a better way of writing it?

    1 day ago
    This week, we're delighted to have Heartin Kanikathottu helping to answer questions about the new book Serverless Programming Cookbook.

    Packt is offering a 60% discount code for the eBook (Serverless Programming Cookbook ) : SEVPCCM100. This code can be used by everyone and is valid till 15th May 2019.


    The promotion starts Tuesday, April 9th, 2019 and will end on Friday, April 12th, 2019

    We'll be selecting four random posters in this forum to win a free copy of the book provided by the publisher, Packt.


    Image from https://m.media-amazon.com

    Please see the Book Promotion page to ensure your best chances at winning!

    Posts in this welcome thread are not eligible for the drawing, and should be reserved for welcoming the author. Questions posted in this topic are subject to removal.

    Paul Anilprem wrote:OCAJP/OCAPJP 8 will not be "old" for another couple of years at least.  Java 8 exams already include some of the most important topics (streams and lambda) so I would not worry too much about it going obsolete anytime soon. It will still be as valuable as it was.


    Agreed!

    Paul Anilprem wrote:I don't think the new exams (815 and 816) are any more tough that the older (808 and 809) exams but the absence of books and mock exams certainly make them look like so. This will not be a problem in a couple of months time. However, the bigger issue is the focus of the new exams. The new exams focus quite a bit on modularization. But modularization is not yet a clear winner in the industry, IMHO. So, I don't think you would be losing out much by not going for the new exams.


    Scott said the 815 is harder. Neither of has taken the 816 yet so can't comment on that though.

    I would strongly recommend people take the OCA/OCP 8. Probably for another year.
    I'm on Java 9, but I really need to be on nine and three quarters. How do I upgrade?
    I'm on Java 9, but I really need to be on nine and three quarters. How do I upgrade?