DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Popular Topics

article thumbnail
Restful Java Metering by Dropwizard Metrics
Dropwizard has taken the Java world by storm with it's ease of use and great functionality. The metrics library is particularly powerful for anyone wanting to measure statistics in their Java applications.
May 10, 2016
by Thamizh Arasu
· 22,028 Views · 6 Likes
article thumbnail
Multiplication of Two Numbers Using AngularJS
In this article, we will discuss multiplication of two numbers using AngularJS. Read on to see how it's done.
May 10, 2016
by Rajeesh Menoth
· 20,960 Views · 1 Like
article thumbnail
Major Benefits and Limits of Autowiring in Spring Java Web Development
In this post, you will learn about autowiring—its limitations, advantages, and disadvantages in detail. You also get to know about different modes of autowiring used in Java web development.
May 10, 2016
by James Warner
· 101,906 Views · 4 Likes
article thumbnail
Is Polyglot Programming Practical?
This article discusses the history of polyglot programming, and considers whether it's still a valid premise.
May 10, 2016
by Keith Gregory
· 26,354 Views · 46 Likes
article thumbnail
Some Nuances of JavaScript Types
Not everything in JavaScript is an object, and some things are objects that you wouldn't expect to be.
May 6, 2016
by Dave Bush
· 7,498 Views · 4 Likes
article thumbnail
Understanding the Java Garbage Collection Log
To diagnose any memory problems, the Garbage Collection log file is the best place to start. Take a look at the anatomy of a GC log file in this helpful article.
Updated May 5, 2016
by Ram Lakshmanan DZone Core CORE
· 200,271 Views · 39 Likes
article thumbnail
Java 8: Lambda Functions—Usage and Examples
One of the major new language features in Java 8 is the lambda function. In fact, it is one of the biggest changes since the Java 1 release. Take a look at this introduction to Java 8's lambda function.
May 4, 2016
by Hari Kiran G
· 217,068 Views · 10 Likes
article thumbnail
IOT Standards and Remote Services
A thorough and well though out discussion of a simple yet important question; how can we embrace open standards in IoT?
May 4, 2016
by Scott Lewis
· 3,744 Views · 1 Like
article thumbnail
Custom SecurityContext in JAX-RS
An article about how to override the default security-related information associated with a JAX-RS request using a custom SecurityContext.
May 3, 2016
by Abhishek Gupta DZone Core CORE
· 31,235 Views · 9 Likes
article thumbnail
Node.js for Enterprise Applications! Are You Kidding?
Amidst all the hype about using Node.js, still a question remains... Can Node.js be used to develop Enterprise grade applications? Author Mihir Shelat argues Java would be a better option.
May 2, 2016
by Mihir Shelat
· 66,661 Views · 34 Likes
article thumbnail
More Good Programming Quotes
Some of these quotes are funny, and some might make you think.
April 30, 2016
by Henrik Warne
· 13,728 Views · 7 Likes
article thumbnail
Simple, Secure Role Based Access Control (RBAC) For REST APIs
There are a lot of ways to implement Access Controls, and some are slightly complicated. Have you considered using REST?
April 30, 2016
by Sharone Zitzman
· 74,022 Views · 10 Likes
article thumbnail
Sharing Test Classes Between Multiple Modules in a Multi-module Maven Project
Using Maven to effectively test software when test classes are not already packaged by Maven.
April 28, 2016
by Dave Turner
· 56,490 Views · 6 Likes
article thumbnail
Testing Java EE (or Why Integration Tests Are Overrated)
Testing that goes beyond just unit testing and integration testing. Why we should be doing full system testing.
April 27, 2016
by Sebastian Daschner
· 26,180 Views · 7 Likes
article thumbnail
Mocking Method with Wildcard Generic Return Type
[Ivan Zerin provides a primer on mocking methods that contain generic return types.] There are several cases where construction when().thenReturn is not suitable during Unit tests. One of then generic return type. I have faced such issue, let's take a look. There is a method in interface declaration: public interface FooInterface { public Iterable getList(); ... } Implementation looks like this: public class Foo implements FooInterface { public List getList() { ... } ... } At first mocking of such method should not be something unusual: public class UnitTest { @Mock private FooInterface mockFoo; @Test public void someUnitTest() { ... List testList = generateTestList(); when(mockFoo.getList()) .thenReturn(testList); } } But this code won't compile with error: Cannot resolve method 'thenReturn(List). Seems to be some mistake, cause returned type are correct from the interface point of view. This error happening cause compiler can not gurantee that returned type of method getList() will be List. Actually return type of method getList() in this case is Iterable and this means "Return some Iterable object with any objects that extends SomeClass". Let's rename this type as 'X'. So when(mockFoo.getList()) will create object OngoingStubbing> and it has method thenReturn(Iterable). Compiler can not tell what type X before runtime and cannot perform safe cast from List to Iterable (we perfrom actuall call of method thenReturn(List)). Sounds a little tricky but let's assume that SomeClass is standard Java class Number. Then classes Integer and Double are both fulfill the criteria of List. Let's say that as return type of mock we will use List, in this case, compiler should be ready that actual work with code during runtime will be performed with List too, but it is clearly that cast from Double to Integer will be incorrect (try to cast double value 12.6 to int). You could argue that in the case of mockito compiler won't need to bother about the casting of returned type because call of original method would not produce anything, but it is known by mockito. From compiler point of view, it is only Java code, that should be checked for safety and correctness before compiling. Ok, so how we should deal with such cases in mockito? Use doReturn() method: doReturn(testList).when(mockFoo).getList(); Such expression is not type safe, so it were designed for exceprional cases, so use it only when you cannot use standart when().thenReturn(), which is the type-safe, elegant and more readable syntax.
April 27, 2016
by Ivan Zerin
· 44,592 Views · 4 Likes
article thumbnail
Enabling CORS in Node.js [Snippets]
This post shows how to enable CORS in Node. for your cross-domain requests.
April 27, 2016
by Madhuka Udantha
· 239,449 Views · 34 Likes
article thumbnail
Collaborators and Libraries: Java Design Patterns for Success
Should constructors throw exceptions? What can the 1815 Congress of Vienna teach us about good Java design?
April 26, 2016
by Alan Hohn
· 10,770 Views · 7 Likes
article thumbnail
Spring OAuth2 With JWT Sample
Spring Security is an extensible framework for authentication, including support for OAuth 2 and JSON Web Token, two popular choices.
April 26, 2016
by Anh Tuan Nguyen
· 79,170 Views · 11 Likes
article thumbnail
Sorted Pagination in Cassandra
We have a look at how to implement sorted pagination with the popular NoSQL solution Cassandra.
April 26, 2016
by Felipe Fernández
· 13,827 Views · 5 Likes
article thumbnail
Hadoop in Healthcare, Part 1
How Hadoop and open source big data analytics technology are positively helping the healthcare industry become more effective.
April 26, 2016
by Richard Proctor
· 11,110 Views · 4 Likes
  • Previous
  • ...
  • 514
  • 515
  • 516
  • 517
  • 518
  • 519
  • 520
  • 521
  • 522
  • 523
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×