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

Latest Articles - DZone

article thumbnail
10 Questions to Ask When Evaluating a Software Asset
Is your software investment going to pay off? Answer these questions and make an educated guess.
May 1, 2016
by Jonathan Fries
· 9,933 Views · 2 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,701 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
· 73,986 Views · 10 Likes
article thumbnail
How to Interpret and Report Your Performance Test Results (so People Actually Read Them)
Take a look at some of the common mistakes made when measuring and reporting performance, and how can you generate useful reports for your own projects.
April 30, 2016
by Tammy Everts
· 11,022 Views · 3 Likes
article thumbnail
Closure-based State in F#
How to use F# to store state in object or class fields.
April 29, 2016
by Ted Neward
· 12,440 Views · 3 Likes
article thumbnail
Using HTTPS to Secure Your Websites: An Intro to Web Security
It's the post that every developer has been waiting for. All the questions you were too afraid to ask but are pivotally important to know the answers to regarding web security.
April 29, 2016
by Sebastián Peyrott
· 22,340 Views · 33 Likes
article thumbnail
Concurrency and How to Avoid It
The issue of multiple threads or processes trying to modify the same data at the same time is one as old as programming itself. Is it possible to avoid the situation altogether? Or are we left with the current, age-old implements?
April 29, 2016
by Bozhidar Bozhanov
· 69,871 Views · 36 Likes
article thumbnail
Replacing Text in NGINX with sub_filter
Weird situations arise sometimes with web applications. Come have a look at how you might overcome these situations when you need to replace text like IP addresses or files with NGINX!
April 28, 2016
by James Carr
· 26,604 Views · 3 Likes
article thumbnail
Service Discovery for NGINX Plus with ZooKeeper
Learn how to use services registered with Apache Zookeeper to issue API calls correctly.
April 28, 2016
by Patrick Nommensen
· 5,932 Views · 4 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,455 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,150 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,560 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,429 Views · 34 Likes
article thumbnail
Working With AVRO and Parquet Files
Installing and working with tools for AVRO and Parquet files with Scala and Spark
April 27, 2016
by Tim Spann DZone Core CORE
· 19,330 Views · 5 Likes
article thumbnail
Top 10 CSS Bad Practices
CSS is essential for web development; however, it's difficult to get right for your average developer, who may have interests elsewhere in the stack. Read this article to avoid needling inconsistencies and adopt best practices.
April 27, 2016
by Jonathan Danylko
· 10,245 Views · 11 Likes
article thumbnail
Logback Configuration: Using Groovy
Logback is one of the most popular logging frameworks for Java, but did you know you could configure it using Groovy? This guide walks you through the whole process.
April 27, 2016
by John Thompson
· 26,472 Views · 7 Likes
article thumbnail
How to Verify Equality Without Equals Method
When testing it is often quite complicated to compare object with complex fields. By using the Unitils library in Java, this all becomes quite simple and elegant.
April 27, 2016
by Lubos Krnac
· 16,665 Views · 5 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,752 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,147 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,804 Views · 5 Likes
  • Previous
  • ...
  • 1414
  • 1415
  • 1416
  • 1417
  • 1418
  • 1419
  • 1420
  • 1421
  • 1422
  • 1423
  • ...
  • 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
×